Commit 0e68e6ea authored by unknown's avatar unknown

Automatic merge.

parents ce068186 1378aa0e
...@@ -666,6 +666,9 @@ libmysqld/time.cc ...@@ -666,6 +666,9 @@ libmysqld/time.cc
libmysqld/tztime.cc libmysqld/tztime.cc
libmysqld/uniques.cc libmysqld/uniques.cc
libmysqld/unireg.cc libmysqld/unireg.cc
libmysqld/discover_xt.cc
libmysqld/ha_pbxt.cc
libmysqld/myxt_xt.cc
libmysqltest/*.ds? libmysqltest/*.ds?
libmysqltest/*.vcproj libmysqltest/*.vcproj
libmysqltest/mytest.c libmysqltest/mytest.c
......
...@@ -267,7 +267,6 @@ dnl we have to recompile these modules when we want to ...@@ -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 to compile server parts with the different #defines
dnl Normally it happens when we compile the embedded server dnl Normally it happens when we compile the embedded server
dnl Thus one should mark such files in his handler using this macro 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
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
...@@ -463,11 +462,13 @@ dnl Although this is "pretty", it breaks libmysqld build ...@@ -463,11 +462,13 @@ dnl Although this is "pretty", it breaks libmysqld build
mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]" mysql_plugin_defs="$mysql_plugin_defs, [builtin_]$2[_plugin]"
[with_plugin_]$2=yes [with_plugin_]$2=yes
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
m4_ifdef([$11],[ m4_ifdef([$11], [
condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp($11, [[^/]+$], [\&])" m4_foreach([plugin], [$11], [
condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp($11, [[^/]+\.], [\&o])" condition_dependent_plugin_modules="$condition_dependent_plugin_modules m4_bregexp(plugin, [[^/]+$], [\&])"
condition_dependent_plugin_links="$condition_dependent_plugin_links $6/$11" condition_dependent_plugin_objects="$condition_dependent_plugin_objects m4_bregexp(plugin, [[^/]+\.], [\&o])"
condition_dependent_plugin_includes="$condition_dependent_plugin_includes -I[\$(top_srcdir)]/$6/m4_bregexp($11, [^.+[/$]], [\&])" 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
fi fi
......
...@@ -15,7 +15,7 @@ AC_CANONICAL_SYSTEM ...@@ -15,7 +15,7 @@ AC_CANONICAL_SYSTEM
# MySQL version number. # MySQL version number.
# #
# Note: the following line must be parseable by win/configure.js:GetVersion() # 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]) AM_CONFIG_HEADER([include/config.h:config.h.in])
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
......
...@@ -301,6 +301,9 @@ sub main { ...@@ -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..."); mtr_report("Collecting tests...");
my $tests= collect_test_cases($opt_suites, \@opt_cases); my $tests= collect_test_cases($opt_suites, \@opt_cases);
...@@ -1877,6 +1880,37 @@ sub have_maria_support () { ...@@ -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 # Set environment to be used by childs of this process for
# things that are constant during the whole lifetime of mysql-test-run # things that are constant during the whole lifetime of mysql-test-run
...@@ -1935,33 +1969,6 @@ sub environment_setup { ...@@ -1935,33 +1969,6 @@ sub environment_setup {
$ENV{'UDF_EXAMPLE_LIB_OPT'}= "--plugin-dir=". $ENV{'UDF_EXAMPLE_LIB_OPT'}= "--plugin-dir=".
($lib_udf_example ? dirname($lib_udf_example) : ""); ($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 # 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 ...@@ -968,7 +968,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings: 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`))) 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); 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, 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 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1 FROM t0,t1
...@@ -1003,22 +1003,23 @@ t0.b=t1.b AND ...@@ -1003,22 +1003,23 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND (t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1); (t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t0 ALL NULL NULL NULL NULL 3
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using join buffer
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where 1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where 1 SIMPLE t5 ALL idx_b NULL NULL NULL 3
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t6 ALL NULL NULL NULL NULL 3
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t7 ALL NULL NULL NULL NULL 2
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 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`))) ATTENTION: the above EXPLAIN has several competing QEPs with identical
Warnings: . costs. To combat the plan change it uses --sorted_result and
. and --replace tricks
CREATE INDEX idx_b ON t1(b); CREATE INDEX idx_b ON t1(b);
CREATE INDEX idx_a ON t0(a); 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, 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 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1 FROM t0,t1
...@@ -1053,19 +1054,20 @@ t0.b=t1.b AND ...@@ -1053,19 +1054,20 @@ t0.b=t1.b AND
(t8.a < 1 OR t8.c IS NULL) AND (t8.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1); (t9.a=1);
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ref idx_a idx_a 5 const 1 100.00 Using where 1 SIMPLE t0 ref idx_a idx_a 5 const 1
1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1 100.00 Using where 1 SIMPLE t1 ref idx_b idx_b 5 test.t0.b 1
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2
1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1 100.00 Using where 1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 1
1 SIMPLE t5 ALL idx_b NULL NULL NULL 3 100.00 Using where 1 SIMPLE t5 ALL idx_b NULL NULL NULL 3
1 SIMPLE t6 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t6 ALL NULL NULL NULL NULL 3
1 SIMPLE t7 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t7 ALL NULL NULL NULL NULL 2
1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1 100.00 Using where 1 SIMPLE t8 ref idx_b idx_b 5 test.t5.b 1
1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 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`))) ATTENTION: the above EXPLAIN has several competing QEPs with identical
Warnings: . 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, 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 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1 FROM t0,t1
......
...@@ -1212,7 +1212,7 @@ c1 ...@@ -1212,7 +1212,7 @@ c1
2147483647 2147483647
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(255)); 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; SELECT * FROM t1 ORDER BY c1;
c1 c2 c1 c2
0 opq 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, ...@@ -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); CREATE INDEX idx_b ON t8(b);
--replace_regex /Using where; // /Using where//
--sorted_result --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, 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 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1 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, ...@@ -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.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1); (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_b ON t1(b);
CREATE INDEX idx_a ON t0(a); CREATE INDEX idx_a ON t0(a);
--replace_regex /Using where; // /Using where//
--sorted_result --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, 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 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1 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, ...@@ -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.a < 1 OR t8.c IS NULL) AND
(t8.b=t9.b OR t8.c IS NULL) AND (t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1); (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 --sorted_result
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b, 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; ...@@ -921,7 +921,8 @@ SELECT c1 FROM t2;
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(255)); 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 --sorted_result
SELECT * FROM t1 ORDER BY c1; SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1; DROP TABLE t1;
......
# This test covers various aspects of PBXT locking mechanism, including # This test covers various aspects of PBXT locking mechanism, including
# internal permanent/temporary row locking and MySQL locking # 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 # TEST: select for update test
drop table if exists t1; drop table if exists t1;
......
# We cannot run mysqldump against embedded server.
-- source include/not_embedded.inc
--disable_warnings --disable_warnings
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3;
--enable_warnings --enable_warnings
......
...@@ -582,7 +582,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ; ...@@ -582,7 +582,7 @@ prepare stmt1 from ' rename table t5 to t6, t7 to t8 ' ;
create table t5 (a int) ; create table t5 (a int) ;
# rename must fail, t7 does not exist # rename must fail, t7 does not exist
# Clean up the filename here because embedded server reports whole path # 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 --error 1017
execute stmt1 ; execute stmt1 ;
create table t7 (a int) ; create table t7 (a int) ;
......
...@@ -278,6 +278,11 @@ enum legacy_db_type ...@@ -278,6 +278,11 @@ enum legacy_db_type
DB_TYPE_FIRST_DYNAMIC=42, DB_TYPE_FIRST_DYNAMIC=42,
DB_TYPE_DEFAULT=127 // Must be last 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, enum row_type { ROW_TYPE_NOT_USED=-1, ROW_TYPE_DEFAULT, ROW_TYPE_FIXED,
ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED, ROW_TYPE_DYNAMIC, ROW_TYPE_COMPRESSED,
......
...@@ -1168,22 +1168,7 @@ int plugin_init(int *argc, char **argv, int flags) ...@@ -1168,22 +1168,7 @@ int plugin_init(int *argc, char **argv, int flags)
!my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name, !my_strnncoll(&my_charset_latin1, (const uchar*) plugin->name,
6, (const uchar*) "InnoDB", 6)) 6, (const uchar*) "InnoDB", 6))
continue; 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)); bzero(&tmp, sizeof(tmp));
tmp.plugin= plugin; tmp.plugin= plugin;
tmp.name.str= (char *)plugin->name; tmp.name.str= (char *)plugin->name;
......
PBXT Release Notes 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 ------- 1.0.09f RC3 - 2009-11-30
RN291: Fixed bug #489088: On shutdown MySQL reports: [Warning] Plugin 'PBXT' will be forced to shutdown. 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]) ...@@ -5,3 +5,4 @@ MYSQL_PLUGIN_STATIC(pbxt, [src/libpbxt.a])
MYSQL_PLUGIN_ACTIONS(pbxt, [ MYSQL_PLUGIN_ACTIONS(pbxt, [
# AC_CONFIG_FILES(storage/pbxt/src/Makefile) # 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 ...@@ -46,7 +46,5 @@ libpbxt_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN -std=c99
EXTRA_LIBRARIES = libpbxt.a EXTRA_LIBRARIES = libpbxt.a
noinst_LIBRARIES = libpbxt.a noinst_LIBRARIES = libpbxt.a
libpbxt_a_SOURCES = $(libpbxt_la_SOURCES) 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 EXTRA_DIST = pbms_enabled.cc win_inttypes.h
...@@ -355,10 +355,10 @@ static int sort_keys(KEY *a, KEY *b) ...@@ -355,10 +355,10 @@ static int sort_keys(KEY *a, KEY *b)
{ {
if (!(b_flags & HA_NOSAME)) if (!(b_flags & HA_NOSAME))
return -1; 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 */ /* 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) if (a->name == primary_key_name)
return -1; return -1;
......
...@@ -1175,8 +1175,13 @@ static int pbxt_init(void *p) ...@@ -1175,8 +1175,13 @@ static int pbxt_init(void *p)
* +1 Temporary thread (e.g. TempForClose, TempForEnd) * +1 Temporary thread (e.g. TempForClose, TempForEnd)
*/ */
#ifndef DRIZZLED #ifndef DRIZZLED
if (pbxt_max_threads == 0) if (pbxt_max_threads == 0) {
pbxt_max_threads = max_connections + 7; // Embedded server sets max_connections=1
if (max_connections > 1)
pbxt_max_threads = max_connections + 7;
else
pbxt_max_threads = 100;
}
#endif #endif
self = xt_init_threading(pbxt_max_threads); /* Create the main self: */ self = xt_init_threading(pbxt_max_threads); /* Create the main self: */
if (!self) if (!self)
...@@ -1442,7 +1447,7 @@ static int pbxt_commit(handlerton *hton, THD *thd, bool all) ...@@ -1442,7 +1447,7 @@ static int pbxt_commit(handlerton *hton, THD *thd, bool all)
XTThreadPtr self; XTThreadPtr self;
if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) { 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) { if (self->st_xact_data) {
/* There are no table locks, commit immediately in all cases /* There are no table locks, commit immediately in all cases
...@@ -1474,7 +1479,7 @@ static int pbxt_rollback(handlerton *hton, THD *thd, bool all) ...@@ -1474,7 +1479,7 @@ static int pbxt_rollback(handlerton *hton, THD *thd, bool all)
XTThreadPtr self; XTThreadPtr self;
if ((self = (XTThreadPtr) *thd_ha_data(thd, hton))) { 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) { if (self->st_xact_data) {
/* There are no table locks, rollback immediately in all cases /* There are no table locks, rollback immediately in all cases
...@@ -1538,7 +1543,7 @@ static int pbxt_prepare(handlerton *hton, THD *thd, bool all) ...@@ -1538,7 +1543,7 @@ static int pbxt_prepare(handlerton *hton, THD *thd, bool all)
* except when this is a statement commit with an explicit * except when this is a statement commit with an explicit
* transaction (!all && !self->st_auto_commit). * transaction (!all && !self->st_auto_commit).
*/ */
if (all) { if (all || self->st_auto_commit) {
XID xid; XID xid;
XT_PRINT0(self, "xt_xn_prepare in pbxt_prepare\n"); XT_PRINT0(self, "xt_xn_prepare in pbxt_prepare\n");
...@@ -2620,26 +2625,7 @@ int ha_pbxt::write_row(byte *buf) ...@@ -2620,26 +2625,7 @@ int ha_pbxt::write_row(byte *buf)
} }
#endif #endif
/* GOTCHA: I have a huge problem with the transaction statement. /* {START-STAT-HACK} previously position of start statement hack. */
* 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;
}
xt_xlog_check_long_writer(pb_open_tab->ot_thread); 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) ...@@ -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]))); 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); //statistic_increment(ha_update_count,&LOCK_status);
if (!self->st_stat_trans) { /* {START-STAT-HACK} previously position of start statement hack. */
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;
}
xt_xlog_check_long_writer(self); xt_xlog_check_long_writer(self);
...@@ -2821,11 +2803,7 @@ int ha_pbxt::delete_row(const byte * buf) ...@@ -2821,11 +2803,7 @@ int ha_pbxt::delete_row(const byte * buf)
} }
#endif #endif
if (!pb_open_tab->ot_thread->st_stat_trans) { /* {START-STAT-HACK} previously position of start statement hack. */
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;
}
xt_xlog_check_long_writer(pb_open_tab->ot_thread); 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)) ...@@ -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); 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 #endif
/* {START-STAT-HACK} previously position of start statement hack,
* previous comment to code below: */
/* Start a statement based transaction as soon /* Start a statement based transaction as soon
* as a read is done for a modify type statement! * as a read is done for a modify type statement!
* Previously, this was done too late! * 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 { else {
pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set); pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set);
...@@ -3612,15 +3587,12 @@ int ha_pbxt::rnd_init(bool scan) ...@@ -3612,15 +3587,12 @@ int ha_pbxt::rnd_init(bool scan)
/* The number of columns required: */ /* The number of columns required: */
if (pb_open_tab->ot_is_modify) { if (pb_open_tab->ot_is_modify) {
pb_open_tab->ot_cols_req = table->read_set->MX_BIT_SIZE(); 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 /* Start a statement based transaction as soon
* as a read is done for a modify type statement! * as a read is done for a modify type statement!
* Previously, this was done too late! * 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 { else {
pb_open_tab->ot_cols_req = ha_get_max_bit(table->read_set); 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) ...@@ -4631,7 +4603,7 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type)
cont_(b); cont_(b);
} }
/* See (***) */ /* See {IS-UPDATE-STAT} */
self->st_is_update = FALSE; self->st_is_update = FALSE;
/* Auto begin a transaction (if one is not already running): */ /* 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) ...@@ -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). * 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: * 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) ...@@ -4698,10 +4670,46 @@ xtPublic int ha_pbxt::external_lock(THD *thd, int lock_type)
*/ */
if (!self->st_auto_commit) { if (!self->st_auto_commit) {
trans_register_ha(thd, TRUE, pbxt_hton); 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) if (lock_type == F_WRLCK || self->st_xact_mode < XT_XACT_REPEATABLE_READ)
self->st_visible_time = self->st_database->db_xn_end_time; 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) ...@@ -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 * 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 * statement. We need to make sure statements that are NOT mistaken
* for different type of statement. * for different type of statement.
...@@ -4841,7 +4849,7 @@ int ha_pbxt::start_stmt(THD *thd, thr_lock_type lock_type) ...@@ -4841,7 +4849,7 @@ int ha_pbxt::start_stmt(THD *thd, thr_lock_type lock_type)
*/ */
self->st_is_update = FALSE; self->st_is_update = FALSE;
/* See comment (**) */ /* See comment {START-TRANS} */
if (!self->st_xact_data) { 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_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; 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) ...@@ -4858,10 +4866,17 @@ int ha_pbxt::start_stmt(THD *thd, thr_lock_type lock_type)
} }
if (!self->st_auto_commit) { if (!self->st_auto_commit) {
trans_register_ha(thd, TRUE, pbxt_hton); 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) 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; 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) ...@@ -380,7 +380,7 @@ xtPublic void xt_int8_to_byte_size(xtInt8 value, char *string)
/* Version number must also be set in configure.in! */ /* Version number must also be set in configure.in! */
xtPublic c_char *xt_get_version(void) xtPublic c_char *xt_get_version(void)
{ {
return "1.0.09f RC"; return "1.0.09g RC";
} }
/* Copy and URL decode! */ /* Copy and URL decode! */
......
This diff is collapsed.
...@@ -96,7 +96,7 @@ xtPublic xtBool xt_init_logging(void) ...@@ -96,7 +96,7 @@ xtPublic xtBool xt_init_logging(void)
{ {
int err; int err;
log_file = stdout; log_file = stderr;
log_level = XT_LOG_TRACE; log_level = XT_LOG_TRACE;
err = xt_p_mutex_init_with_autoname(&log_mutex, NULL); err = xt_p_mutex_init_with_autoname(&log_mutex, NULL);
if (err) { if (err) {
......
...@@ -109,10 +109,10 @@ xtPublic void xt_print_trace(void) ...@@ -109,10 +109,10 @@ xtPublic void xt_print_trace(void)
xt_lock_mutex_ns(&trace_mutex); xt_lock_mutex_ns(&trace_mutex);
if (trace_log_end > trace_log_offset+1) { if (trace_log_end > trace_log_offset+1) {
trace_log_buffer[trace_log_end] = 0; 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; trace_log_buffer[trace_log_offset] = 0;
printf("%s", trace_log_buffer); fprintf(stderr, "%s", trace_log_buffer);
trace_log_offset = 0; trace_log_offset = 0;
trace_log_end = 0; trace_log_end = 0;
xt_unlock_mutex_ns(&trace_mutex); xt_unlock_mutex_ns(&trace_mutex);
...@@ -379,9 +379,9 @@ xtPublic void xt_dump_conn_tracking(void) ...@@ -379,9 +379,9 @@ xtPublic void xt_dump_conn_tracking(void)
ptr = conn_info; ptr = conn_info;
for (int i=0; i<XT_TRACK_MAX_CONNS; i++) { for (int i=0; i<XT_TRACK_MAX_CONNS; i++) {
if (ptr->ci_curr_xact_id || ptr->ci_prev_xact_id) { 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) { 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++; 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