Commit 0e68e6ea authored by unknown's avatar unknown

Automatic merge.

parents ce068186 1378aa0e
......@@ -666,6 +666,9 @@ libmysqld/time.cc
libmysqld/tztime.cc
libmysqld/uniques.cc
libmysqld/unireg.cc
libmysqld/discover_xt.cc
libmysqld/ha_pbxt.cc
libmysqld/myxt_xt.cc
libmysqltest/*.ds?
libmysqltest/*.vcproj
libmysqltest/mytest.c
......
......@@ -267,7 +267,6 @@ dnl we have to recompile these modules when we want to
dnl to compile server parts with the different #defines
dnl Normally it happens when we compile the embedded server
dnl Thus one should mark such files in his handler using this macro
dnl (currently only one such a file per plugin is supported)
dnl
dnl ---------------------------------------------------------------------------
......@@ -463,11 +462,13 @@ dnl Although this is "pretty", it breaks libmysqld build
mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]"
[with_plugin_]$2=yes
AC_MSG_RESULT([yes])
m4_ifdef([$11],[
condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp($11, [[^/]+$], [\&])"
condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp($11, [[^/]+\.], [\&o])"
condition_dependent_plugin_links="$condition_dependent_plugin_links $6/$11"
condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp($11, [^.+[/$]], [\&])"
m4_ifdef([$11], [
m4_foreach([plugin], [$11], [
condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp(plugin, [[^/]+$], [\&])"
condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp(plugin, [[^/]+\.], [\&o])"
condition_dependent_plugin_links="$condition_dependent_plugin_links $6/plugin"
condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp(plugin, [^.+[/$]], [\&])"
])
])
fi
fi
......
......@@ -15,7 +15,7 @@ AC_CANONICAL_SYSTEM
# MySQL version number.
#
# Note: the following line must be parseable by win/configure.js:GetVersion()
AM_INIT_AUTOMAKE(mysql, 5.1.41-MariaDB-beta)
AM_INIT_AUTOMAKE(mysql, 5.1.41-MariaDB-rc)
AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10
......
......@@ -301,6 +301,9 @@ sub main {
}
}
# Check for plugin availability so we know whether to skip tests or not.
detect_plugins();
mtr_report("Collecting tests...");
my $tests= collect_test_cases($opt_suites, \@opt_cases);
......@@ -1877,6 +1880,37 @@ sub have_maria_support () {
}
# Detect plugin presense and set environment variables appropriately.
# This needs to be done early, so we can know whether to skip tests.
sub detect_plugins {
# --------------------------------------------------------------------------
# Add the path where mysqld will find ha_example.so
# --------------------------------------------------------------------------
if ($mysql_version_id >= 50100) {
my $plugin_filename;
if (IS_WINDOWS)
{
$plugin_filename = "ha_example.dll";
}
else
{
$plugin_filename = "ha_example.so";
}
my $lib_example_plugin=
mtr_file_exists(vs_config_dirs('storage/example',$plugin_filename),
"$basedir/storage/example/.libs/".$plugin_filename,
"$basedir/lib/mariadb/plugin/".$plugin_filename,
"$basedir/lib/mysql/plugin/".$plugin_filename);
$ENV{'EXAMPLE_PLUGIN'}=
($lib_example_plugin ? basename($lib_example_plugin) : "");
$ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=".
($lib_example_plugin ? dirname($lib_example_plugin) : "");
$ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'";
$ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".$plugin_filename;
}
}
#
# Set environment to be used by childs of this process for
# things that are constant during the whole lifetime of mysql-test-run
......@@ -1935,33 +1969,6 @@ sub environment_setup {
$ENV{'UDF_EXAMPLE_LIB_OPT'}= "--plugin-dir=".
($lib_udf_example ? dirname($lib_udf_example) : "");
# --------------------------------------------------------------------------
# Add the path where mysqld will find ha_example.so
# --------------------------------------------------------------------------
if ($mysql_version_id >= 50100) {
my $plugin_filename;
if (IS_WINDOWS)
{
$plugin_filename = "ha_example.dll";
}
else
{
$plugin_filename = "ha_example.so";
}
my $lib_example_plugin=
mtr_file_exists(vs_config_dirs('storage/example',$plugin_filename),
"$basedir/storage/example/.libs/".$plugin_filename,
"$basedir/lib/mariadb/plugin/".$plugin_filename,
"$basedir/lib/mysql/plugin/".$plugin_filename);
$ENV{'EXAMPLE_PLUGIN'}=
($lib_example_plugin ? basename($lib_example_plugin) : "");
$ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=".
($lib_example_plugin ? dirname($lib_example_plugin) : "");
$ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'";
$ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".$plugin_filename;
}
# ----------------------------------------------------
# Add the path where mysqld will find mypluglib.so
# ----------------------------------------------------
......
......@@ -968,7 +968,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
CREATE INDEX idx_b ON t8(b);
EXPLAIN EXTENDED
EXPLAIN
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1
......@@ -1003,22 +1003,23 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
Warnings:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3
1 SIMPLE t6 ALL NULL NULL NULL NULL 3
1 SIMPLE t7 ALL NULL NULL NULL NULL 2
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using join buffer
ATTENTION: the above EXPLAIN has several competing QEPs with identical
. costs. To combat the plan change it uses --sorted_result and
. and --replace tricks
CREATE INDEX idx_b ON t1(b);
CREATE INDEX idx_a ON t0(a);
EXPLAIN EXTENDED
EXPLAIN
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1
......@@ -1053,19 +1054,20 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where
1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
Note 1003 select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
Warnings:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ref idx_a idx_a 5 const 1
1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t3 ALL NULL NULL NULL NULL 2
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3
1 SIMPLE t6 ALL NULL NULL NULL NULL 3
1 SIMPLE t7 ALL NULL NULL NULL NULL 2
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 Using join buffer
ATTENTION: the above EXPLAIN has several competing QEPs with identical
. costs. To combat the plan change it uses --sorted_result
. and --replace tricks
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1
......
......@@ -1212,7 +1212,7 @@ c1
2147483647
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(255));
LOAD DATA LOCAL INFILE 'suite/pbxt/t/load_unique_error1.inc' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2;
LOAD DATA LOCAL INFILE 'MYSQLTEST_VARDIR/std_data/pbxt_load_unique_error1.inc' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2;
SELECT * FROM t1 ORDER BY c1;
c1 c2
0 opq
......
......@@ -546,8 +546,9 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
CREATE INDEX idx_b ON t8(b);
--replace_regex /Using where; // /Using where//
--sorted_result
EXPLAIN EXTENDED
EXPLAIN
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1
......@@ -582,12 +583,16 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
--echo ATTENTION: the above EXPLAIN has several competing QEPs with identical
--echo . costs. To combat the plan change it uses --sorted_result and
--echo . and --replace tricks
CREATE INDEX idx_b ON t1(b);
CREATE INDEX idx_a ON t0(a);
--replace_regex /Using where; // /Using where//
--sorted_result
EXPLAIN EXTENDED
EXPLAIN
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1
......@@ -622,6 +627,9 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
(t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
--echo ATTENTION: the above EXPLAIN has several competing QEPs with identical
--echo . costs. To combat the plan change it uses --sorted_result
--echo . and --replace tricks
--sorted_result
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
......
......@@ -921,7 +921,8 @@ SELECT c1 FROM t2;
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(255));
LOAD DATA LOCAL INFILE 'suite/pbxt/t/load_unique_error1.inc' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/std_data/pbxt_load_unique_error1.inc' REPLACE INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (@c1,c2) SET c1 = @c1 % 2;
--sorted_result
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;
......
# This test covers various aspects of PBXT locking mechanism, including
# internal permanent/temporary row locking and MySQL locking
# SHOW PROCESSLIST has hardcoded "Writing to net" as state.
-- source include/not_embedded.inc
# TEST: select for update test
drop table if exists t1;
......
# We cannot run mysqldump against embedded server.
-- source include/not_embedded.inc
--disable_warnings
drop table if exists t1, t2, t3;
--enable_warnings
......
......@@ -582,7 +582,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ;
# rename must fail, t7 does not exist
# Clean up the filename here because embedded server reports whole path
--replace_result $MYSQLTEST_VARDIR . master-data/ '' t7.frm t7
--replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' t7.frm t7
--error 1017
execute stmt1 ;
create table t7 (a int) ;
......
......@@ -278,6 +278,11 @@ enum legacy_db_type
DB_TYPE_FIRST_DYNAMIC=42,
DB_TYPE_DEFAULT=127 // Must be last
};
/*
Better name for DB_TYPE_UNKNOWN. Should be used for engines that do not have
a hard-coded type value here.
*/
#define DB_TYPE_AUTOASSIGN DB_TYPE_UNKNOWN
enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
......
......@@ -1168,22 +1168,7 @@ int plugin_init(int *argc, char **argv, int flags)
!my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name,
6, (const uchar*) "InnoDB", 6))
continue;
#ifdef EMBEDDED_LIBRARY
/*
MariaDB: disable PBXT in embedded server. We do this for two reasons
- PBXT currently doesn't work in embedded server (see
https://bugs.launchpad.net/maria/+bug/439889)
- Embedded server is supposed to be "leaner" and our current
understanding of that is "without PBXT". At the same time, we want
regular server to be with PBXT, and since we don't support compiling
embedded server with different options than the regular server,
the only way was to disable PBXT from here.
*/
if (!my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name,
4, (const uchar*) "PBXT", 4))
continue;
#endif
bzero(&tmp, sizeof(tmp));
tmp.plugin= plugin;
tmp.name.str= (char *)plugin->name;
......
PBXT Release Notes
==================
------- 1.0.09g RC3 - 2009-12-16
RN292: Fixed a bug that resulted in 2-phase commit not being used between PBXT and the binlog. This bug was a result of a hack which as added to solve a problem in an pre-release version of MySQL 5.1. The hack was removed.
------- 1.0.09f RC3 - 2009-11-30
RN291: Fixed bug #489088: On shutdown MySQL reports: [Warning] Plugin 'PBXT' will be forced to shutdown.
......
......@@ -5,3 +5,4 @@ MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt.a])
MYSQL_PLUGIN_ACTIONS(pbxt, [
# AC_CONFIG_FILES(storage/pbxt/src/Makefile)
])
MYSQL_PLUGIN_DEPENDS_ON_MYSQL_INTERNALS(pbxt, [[src/ha_pbxt.cc],[src/myxt_xt.cc],[src/discover_xt.cc]])
......@@ -46,7 +46,5 @@ libpbxt_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99
EXTRA_LIBRARIES = libpbxt.a
noinst_LIBRARIES = libpbxt.a
libpbxt_a_SOURCES = $(libpbxt_la_SOURCES)
libpbxt_a_CXXFLAGS = $(AM_CXXFLAGS)
libpbxt_a_CFLAGS = $(AM_CFLAGS) -std=c99
EXTRA_DIST = pbms_enabled.cc win_inttypes.h
......@@ -355,10 +355,10 @@ static int sort_keys(KEY *a, KEY *b)
{
if (!(b_flags & HA_NOSAME))
return -1;
if ((a_flags ^ b_flags) & (HA_NULL_PART_KEY | HA_END_SPACE_KEY))
if ((a_flags ^ b_flags) & HA_NULL_PART_KEY)
{
/* Sort NOT NULL keys before other keys */
return (a_flags & (HA_NULL_PART_KEY | HA_END_SPACE_KEY)) ? 1 : -1;
return (a_flags & HA_NULL_PART_KEY) ? 1 : -1;
}
if (a->name == primary_key_name)
return -1;
......
......@@ -1175,8 +1175,13 @@ static int pbxt_init(void *p)
* +1 Temporary thread (e.g. TempForClose, TempForEnd)
*/
#ifndef DRIZZLED
if (pbxt_max_threads == 0)
if (pbxt_max_threads == 0) {
// Embedded server sets max_connections=1
if (max_connections > 1)
pbxt_max_threads = max_connections + 7;
else
pbxt_max_threads = 100;
}
#endif
self = xt_init_threading(pbxt_max_threads); /* Create the main self: */
if (!self)
......@@ -1442,7 +1447,7 @@ static int pbxt_commit(handlerton *hton, THD *thd, bool all)
XTThreadPtr self;
if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {
XT_PRINT1(self, "pbxt_commit all=%d\n", all);
XT_PRINT2(self, "%s pbxt_commit all=%d\n", all ? "END CONN XACT" : "END STAT", all);
if (self->st_xact_data) {
/* There are no table locks, commit immediately in all cases
......@@ -1474,7 +1479,7 @@ static int pbxt_rollback(handlerton *hton, THD *thd, bool all)
XTThreadPtr self;
if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) {
XT_PRINT1(self, "pbxt_rollback all=%d in pbxt_commit\n", all);
XT_PRINT2(self, "%s pbxt_rollback all=%d\n", all ? "CONN END XACT" : "STAT END", all);
if (self->st_xact_data) {
/* There are no table locks, rollback immediately in all cases
......@@ -1538,7 +1543,7 @@ static int pbxt_prepare(handlerton *hton, THD *thd, bool all)
* except when this is a statement commit with an explicit
* transaction (!all && !self->st_auto_commit).
*/
if (all) {
if (all || self->st_auto_commit) {
XID xid;
XT_PRINT0(self, "xt_xn_prepare in pbxt_prepare\n");
......@@ -2620,26 +2625,7 @@ int ha_pbxt::write_row(byte *buf)
}
#endif
/* GOTCHA: I have a huge problem with the transaction statement.
* It is not ALWAYS committed (I mean ha_commit_trans() is
* not always called - for example in SELECT).
*
* If I call trans_register_ha() but ha_commit_trans() is not called
* then MySQL thinks a transaction is still running (while
* I have committed the auto-transaction in ha_pbxt::external_lock()).
*
* This causes all kinds of problems, like transactions
* are killed when they should not be.
*
* To prevent this, I only inform MySQL that a transaction
* has beens started when an update is performed. I have determined that
* ha_commit_trans() is only guarenteed to be called if an update is done.
*/
if (!pb_open_tab->ot_thread->st_stat_trans) {
trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
XT_PRINT0(pb_open_tab->ot_thread, "ha_pbxt::write_row trans_register_ha all=FALSE\n");
pb_open_tab->ot_thread->st_stat_trans = TRUE;
}
/* {START-STAT-HACK} previously position of start statement hack. */
xt_xlog_check_long_writer(pb_open_tab->ot_thread);
......@@ -2730,11 +2716,7 @@ int ha_pbxt::update_row(const byte * old_data, byte * new_data)
XT_DISABLED_TRACE(("UPDATE tx=%d val=%d\n", (int) self->st_xact_data->xd_start_xn_id, (int) XT_GET_DISK_4(&new_data[1])));
//statistic_increment(ha_update_count,&LOCK_status);
if (!self->st_stat_trans) {
trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
XT_PRINT0(self, "ha_pbxt::update_row trans_register_ha all=FALSE\n");
self->st_stat_trans = TRUE;
}
/* {START-STAT-HACK} previously position of start statement hack. */
xt_xlog_check_long_writer(self);
......@@ -2821,11 +2803,7 @@ int ha_pbxt::delete_row(const byte * buf)
}
#endif
if (!pb_open_tab->ot_thread->st_stat_trans) {
trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
XT_PRINT0(pb_open_tab->ot_thread, "ha_pbxt::delete_row trans_register_ha all=FALSE\n");
pb_open_tab->ot_thread->st_stat_trans = TRUE;
}
/* {START-STAT-HACK} previously position of start statement hack. */
xt_xlog_check_long_writer(pb_open_tab->ot_thread);
......@@ -3155,15 +3133,12 @@ int ha_pbxt::index_init(uint idx, bool XT_UNUSED(sorted))
printf("index_init %s index %d cols req=%d/%d read_bits=%X write_bits=%X index_bits=%X\n", pb_open_tab->ot_table->tab_name->ps_path, (int) idx, pb_open_tab->ot_cols_req, pb_open_tab->ot_cols_req, (int) *table->read_set->bitmap, (int) *table->write_set->bitmap, (int) *ind->mi_col_map.bitmap);
#endif
/* {START-STAT-HACK} previously position of start statement hack,
* previous comment to code below: */
/* Start a statement based transaction as soon
* as a read is done for a modify type statement!
* Previously, this was done too late!
*/
if (!thread->st_stat_trans) {
trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
XT_PRINT0(thread, "ha_pbxt::update_row trans_register_ha all=FALSE\n");
thread->st_stat_trans = TRUE;
}
}
else {
pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set);
......@@ -3612,15 +3587,12 @@ int ha_pbxt::rnd_init(bool scan)
/* The number of columns required: */
if (pb_open_tab->ot_is_modify) {
pb_open_tab->ot_cols_req = table->read_set->MX_BIT_SIZE();
/* {START-STAT-HACK} previously position of start statement hack,
* previous comment to code below: */
/* Start a statement based transaction as soon
* as a read is done for a modify type statement!
* Previously, this was done too late!
*/
if (!thread->st_stat_trans) {
trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
XT_PRINT0(thread, "ha_pbxt::update_row trans_register_ha all=FALSE\n");
thread->st_stat_trans = TRUE;
}
}
else {
pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set);
......@@ -4631,7 +4603,7 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type)
cont_(b);
}
/* See (***) */
/* See {IS-UPDATE-STAT} */
self->st_is_update = FALSE;
/* Auto begin a transaction (if one is not already running): */
......@@ -4660,7 +4632,7 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type)
}
/*
* (**) GOTCHA: trans_register_ha() is not mentioned in the documentation.
* {START-TRANS} GOTCHA: trans_register_ha() is not mentioned in the documentation.
* It must be called to inform MySQL that we have a transaction (see start_stmt).
*
* Here are some tests that confirm whether things are done correctly:
......@@ -4698,10 +4670,46 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type)
*/
if (!self->st_auto_commit) {
trans_register_ha(thd, TRUE, pbxt_hton);
XT_PRINT0(self, "ha_pbxt::external_lock trans_register_ha all=TRUE\n");
XT_PRINT0(self, "CONN START XACT - ha_pbxt::external_lock --> trans_register_ha\n");
}
}
/* Start a statment transaction: */
/* {START-STAT-HACK} The problem that ha_commit_trans() is not
* called by MySQL seems to be fixed (tests confirm this).
* Here is the previous comment when this code was execute
* here {START-STAT-HACK}
*
* GOTCHA: I have a huge problem with the transaction statement.
* It is not ALWAYS committed (I mean ha_commit_trans() is
* not always called - for example in SELECT).
*
* If I call trans_register_ha() but ha_commit_trans() is not called
* then MySQL thinks a transaction is still running (while
* I have committed the auto-transaction in ha_pbxt::external_lock()).
*
* This causes all kinds of problems, like transactions
* are killed when they should not be.
*
* To prevent this, I only inform MySQL that a transaction
* has beens started when an update is performed. I have determined that
* ha_commit_trans() is only guarenteed to be called if an update is done.
* --------
*
* So, this is the correct place to start a statement transaction.
*
* Note: if trans_register_ha() is not called before ha_write_row(), then
* PBXT is not registered correctly as a modification transaction.
* (mark_trx_read_write call in ha_write_row).
* This leads to 2-phase commit not being called as it should when
* binary logging is enabled.
*/
if (!pb_open_tab->ot_thread->st_stat_trans) {
trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
XT_PRINT0(pb_open_tab->ot_thread, "STAT START - ha_pbxt::external_lock --> trans_register_ha\n");
pb_open_tab->ot_thread->st_stat_trans = TRUE;
}
if (lock_type == F_WRLCK || self->st_xact_mode < XT_XACT_REPEATABLE_READ)
self->st_visible_time = self->st_database->db_xn_end_time;
......@@ -4826,7 +4834,7 @@ int ha_pbxt::start_stmt(THD *thd, thr_lock_type lock_type)
}
}
/* (***) This is required at this level!
/* {IS-UPDATE-STAT} This is required at this level!
* No matter how often it is called, it is still the start of a
* statement. We need to make sure statements that are NOT mistaken
* for different type of statement.
......@@ -4841,7 +4849,7 @@ int ha_pbxt::start_stmt(THD *thd, thr_lock_type lock_type)
*/
self->st_is_update = FALSE;
/* See comment (**) */
/* See comment {START-TRANS} */
if (!self->st_xact_data) {
self->st_xact_mode = thd_tx_isolation(thd) <= ISO_READ_COMMITTED ? XT_XACT_COMMITTED_READ : XT_XACT_REPEATABLE_READ;
self->st_ignore_fkeys = (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) != 0;
......@@ -4858,10 +4866,17 @@ int ha_pbxt::start_stmt(THD *thd, thr_lock_type lock_type)
}
if (!self->st_auto_commit) {
trans_register_ha(thd, TRUE, pbxt_hton);
XT_PRINT0(self, "ha_pbxt::start_stmt trans_register_ha all=TRUE\n");
XT_PRINT0(self, "START CONN XACT - ha_pbxt::start_stmt --> trans_register_ha\n");
}
}
/* Start a statment (see {START-STAT-HACK}): */
if (!pb_open_tab->ot_thread->st_stat_trans) {
trans_register_ha(pb_mysql_thd, FALSE, pbxt_hton);
XT_PRINT0(pb_open_tab->ot_thread, "START STAT - ha_pbxt::start_stmt --> trans_register_ha\n");
pb_open_tab->ot_thread->st_stat_trans = TRUE;
}
if (pb_open_tab->ot_for_update || self->st_xact_mode < XT_XACT_REPEATABLE_READ)
self->st_visible_time = self->st_database->db_xn_end_time;
......
......@@ -380,7 +380,7 @@ xtPublic void xt_int8_to_byte_size(xtInt8 value, char *string)
/* Version number must also be set in configure.in! */
xtPublic c_char *xt_get_version(void)
{
return "1.0.09f RC";
return "1.0.09g RC";
}
/* Copy and URL decode! */
......
......@@ -1297,7 +1297,7 @@ xtPublic void xt_create_table(XTThreadPtr self, XTPathStrPtr name, XTDictionaryP
XTSortedListInfoRec li_undo;
#ifdef TRACE_CREATE_TABLES
printf("CREATE %s\n", name->ps_path);
fprintf(stderr, "CREATE %s\n", name->ps_path);
#endif
enter_();
if (strlen(xt_last_name_of_path(name->ps_path)) > XT_TABLE_NAME_SIZE-1)
......@@ -1619,7 +1619,7 @@ xtPublic void xt_drop_table(XTThreadPtr self, XTPathStrPtr tab_name, xtBool drop
enter_();
#ifdef TRACE_CREATE_TABLES
printf("DROP %s\n", tab_name->ps_path);
fprintf(stderr, "DROP %s\n", tab_name->ps_path);
#endif
table_pool = tab_lock_table(self, tab_name, FALSE, TRUE, TRUE, &tab);
......@@ -1777,7 +1777,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
u_llong ext_data_len = 0;
#if defined(DUMP_CHECK_TABLE) || defined(CHECK_TABLE_STATS)
printf("\nCHECK TABLE: %s\n", tab->tab_name->ps_path);
fprintf(stderr, "\nCHECK TABLE: %s\n", tab->tab_name->ps_path);
#endif
xt_lock_mutex(self, &tab->tab_db->db_co_ext_lock);
......@@ -1787,38 +1787,38 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
pushr_(xt_unlock_mutex, &tab->tab_rec_lock);
#ifdef CHECK_TABLE_STATS
printf("Record buffer size = %lu\n", (u_long) tab->tab_dic.dic_mysql_buf_size);
printf("Fixed length rec. len. = %lu\n", (u_long) tab->tab_dic.dic_mysql_rec_size);
printf("Handle data record size = %lu\n", (u_long) tab->tab_dic.dic_rec_size);
printf("Min/max header size = %d/%d\n", (int) offsetof(XTTabRecFix, rf_data), tab->tab_dic.dic_rec_fixed ? (int) offsetof(XTTabRecFix, rf_data) : (int) offsetof(XTTabRecExtDRec, re_data));
printf("Min/avg/max record size = %llu/%llu/%llu\n", (u_llong) tab->tab_dic.dic_min_row_size, (u_llong) tab->tab_dic.dic_ave_row_size, (u_llong) tab->tab_dic.dic_max_row_size);
fprintf(stderr, "Record buffer size = %lu\n", (u_long) tab->tab_dic.dic_mysql_buf_size);
fprintf(stderr, "Fixed length rec. len. = %lu\n", (u_long) tab->tab_dic.dic_mysql_rec_size);
fprintf(stderr, "Handle data record size = %lu\n", (u_long) tab->tab_dic.dic_rec_size);
fprintf(stderr, "Min/max header size = %d/%d\n", (int) offsetof(XTTabRecFix, rf_data), tab->tab_dic.dic_rec_fixed ? (int) offsetof(XTTabRecFix, rf_data) : (int) offsetof(XTTabRecExtDRec, re_data));
fprintf(stderr, "Min/avg/max record size = %llu/%llu/%llu\n", (u_llong) tab->tab_dic.dic_min_row_size, (u_llong) tab->tab_dic.dic_ave_row_size, (u_llong) tab->tab_dic.dic_max_row_size);
if (tab->tab_dic.dic_def_ave_row_size)
printf("Avg row len set for tab = %lu\n", (u_long) tab->tab_dic.dic_def_ave_row_size);
fprintf(stderr, "Avg row len set for tab = %lu\n", (u_long) tab->tab_dic.dic_def_ave_row_size);
else
printf("Avg row len set for tab = not specified\n");
printf("Rows fixed length = %s\n", tab->tab_dic.dic_rec_fixed ? "YES" : "NO");
fprintf(stderr, "Avg row len set for tab = not specified\n");
fprintf(stderr, "Rows fixed length = %s\n", tab->tab_dic.dic_rec_fixed ? "YES" : "NO");
if (tab->tab_dic.dic_tab_flags & XT_TAB_FLAGS_TEMP_TAB)
printf("Table type = TEMP\n");
fprintf(stderr, "Table type = TEMP\n");
if (tab->tab_dic.dic_def_ave_row_size)
printf("Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH_SPEC);
fprintf(stderr, "Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH_SPEC);
else
printf("Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH);
printf("Minimum variable size = %lu\n", (u_long) XT_TAB_MIN_VAR_REC_LENGTH);
printf("Minimum auto-increment = %llu\n", (u_llong) tab->tab_dic.dic_min_auto_inc);
printf("Number of columns = %lu\n", (u_long) tab->tab_dic.dic_no_of_cols);
printf("Number of fixed columns = %lu\n", (u_long) tab->tab_dic.dic_fix_col_count);
printf("Columns req. for index = %lu\n", (u_long) tab->tab_dic.dic_ind_cols_req);
fprintf(stderr, "Maximum fixed size = %lu\n", (u_long) XT_TAB_MAX_FIX_REC_LENGTH);
fprintf(stderr, "Minimum variable size = %lu\n", (u_long) XT_TAB_MIN_VAR_REC_LENGTH);
fprintf(stderr, "Minimum auto-increment = %llu\n", (u_llong) tab->tab_dic.dic_min_auto_inc);
fprintf(stderr, "Number of columns = %lu\n", (u_long) tab->tab_dic.dic_no_of_cols);
fprintf(stderr, "Number of fixed columns = %lu\n", (u_long) tab->tab_dic.dic_fix_col_count);
fprintf(stderr, "Columns req. for index = %lu\n", (u_long) tab->tab_dic.dic_ind_cols_req);
if (tab->tab_dic.dic_ind_rec_len)
printf("Rec len req. for index = %llu\n", (u_llong) tab->tab_dic.dic_ind_rec_len);
printf("Columns req. for blobs = %lu\n", (u_long) tab->tab_dic.dic_blob_cols_req);
printf("Number of blob columns = %lu\n", (u_long) tab->tab_dic.dic_blob_count);
printf("Number of indices = %lu\n", (u_long) tab->tab_dic.dic_key_count);
fprintf(stderr, "Rec len req. for index = %llu\n", (u_llong) tab->tab_dic.dic_ind_rec_len);
fprintf(stderr, "Columns req. for blobs = %lu\n", (u_long) tab->tab_dic.dic_blob_cols_req);
fprintf(stderr, "Number of blob columns = %lu\n", (u_long) tab->tab_dic.dic_blob_count);
fprintf(stderr, "Number of indices = %lu\n", (u_long) tab->tab_dic.dic_key_count);
#endif
#ifdef DUMP_CHECK_TABLE
printf("Records:-\n");
printf("Free list: %llu (%llu)\n", (u_llong) tab->tab_rec_free_id, (u_llong) tab->tab_rec_fnum);
printf("EOF: %llu\n", (u_llong) tab->tab_rec_eof_id);
fprintf(stderr, "Records:-\n");
fprintf(stderr, "Free list: %llu (%llu)\n", (u_llong) tab->tab_rec_free_id, (u_llong) tab->tab_rec_fnum);
fprintf(stderr, "EOF: %llu\n", (u_llong) tab->tab_rec_eof_id);
#endif
rec_size = XT_REC_EXT_HEADER_SIZE;
......@@ -1830,24 +1830,24 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
xt_throw(self);
#ifdef DUMP_CHECK_TABLE
printf("%-4llu ", (u_llong) rec_id);
fprintf(stderr, "%-4llu ", (u_llong) rec_id);
#endif
switch (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_MASK) {
case XT_TAB_STATUS_FREED:
#ifdef DUMP_CHECK_TABLE
printf("======== ");
fprintf(stderr, "======== ");
#endif
free_rec_count++;
break;
case XT_TAB_STATUS_DELETE:
#ifdef DUMP_CHECK_TABLE
printf("delete ");
fprintf(stderr, "delete ");
#endif
delete_rec_count++;
break;
case XT_TAB_STATUS_FIXED:
#ifdef DUMP_CHECK_TABLE
printf("record-F ");
fprintf(stderr, "record-F ");
#endif
alloc_rec_count++;
row_size = myxt_store_row_length(ot, (char *) ot->ot_row_rbuffer + XT_REC_FIX_HEADER_SIZE);
......@@ -1859,7 +1859,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
break;
case XT_TAB_STATUS_VARIABLE:
#ifdef DUMP_CHECK_TABLE
printf("record-V ");
fprintf(stderr, "record-V ");
#endif
alloc_rec_count++;
row_size = myxt_load_row_length(ot, tab->tab_dic.dic_rec_size, ot->ot_row_rbuffer + XT_REC_FIX_HEADER_SIZE, NULL);
......@@ -1871,7 +1871,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
break;
case XT_TAB_STATUS_EXT_DLOG:
#ifdef DUMP_CHECK_TABLE
printf("record-X ");
fprintf(stderr, "record-X ");
#endif
alloc_rec_count++;
ext_data_len += XT_GET_DISK_4(rec_buf->re_log_dat_siz_4);
......@@ -1885,9 +1885,9 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
}
#ifdef DUMP_CHECK_TABLE
if (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_CLEANED_BIT)
printf("C");
fprintf(stderr, "C");
else
printf(" ");
fprintf(stderr, " ");
#endif
prev_rec_id = XT_GET_DISK_4(rec_buf->tr_prev_rec_id_4);
xn_id = XT_GET_DISK_4(rec_buf->tr_xact_id_4);
......@@ -1895,12 +1895,12 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
switch (rec_buf->tr_rec_type_1 & XT_TAB_STATUS_MASK) {
case XT_TAB_STATUS_FREED:
#ifdef DUMP_CHECK_TABLE
printf(" prev=%-3llu (xact=%-3llu row=%lu)\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id);
fprintf(stderr, " prev=%-3llu (xact=%-3llu row=%lu)\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id);
#endif
break;
case XT_TAB_STATUS_EXT_DLOG:
#ifdef DUMP_CHECK_TABLE
printf(" prev=%-3llu xact=%-3llu row=%lu Xlog=%lu Xoff=%llu Xsiz=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id, (u_long) XT_GET_DISK_2(rec_buf->re_log_id_2), (u_llong) XT_GET_DISK_6(rec_buf->re_log_offs_6), (u_long) XT_GET_DISK_4(rec_buf->re_log_dat_siz_4));
fprintf(stderr, " prev=%-3llu xact=%-3llu row=%lu Xlog=%lu Xoff=%llu Xsiz=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id, (u_long) XT_GET_DISK_2(rec_buf->re_log_id_2), (u_llong) XT_GET_DISK_6(rec_buf->re_log_offs_6), (u_long) XT_GET_DISK_4(rec_buf->re_log_dat_siz_4));
#endif
log_size = XT_GET_DISK_4(rec_buf->re_log_dat_siz_4);
......@@ -1922,7 +1922,7 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
break;
default:
#ifdef DUMP_CHECK_TABLE
printf(" prev=%-3llu xact=%-3llu row=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id);
fprintf(stderr, " prev=%-3llu xact=%-3llu row=%lu\n", (u_llong) prev_rec_id, (u_llong) xn_id, (u_long) row_id);
#endif
break;
}
......@@ -1931,16 +1931,16 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
#ifdef CHECK_TABLE_STATS
if (!tab->tab_dic.dic_rec_fixed)
printf("Extendend data length = %llu\n", ext_data_len);
fprintf(stderr, "Extendend data length = %llu\n", ext_data_len);
if (alloc_rec_count) {
printf("Minumum comp. rec. len. = %llu\n", (u_llong) min_comp_rec_len);
printf("Average comp. rec. len. = %llu\n", (u_llong) ((double) alloc_rec_bytes / (double) alloc_rec_count + (double) 0.5));
printf("Maximum comp. rec. len. = %llu\n", (u_llong) max_comp_rec_len);
fprintf(stderr, "Minumum comp. rec. len. = %llu\n", (u_llong) min_comp_rec_len);
fprintf(stderr, "Average comp. rec. len. = %llu\n", (u_llong) ((double) alloc_rec_bytes / (double) alloc_rec_count + (double) 0.5));
fprintf(stderr, "Maximum comp. rec. len. = %llu\n", (u_llong) max_comp_rec_len);
}
printf("Free record count = %llu\n", (u_llong) free_rec_count);
printf("Deleted record count = %llu\n", (u_llong) delete_rec_count);
printf("Allocated record count = %llu\n", (u_llong) alloc_rec_count);
fprintf(stderr, "Free record count = %llu\n", (u_llong) free_rec_count);
fprintf(stderr, "Deleted record count = %llu\n", (u_llong) delete_rec_count);
fprintf(stderr, "Allocated record count = %llu\n", (u_llong) alloc_rec_count);
#endif
if (tab->tab_rec_fnum != free_rec_count)
xt_logf(XT_INFO, "Table %s: incorrect number of free blocks, %llu, should be: %llu\n", tab->tab_name, (u_llong) free_rec_count, (u_llong) tab->tab_rec_fnum);
......@@ -1978,9 +1978,9 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
pushr_(xt_unlock_mutex, &tab->tab_row_lock);
#ifdef DUMP_CHECK_TABLE
printf("Rows:-\n");
printf("Free list: %llu (%llu)\n", (u_llong) tab->tab_row_free_id, (u_llong) tab->tab_row_fnum);
printf("EOF: %llu\n", (u_llong) tab->tab_row_eof_id);
fprintf(stderr, "Rows:-\n");
fprintf(stderr, "Free list: %llu (%llu)\n", (u_llong) tab->tab_row_free_id, (u_llong) tab->tab_row_fnum);
fprintf(stderr, "EOF: %llu\n", (u_llong) tab->tab_row_eof_id);
#endif
rec_id = 1;
......@@ -1988,13 +1988,13 @@ xtPublic void xt_check_table(XTThreadPtr self, XTOpenTablePtr ot)
if (!tab->tab_rows.xt_tc_read_4(ot->ot_row_file, rec_id, &ref_id, self))
xt_throw(self);
#ifdef DUMP_CHECK_TABLE
printf("%-3llu ", (u_llong) rec_id);
fprintf(stderr, "%-3llu ", (u_llong) rec_id);
#endif
#ifdef DUMP_CHECK_TABLE
if (ref_id == 0)
printf("====== 0\n");
fprintf(stderr, "====== 0\n");
else
printf("in use %llu\n", (u_llong) ref_id);
fprintf(stderr, "in use %llu\n", (u_llong) ref_id);
#endif
rec_id++;
}
......@@ -2026,7 +2026,7 @@ xtPublic void xt_rename_table(XTThreadPtr self, XTPathStrPtr old_name, XTPathStr
memset(&dic, 0, sizeof(dic));
#ifdef TRACE_CREATE_TABLES
printf("RENAME %s --> %s\n", old_name->ps_path, new_name->ps_path);
fprintf(stderr, "RENAME %s --> %s\n", old_name->ps_path, new_name->ps_path);
#endif
if (strlen(xt_last_name_of_path(new_name->ps_path)) > XT_TABLE_NAME_SIZE-1)
xt_throw_taberr(XT_CONTEXT, XT_ERR_NAME_TOO_LONG, new_name);
......@@ -2221,7 +2221,7 @@ xtPublic xtBool xt_flush_record_row(XTOpenTablePtr ot, off_t *bytes_flushed, xtB
xt_tab_store_header(ot, &rec_head);
#ifdef TRACE_FLUSH
printf("FLUSH rec/row %d %s\n", (int) tab->tab_bytes_to_flush, tab->tab_name->ps_path);
fprintf(stderr, "FLUSH rec/row %d %s\n", (int) tab->tab_bytes_to_flush, tab->tab_name->ps_path);
fflush(stdout);
#endif
/* Write the table header: */
......@@ -2276,7 +2276,7 @@ xtPublic xtBool xt_flush_record_row(XTOpenTablePtr ot, off_t *bytes_flushed, xtB
xt_unlock_mutex_ns(&cp->cp_state_lock);
#ifdef TRACE_FLUSH
printf("FLUSH --end-- %s\n", tab->tab_name->ps_path);
fprintf(stderr, "FLUSH --end-- %s\n", tab->tab_name->ps_path);
fflush(stdout);
#endif
xt_unlock_mutex_ns(&tab->tab_rec_flush_lock);
......
......@@ -96,7 +96,7 @@ xtPublic xtBool xt_init_logging(void)
{
int err;
log_file = stdout;
log_file = stderr;
log_level = XT_LOG_TRACE;
err = xt_p_mutex_init_with_autoname(&log_mutex, NULL);
if (err) {
......
......@@ -109,10 +109,10 @@ xtPublic void xt_print_trace(void)
xt_lock_mutex_ns(&trace_mutex);
if (trace_log_end > trace_log_offset+1) {
trace_log_buffer[trace_log_end] = 0;
printf("%s", trace_log_buffer + trace_log_offset + 1);
fprintf(stderr, "%s", trace_log_buffer + trace_log_offset + 1);
}
trace_log_buffer[trace_log_offset] = 0;
printf("%s", trace_log_buffer);
fprintf(stderr, "%s", trace_log_buffer);
trace_log_offset = 0;
trace_log_end = 0;
xt_unlock_mutex_ns(&trace_mutex);
......@@ -379,9 +379,9 @@ xtPublic void xt_dump_conn_tracking(void)
ptr = conn_info;
for (int i=0; i<XT_TRACK_MAX_CONNS; i++) {
if (ptr->ci_curr_xact_id || ptr->ci_prev_xact_id) {
printf("%3d curr=%d prev=%d prev-time=%ld\n", (int) ptr->cu_t_id, (int) ptr->ci_curr_xact_id, (int) ptr->ci_prev_xact_id, (long) ptr->ci_prev_xact_time);
fprintf(stderr, "%3d curr=%d prev=%d prev-time=%ld\n", (int) ptr->cu_t_id, (int) ptr->ci_curr_xact_id, (int) ptr->ci_prev_xact_id, (long) ptr->ci_prev_xact_time);
if (i+1<XT_TRACK_MAX_CONNS) {
printf(" diff=%d\n", (int) (ptr+1)->ci_curr_xact_id - (int) ptr->ci_curr_xact_id);
fprintf(stderr, " diff=%d\n", (int) (ptr+1)->ci_curr_xact_id - (int) ptr->ci_curr_xact_id);
}
}
ptr++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment