summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <skozlov/ksm@mysql.com/virtop.localdomain>2007-11-20 19:55:51 +0300
committerunknown <skozlov/ksm@mysql.com/virtop.localdomain>2007-11-20 19:55:51 +0300
commitbfb18f9ad5847b2c124f86b0516196e747fac5df (patch)
treef7158d0f9173b8dc9f0557f48d4dadaf437fe242
parent8f798dffea964598eed2a02ed6cfcb7ba7c0fb6e (diff)
downloadmariadb-git-bfb18f9ad5847b2c124f86b0516196e747fac5df.tar.gz
WL#3949, second part. Added soft switching of the binlog format (w/o restart a server)
mysql-test/lib/mtr_cases.pl: updated the code for combination mysql-test/mysql-test-run.pl: added soft switching of binlog format mysql-test/lib/mtr_misc.pl: added new sub mtr_diff_opts mysql-test/suite/rpl/r/rpl_invoked_features.result: updated result mysql-test/suite/rpl/t/rpl_invoked_features.test: updated test mysql-test/suite/rpl/t/rpl_misc_functions.test: updated test mysql-test/suite/rpl/t/rpl_session_var.test: updated test
-rw-r--r--mysql-test/lib/mtr_cases.pl81
-rw-r--r--mysql-test/lib/mtr_misc.pl29
-rwxr-xr-xmysql-test/mysql-test-run.pl53
-rw-r--r--mysql-test/r/bdb_notembedded.result35
-rw-r--r--mysql-test/suite/rpl/r/rpl_invoked_features.result24
-rw-r--r--mysql-test/suite/rpl/t/rpl_invoked_features.test16
-rw-r--r--mysql-test/suite/rpl/t/rpl_misc_functions.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_session_var.test3
-rw-r--r--mysql-test/t/bdb_notembedded.test38
9 files changed, 231 insertions, 49 deletions
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 992d645f038..d5741e24f05 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -367,6 +367,7 @@ sub collect_one_suite($$)
# ----------------------------------------------------------------------
if ($combinations && $begin_index <= $#{@$cases})
{
+ my $prepared = {};
my $end_index = $#{@$cases};
my $is_copy;
# Keep original master/slave options
@@ -397,7 +398,7 @@ sub collect_one_suite($$)
@$new_arr = @{$orig_opts[$idx]{$param}};
$copied_test->{$param} = $new_arr;
}
- elsif ($param =~ /(comment|combinations)/)
+ elsif ($param =~ /combinations/)
{
$copied_test->{$param} = '';
}
@@ -415,18 +416,29 @@ sub collect_one_suite($$)
if ($comb_opt =~ /^--binlog-format=.+$/)
{
my @opt_pairs = split(/=/, $comb_opt);
- if ($test->{'binlog_format'} =~ /^$opt_pairs[1]$/ || $test->{'binlog_format'} eq '')
+ if (defined $::used_binlog_format)
{
- $test->{'skip'} = 0;
- $test->{'comment'} = '';
+ if ($test->{'binlog_format'} ne $::used_binlog_format)
+ {
+ $test->{'skip'} = 1;
+ $test->{'comment'} = "Requiring binlog format ".join(' or ', @{$test->{'sup_binlog_formats'}});
+ }
}
else
{
- $test->{'skip'} = 1;
- $test->{'comment'} = "Requiring binlog format '$test->{'binlog_format'}'";;
- }
+ foreach my $binlog_format (@{$test->{'sup_binlog_formats'}})
+ {
+ $test->{'binlog_format'}= $binlog_format if ($binlog_format eq $opt_pairs[1]);
+ }
+ if (defined $prepared->{$test->{'name'}.'|'.$test->{'binlog_format'}} and $test->{'skip'} ne 1 )
+ {
+ $test->{'skip'} = 1;
+ $test->{'comment'} = "Test for binlog format '$test->{'binlog_format'}' already executed";
+ }
+ }
}
}
+ $prepared->{$test->{'name'}.'|'.$test->{'binlog_format'}}= 1;
$test->{'combination'} = $comb_set;
}
$is_copy = 1;
@@ -524,6 +536,7 @@ sub collect_one_test_case($$$$$$$$$) {
$tinfo->{'slave_opt'}= [];
$tinfo->{'slave_mi'}= [];
+
# Add suite opts
foreach my $opt ( @$suite_opts )
{
@@ -737,14 +750,43 @@ sub collect_one_test_case($$$$$$$$$) {
return;
}
- if ( defined $tinfo->{'binlog_format'} and
- ! ( $tinfo->{'binlog_format'} eq $::used_binlog_format ) )
+ # Replication test needs an adjustment of binlog format
+ if ($tinfo->{'name'} =~ /^rpl/)
{
- $tinfo->{'skip'}= 1;
- $tinfo->{'comment'}= "Requiring binlog format '$tinfo->{'binlog_format'}'";
- return;
+ # Set default binlog format priority
+ if ($tinfo->{'name'} =~ /^rpl/ and !defined $tinfo->{'sup_binlog_formats'})
+ {
+ if ($::mysql_version_id >= 50100)
+ {
+ $tinfo->{'sup_binlog_formats'} = ["mixed", "row", "statement"];
+ }
+ else
+ {
+ $tinfo->{'sup_binlog_formats'} = ["statement", "row"];
+ }
+ }
+ # Check that a test supports binlog format defined via --binlog-format
+ if (defined $::used_binlog_format)
+ {
+ # Try to find a supported binlog formats
+ foreach my $binlog_format (@{$tinfo->{'sup_binlog_formats'}})
+ {
+ $tinfo->{'binlog_format'}= $binlog_format unless ($binlog_format ne $::used_binlog_format);
+ }
+ # Skip a test because
+ if (!defined $tinfo->{'binlog_format'})
+ {
+ $tinfo->{'skip'}= 1;
+ $tinfo->{'comment'}= "Requiring binlog format ".join(' or ', @{$tinfo->{'sup_binlog_formats'}});
+ return;
+ }
+ }
+ else
+ {
+ $tinfo->{'binlog_format'}= $tinfo->{'sup_binlog_formats'}->[0];
+ }
}
-
+
if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries )
{
$tinfo->{'skip'}= 1;
@@ -824,10 +866,13 @@ sub collect_one_test_case($$$$$$$$$) {
our @tags=
(
["include/have_innodb.inc", "innodb_test", 1],
- ["include/have_binlog_format_row.inc", "binlog_format", "row"],
+ ["include/have_binlog_format_row.inc", "sup_binlog_formats", ["row"]],
["include/have_log_bin.inc", "need_binlog", 1],
- ["include/have_binlog_format_statement.inc", "binlog_format", "statement"],
- ["include/have_binlog_format_mixed.inc", "binlog_format", "mixed"],
+ ["include/have_binlog_format_statement.inc", "sup_binlog_formats", ["statement"]],
+ ["include/have_binlog_format_mixed.inc", "sup_binlog_formats", ["mixed"]],
+ ["include/have_binlog_format_mixed_or_row.inc", "sup_binlog_formats", ["mixed","row"]],
+ ["include/have_binlog_format_mixed_or_statement.inc", "sup_binlog_formats", ["mixed","statement"]],
+ ["include/have_binlog_format_row_or_statement.inc", "sup_binlog_formats", ["row","statement"]],
["include/big_test.inc", "big_test", 1],
["include/have_debug.inc", "need_debug", 1],
["include/have_ndb.inc", "ndb_test", 1],
@@ -853,8 +898,8 @@ sub mtr_options_from_test_file($$) {
{
if ( index($line, $tag->[0]) >= 0 )
{
- # Tag matched, assign value to "tinfo"
- $tinfo->{"$tag->[1]"}= $tag->[2];
+ # Tag matched, assign value to "tinfo"
+ $tinfo->{"$tag->[1]"}= $tag->[2];
}
}
diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl
index 226f73a21de..0173e8b8572 100644
--- a/mysql-test/lib/mtr_misc.pl
+++ b/mysql-test/lib/mtr_misc.pl
@@ -280,4 +280,33 @@ sub mtr_cmp_opts ($$) {
return 0; # They are the same
}
+#
+# Compare two arrays and put all unequal elements into a new one
+#
+sub mtr_diff_opts ($$) {
+ my $l1= shift;
+ my $l2= shift;
+ my $f;
+ my $l= [];
+ foreach my $e1 (@$l1)
+ {
+ $f= undef;
+ foreach my $e2 (@$l2)
+ {
+ $f= 1 unless ($e1 ne $e2);
+ }
+ push(@$l, $e1) unless (defined $f);
+ }
+ foreach my $e2 (@$l2)
+ {
+ $f= undef;
+ foreach my $e1 (@$l1)
+ {
+ $f= 1 unless ($e1 ne $e2);
+ }
+ push(@$l, $e2) unless (defined $f);
+ }
+ return $l;
+}
+
1;
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index a42f0559fd2..fd0b5cb98bb 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -792,20 +792,23 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Find out type of logging that are being used
# --------------------------------------------------------------------------
- # NOTE if the default binlog format is changed, this has to be changed
- $used_binlog_format= "statement";
if (!$opt_extern && $mysql_version_id >= 50100 )
{
- $used_binlog_format= "mixed"; # Default value for binlog format
-
foreach my $arg ( @opt_extra_mysqld_opt )
{
if ( $arg =~ /binlog[-_]format=(\S+)/ )
{
- $used_binlog_format= $1;
+ $used_binlog_format= $1;
}
}
- mtr_report("Using binlog format '$used_binlog_format'");
+ if (defined $used_binlog_format)
+ {
+ mtr_report("Using binlog format '$used_binlog_format'");
+ }
+ else
+ {
+ mtr_report("Using dynamic switching of binlog format");
+ }
}
@@ -3304,6 +3307,7 @@ sub run_testcase_check_skip_test($)
sub do_before_run_mysqltest($)
{
my $tinfo= shift;
+ my $args;
# Remove old files produced by mysqltest
my $base_file= mtr_match_extension($tinfo->{'result_file'},
@@ -3324,6 +3328,26 @@ sub do_before_run_mysqltest($)
# if script decided to run mysqltest cluster _is_ installed ok
$ENV{'NDB_STATUS_OK'} = "YES";
}
+ if (defined $tinfo->{"binlog_format"} and $mysql_version_id > 50100 )
+ {
+ foreach my $server ((@$master,@$slave))
+ {
+ if ($server->{'pid'})
+ {
+
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+
+ mtr_add_arg($args, "--user=root");
+ mtr_add_arg($args, "--port=$server->{'port'}");
+ mtr_add_arg($args, "--socket=$server->{'path_sock'}");
+
+ mtr_run($exe_mysql, $args, "$glob_mysql_test_dir/include/set_binlog_format_".$tinfo->{"binlog_format"}.".inc", "", "", "", {});
+
+ }
+ }
+ }
}
}
@@ -4218,10 +4242,19 @@ sub run_testcase_need_master_restart($)
elsif (! mtr_same_opts($master->[0]->{'start_opts'},
$tinfo->{'master_opt'}) )
{
- $do_restart= 1;
- mtr_verbose("Restart master: running with different options '" .
- join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
- join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
+ # Chech that diff is binlog format only
+ my $diff_opts= mtr_diff_opts($master->[0]->{'start_opts'},$tinfo->{'master_opt'});
+ if (scalar(@$diff_opts) eq 2)
+ {
+ $do_restart= 1 unless ($diff_opts->[0] =~/^--binlog-format=/ and $diff_opts->[1] =~/^--binlog-format=/);
+ }
+ else
+ {
+ $do_restart= 1;
+ mtr_verbose("Restart master: running with different options '" .
+ join(" ", @{$tinfo->{'master_opt'}}) . "' != '" .
+ join(" ", @{$master->[0]->{'start_opts'}}) . "'" );
+ }
}
elsif( ! $master->[0]->{'pid'} )
{
diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result
new file mode 100644
index 00000000000..14cb5fad915
--- /dev/null
+++ b/mysql-test/r/bdb_notembedded.result
@@ -0,0 +1,35 @@
+set autocommit=1;
+reset master;
+create table bug16206 (a int);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
+f n Query 1 n use `test`; create table bug16206 (a int)
+f n Query 1 n use `test`; insert into bug16206 values(1)
+f n Query 1 n use `test`; insert into bug16206 values(2)
+drop table bug16206;
+reset master;
+create table bug16206 (a int) engine= bdb;
+insert into bug16206 values(0);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+insert into bug16206 values(3);
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
+f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
+f n Query 1 n use `test`; insert into bug16206 values(0)
+f n Query 1 n use `test`; insert into bug16206 values(1)
+f n Query 1 n use `test`; BEGIN
+f n Query 1 n use `test`; insert into bug16206 values(2)
+f n Query 1 n use `test`; COMMIT
+f n Query 1 n use `test`; insert into bug16206 values(3)
+drop table bug16206;
+set autocommit=0;
+End of 5.0 tests
diff --git a/mysql-test/suite/rpl/r/rpl_invoked_features.result b/mysql-test/suite/rpl/r/rpl_invoked_features.result
index 502bb040218..aed1dcdbb47 100644
--- a/mysql-test/suite/rpl/r/rpl_invoked_features.result
+++ b/mysql-test/suite/rpl/r/rpl_invoked_features.result
@@ -116,23 +116,23 @@ t12
t13
t2
t3
-SELECT table_name FROM information_schema.views WHERE table_schema='test';
+SELECT table_name FROM information_schema.views WHERE table_schema='test' ORDER BY table_name;
table_name
v1
v11
-SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
+SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test' ORDER BY trigger_name;
trigger_name event_manipulation event_object_table
-t1_tr1 INSERT t1
-t1_tr2 UPDATE t1
t11_tr1 INSERT t11
t11_tr2 UPDATE t11
-SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
+t1_tr1 INSERT t1
+t1_tr2 UPDATE t1
+SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test' ORDER BY routine_name;
routine_type routine_name
FUNCTION f1
FUNCTION f2
PROCEDURE p1
PROCEDURE p11
-SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
+SELECT event_name, status FROM information_schema.events WHERE event_schema='test' ORDER BY event_name;
event_name status
e1 DISABLED
e11 DISABLED
@@ -276,23 +276,23 @@ t12
t13
t2
t3
-SELECT table_name FROM information_schema.views WHERE table_schema='test';
+SELECT table_name FROM information_schema.views WHERE table_schema='test' ORDER BY table_name;
table_name
v1
v11
-SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
+SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test' ORDER BY trigger_name;
trigger_name event_manipulation event_object_table
-t1_tr1 INSERT t1
-t1_tr2 UPDATE t1
t11_tr1 INSERT t11
t11_tr2 UPDATE t11
-SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
+t1_tr1 INSERT t1
+t1_tr2 UPDATE t1
+SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test' ORDER BY routine_name;
routine_type routine_name
FUNCTION f1
FUNCTION f2
PROCEDURE p1
PROCEDURE p11
-SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
+SELECT event_name, status FROM information_schema.events WHERE event_schema='test' ORDER BY event_name;
event_name status
e1 SLAVESIDE_DISABLED
e11 SLAVESIDE_DISABLED
diff --git a/mysql-test/suite/rpl/t/rpl_invoked_features.test b/mysql-test/suite/rpl/t/rpl_invoked_features.test
index 2e69c0fabd9..17cdc1e61cf 100644
--- a/mysql-test/suite/rpl/t/rpl_invoked_features.test
+++ b/mysql-test/suite/rpl/t/rpl_invoked_features.test
@@ -202,10 +202,10 @@ SET GLOBAL EVENT_SCHEDULER = off;
# Check original objects
--echo
SHOW TABLES LIKE 't%';
-SELECT table_name FROM information_schema.views WHERE table_schema='test';
-SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
-SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
-SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
+SELECT table_name FROM information_schema.views WHERE table_schema='test' ORDER BY table_name;
+SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test' ORDER BY trigger_name;
+SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test' ORDER BY routine_name;
+SELECT event_name, status FROM information_schema.events WHERE event_schema='test' ORDER BY event_name;
# Check original data
--echo
@@ -229,10 +229,10 @@ SELECT a,b FROM v11 ORDER BY a;
# Check replicated objects
--echo
SHOW TABLES LIKE 't%';
-SELECT table_name FROM information_schema.views WHERE table_schema='test';
-SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test';
-SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test';
-SELECT event_name, status FROM information_schema.events WHERE event_schema='test';
+SELECT table_name FROM information_schema.views WHERE table_schema='test' ORDER BY table_name;
+SELECT trigger_name, event_manipulation, event_object_table FROM information_schema.triggers WHERE trigger_schema='test' ORDER BY trigger_name;
+SELECT routine_type, routine_name FROM information_schema.routines WHERE routine_schema='test' ORDER BY routine_name;
+SELECT event_name, status FROM information_schema.events WHERE event_schema='test' ORDER BY event_name;
# Check replicated data
--echo
diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test
index 1c94471c975..4a47e9645f9 100644
--- a/mysql-test/suite/rpl/t/rpl_misc_functions.test
+++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test
@@ -109,6 +109,7 @@ DROP TABLE t1, t1_slave;
DROP PROCEDURE test_replication_sp1;
DROP PROCEDURE test_replication_sp2;
DROP FUNCTION test_replication_sf;
+--remove_file $MYSQLTEST_VARDIR/master-data/test/rpl_misc_functions.outfile
--sync_slave_with_master
diff --git a/mysql-test/suite/rpl/t/rpl_session_var.test b/mysql-test/suite/rpl/t/rpl_session_var.test
index 2491611e23d..50efc8930a1 100644
--- a/mysql-test/suite/rpl/t/rpl_session_var.test
+++ b/mysql-test/suite/rpl/t/rpl_session_var.test
@@ -51,8 +51,9 @@ CREATE TABLE t1 (
`data` varchar(100),
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
-
+--disable_warnings
INSERT INTO t1(data) VALUES(SESSION_USER());
+--enable_warnings
save_master_pos;
connection slave;
sync_with_master;
diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test
new file mode 100644
index 00000000000..24e64ebbfb2
--- /dev/null
+++ b/mysql-test/t/bdb_notembedded.test
@@ -0,0 +1,38 @@
+-- source include/not_embedded.inc
+-- source include/have_bdb.inc
+
+#
+# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
+#
+set autocommit=1;
+
+let $VERSION=`select version()`;
+
+reset master;
+create table bug16206 (a int);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+--replace_result $VERSION VERSION
+--replace_column 1 f 2 n 5 n
+show binlog events;
+drop table bug16206;
+
+reset master;
+create table bug16206 (a int) engine= bdb;
+insert into bug16206 values(0);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+insert into bug16206 values(3);
+--replace_result $VERSION VERSION
+--replace_column 1 f 2 n 5 n
+show binlog events;
+drop table bug16206;
+
+set autocommit=0;
+
+
+--echo End of 5.0 tests