From 89000a3c152f3743ccc8eaabcbd30314f6df1e9e Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 16 Jun 2009 15:26:17 +0200 Subject: [PATCH 01/88] Bug #45298 plugin.test is skipped in PB2 on UNIX platforms Added search for example plugin in lib/mysql/plugin --- mysql-test/mysql-test-run.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 2a6a069d81c..4e89fd899ce 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1763,7 +1763,8 @@ sub environment_setup { if ($mysql_version_id >= 50100) { my $lib_example_plugin= mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'), - "$basedir/storage/example/.libs/ha_example.so",); + "$basedir/storage/example/.libs/ha_example.so", + "$basedir/lib/mysql/plugin/ha_example.so",); $ENV{'EXAMPLE_PLUGIN'}= ($lib_example_plugin ? basename($lib_example_plugin) : ""); $ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=". From 63910fc2a04baf6376578af6e758037b827cca4e Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 22 Jun 2009 16:27:05 +0200 Subject: [PATCH 02/88] Bug #43780 mysql-test-run uses deprecated server options Updated to use general_log[_file] and slow_query_log[_file] --- mysql-test/lib/My/ConfigFactory.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm index 852f706c858..c1e8f7cd826 100644 --- a/mysql-test/lib/My/ConfigFactory.pm +++ b/mysql-test/lib/My/ConfigFactory.pm @@ -204,8 +204,10 @@ my @mysqld_rules= { 'port' => \&fix_port }, { 'socket' => \&fix_socket }, { '#log-error' => \&fix_log_error }, - { 'log' => \&fix_log }, - { 'log-slow-queries' => \&fix_log_slow_queries }, + { 'general_log' => 1 }, + { 'general_log_file' => \&fix_log }, + { 'slow_query_log' => 1 }, + { 'slow_query_log_file' => \&fix_log_slow_queries }, { '#user' => sub { return shift->{ARGS}->{user} || ""; } }, { '#password' => sub { return shift->{ARGS}->{password} || ""; } }, { 'server-id' => \&fix_server_id, }, From c63b8f402ac0112fb019b40613ea6337fee17ea2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 22 Jun 2009 16:29:02 +0200 Subject: [PATCH 03/88] Bug #45532 MTR displays wrong option name 'print_testcases' in usage text Fix the name.... --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 4e89fd899ce..e6e8a77f3ed 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -5113,7 +5113,7 @@ Options to control what test suites or cases to run skip-rpl Skip the replication test cases. big-test Also run tests marked as "big" enable-disabled Run also tests marked as disabled - print_testcases Don't run the tests but print details about all the + print-testcases Don't run the tests but print details about all the selected tests, in the order they would be run. Options that specify ports From 8d6a25a23f8d3453a2d729b79553a5b64a7c4b40 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 15 Jul 2009 14:20:56 +0200 Subject: [PATCH 04/88] Bug #43005 main.init_connect fais on Windows in PB2 Server args containing spaces do not work on Windows Fixed my_safe_rprocess-win to re-apply "" around such args --- mysql-test/lib/My/SafeProcess/safe_process_win.cc | 9 ++++++++- mysql-test/suite/rpl/t/disabled.def | 1 - mysql-test/t/disabled.def | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc index 80c1b7a97f2..d85a9558a62 100755 --- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -188,7 +188,14 @@ int main(int argc, const char** argv ) die("No real args -> nothing to do"); /* Copy the remaining args to child_arg */ for (int j= i+1; j < argc; j++) { - to+= _snprintf(to, child_args + sizeof(child_args) - to, "%s ", argv[j]); + if (strchr (argv[j], ' ')) { + /* Protect with "" if this arg contains a space */ + to+= _snprintf(to, child_args + sizeof(child_args) - to, + "\"%s\" ", argv[j]); + } else { + to+= _snprintf(to, child_args + sizeof(child_args) - to, + "%s ", argv[j]); + } } break; } else { diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index fcc3d56a9f5..38fc9e21322 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,4 +11,3 @@ ############################################################################## rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx -rpl_init_slave : Bug#44920 2009-05-18 pcrews MTR2 is not processing master.opt input properly on Windows diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index af4eb44b464..6d8f0af0c28 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -12,4 +12,3 @@ kill : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild. innodb_bug39438 : Bug#42383 2009-01-28 lsoares "This fails in embedded and on windows. Note that this test is not run on windows and on embedded in PB for main trees currently" query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically -init_connect : Bug#44920 2009-05-18 pcrews MTR2 is not processing master.opt input properly on Windows From 0952b9b59b0000c81d1f6e3a234721c5c6e1b434 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 16 Jul 2009 14:05:46 +0200 Subject: [PATCH 05/88] Bug #45698 MTR_VERSION=1 ./mtr --force does not work General problem: some test cannot run in V1, expect more in future Implement general mechanism for listing incompatible tests --- mysql-test/lib/v1/incompatible.tests | 6 ++++++ mysql-test/lib/v1/mtr_cases.pl | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 mysql-test/lib/v1/incompatible.tests diff --git a/mysql-test/lib/v1/incompatible.tests b/mysql-test/lib/v1/incompatible.tests new file mode 100644 index 00000000000..fefdad9ce4c --- /dev/null +++ b/mysql-test/lib/v1/incompatible.tests @@ -0,0 +1,6 @@ +# This file lists tests that cannot run in MTR v1 for some reason. +# They will be skipped. +# Any text following white space after full test name is ignored +# Only exact test names can be used, no regexp. + +main.fulltext_plugin # Refers to $SIMPLE_PARSER_OPT which is not set diff --git a/mysql-test/lib/v1/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index 4d7b1f4ec70..bed24bcabfb 100644 --- a/mysql-test/lib/v1/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -32,6 +32,7 @@ sub mtr_options_from_test_file($$); my $do_test; my $skip_test; +my %incompatible; sub init_pattern { my ($from, $what)= @_; @@ -47,6 +48,15 @@ sub init_pattern { } +sub collect_incomp_tests { + open (INCOMP, "lib/v1/incompatible.tests"); + while () + { + next unless /^\w/; + s/\s.*\n//; # Ignore anything from first white space + $incompatible{$_}= 1; + } +} ############################################################################## # @@ -58,6 +68,8 @@ sub collect_test_cases ($) { $do_test= init_pattern($::opt_do_test, "--do-test"); $skip_test= init_pattern($::opt_skip_test, "--skip-test"); + collect_incomp_tests(); + my $suites= shift; # Semicolon separated list of test suites my $cases = []; # Array of hash @@ -528,6 +540,13 @@ sub collect_one_test_case($$$$$$$$$) { $tinfo->{'component_id'} = $component_id; push(@$cases, $tinfo); + if (exists ($incompatible{$tinfo->{'name'}})) + { + $tinfo->{'skip'}= 1; + $tinfo->{'comment'}= "Test cannot run in mtr v1"; + return; + } + # ---------------------------------------------------------------------- # Skip some tests but include in list, just mark them to skip # ---------------------------------------------------------------------- From 53e14eaa0aab03020b7ae268e3a45d03ab6d7ac0 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 17 Jul 2009 10:41:04 +0200 Subject: [PATCH 06/88] Bug #45700 MTR v1 --start-and-exit --default-storage-engine=Innodb is froken Change of variable states in Bug 19027 was not backported to v1 Changed ne "TRUE" to eq "OFF" --- mysql-test/lib/v1/mtr_cases.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/lib/v1/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index bed24bcabfb..906e330282a 100644 --- a/mysql-test/lib/v1/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -860,7 +860,7 @@ sub collect_one_test_case($$$$$$$$$) { if ( $tinfo->{'innodb_test'} ) { # This is a test that need innodb - if ( $::mysqld_variables{'innodb'} ne "TRUE" ) + if ( $::mysqld_variables{'innodb'} eq "OFF" ) { # innodb is not supported, skip it $tinfo->{'skip'}= 1; From 2399987a2a53c54b29cb76e574de8676466f77c8 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 23 Jul 2009 19:01:24 +0200 Subject: [PATCH 07/88] Bug #46212 safe_process: FATAL ERROR, Unknown option: --nocore Also fixed mysqld.cc to avoid popup-boxes --- .../lib/My/SafeProcess/safe_process_win.cc | 30 ++++++++++++------- sql/mysqld.cc | 19 ++++++------ 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc index d85a9558a62..455262b29f5 100755 --- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc +++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc @@ -163,6 +163,7 @@ int main(int argc, const char** argv ) HANDLE job_handle; HANDLE wait_handles[NUM_HANDLES]= {0}; PROCESS_INFORMATION process_info= {0}; + BOOL nocore= FALSE; sprintf(safe_process_name, "safe_process[%d]", pid); @@ -199,18 +200,22 @@ int main(int argc, const char** argv ) } break; } else { - if ( strcmp(arg, "--verbose") == 0 ) + if (strcmp(arg, "--verbose") == 0) verbose++; - else if ( strncmp(arg, "--parent-pid", 10) == 0 ) - { - /* Override parent_pid with a value provided by user */ - const char* start; + else if (strncmp(arg, "--parent-pid", 10) == 0) + { + /* Override parent_pid with a value provided by user */ + const char* start; if ((start= strstr(arg, "=")) == NULL) - die("Could not find start of option value in '%s'", arg); - start++; /* Step past = */ - if ((parent_pid= atoi(start)) == 0) - die("Invalid value '%s' passed to --parent-id", start); - } + die("Could not find start of option value in '%s'", arg); + start++; /* Step past = */ + if ((parent_pid= atoi(start)) == 0) + die("Invalid value '%s' passed to --parent-id", start); + } + else if (strcmp(arg, "--nocore") == 0) + { + nocore= TRUE; + } else die("Unknown option: %s", arg); } @@ -248,6 +253,11 @@ int main(int argc, const char** argv ) &jeli, sizeof(jeli)) == 0) message("SetInformationJobObject failed, continue anyway..."); + /* Avoid popup box */ + if (nocore) + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX + | SEM_NOOPENFILEERRORBOX); + #if 0 /* Setup stdin, stdout and stderr redirect */ si.dwFlags= STARTF_USESTDHANDLES; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 080f78993a1..fa8b4a971d7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2103,15 +2103,14 @@ static void init_signals(void) win_install_sigabrt_handler(); if(opt_console) SetConsoleCtrlHandler(console_event_handler,TRUE); - else - { + /* Avoid MessageBox()es*/ - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); - _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); /* Do not use SEM_NOGPFAULTERRORBOX in the following SetErrorMode (), @@ -2120,8 +2119,8 @@ static void init_signals(void) exception filter is not guaranteed to work in all situation (like heap corruption or stack overflow) */ - SetErrorMode(SetErrorMode(0)|SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - } + SetErrorMode(SetErrorMode(0) | SEM_FAILCRITICALERRORS + | SEM_NOOPENFILEERRORBOX); SetUnhandledExceptionFilter(my_unhandler_exception_filter); } From ad771f000ca2359c2a16840dc3c4529b661a8738 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 31 Jul 2009 11:22:57 +0200 Subject: [PATCH 08/88] Bug #45698 MTR_VERSION=1 ./mtr --force does not work Small amendment to original fix, as it did not work in azalea Need to handle combinations, would eventually break in 5.1 too --- mysql-test/lib/v1/mtr_cases.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/v1/mtr_cases.pl b/mysql-test/lib/v1/mtr_cases.pl index 906e330282a..288e8c22b44 100644 --- a/mysql-test/lib/v1/mtr_cases.pl +++ b/mysql-test/lib/v1/mtr_cases.pl @@ -540,7 +540,11 @@ sub collect_one_test_case($$$$$$$$$) { $tinfo->{'component_id'} = $component_id; push(@$cases, $tinfo); - if (exists ($incompatible{$tinfo->{'name'}})) + # Remove "combinations" part of test name + my $test_base_name= $tinfo->{'name'}; + $test_base_name=~ s/\s.*\n//; + + if (exists ($incompatible{$test_base_name})) { $tinfo->{'skip'}= 1; $tinfo->{'comment'}= "Test cannot run in mtr v1"; From c26dd8e87b4c4b61d990bf3b7ace0344205a23d1 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 5 Aug 2009 09:41:40 +0200 Subject: [PATCH 09/88] Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails Bug is actually in Perl Fixed by trapping and ignoring error from IO::Socket::UNIX --- mysql-test/lib/My/Platform.pm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 69ffdfbb4ce..7c7741a5c9e 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -126,13 +126,29 @@ sub check_socket_path_length { die "Could not create UNIX domain socket: $!" unless defined $sock; + my $hostpath = eval {$sock->hostpath()}; + if ($@) { + die unless $@ =~ /^Bad arg length for Socket::unpack_sockaddr_un/; + + # Bug on AIX and i5/OS Perl IO::Socket::UNIX which dies with something + # like: + # Bad arg length for Socket::unpack_sockaddr_un, length is 25, + # should be 106 at /path/to/perl/lib/5.8.0/aix/Socket.pm line 380. + # + # Just fake it that everything is fine + $hostpath = $testfile; + } + die "UNIX domain socket path was truncated" - unless ($testfile eq $sock->hostpath()); + unless ($testfile eq $hostpath); $truncated= 0; # Yes, it worked! }; + die "Unexpected failure when checking socket path length: $@" + if $@ and $@ !~ /^UNIX domain socket path was truncated/; + $sock= undef; # Close socket rmtree($tmpdir); # Remove the tempdir and any socket file created return $truncated; From e4b2b9783922db96255143427180526154251be5 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 6 Aug 2009 09:30:53 +0200 Subject: [PATCH 10/88] Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails Bug in Perl Scrap attempt to do this smartly on AIX, just drop the test and assume it's OK This commit undoes the previous push and adds a line to ignore on AIX --- mysql-test/lib/My/Platform.pm | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/mysql-test/lib/My/Platform.pm b/mysql-test/lib/My/Platform.pm index 7c7741a5c9e..371120ab644 100644 --- a/mysql-test/lib/My/Platform.pm +++ b/mysql-test/lib/My/Platform.pm @@ -106,10 +106,13 @@ sub check_socket_path_length { my ($path)= @_; return 0 if IS_WINDOWS; + # This may not be true, but we can't test for it on AIX due to Perl bug + # See Bug #45771 + return 0 if ($^O eq 'aix'); require IO::Socket::UNIX; - my $truncated= 1; # Be negative + my $truncated= undef; # Create a tempfile name with same length as "path" my $tmpdir = tempdir( CLEANUP => 0); @@ -122,32 +125,20 @@ sub check_socket_path_length { Local => $testfile, Listen => 1, ); + $truncated= 1; # Be negatvie die "Could not create UNIX domain socket: $!" unless defined $sock; - my $hostpath = eval {$sock->hostpath()}; - if ($@) { - die unless $@ =~ /^Bad arg length for Socket::unpack_sockaddr_un/; - - # Bug on AIX and i5/OS Perl IO::Socket::UNIX which dies with something - # like: - # Bad arg length for Socket::unpack_sockaddr_un, length is 25, - # should be 106 at /path/to/perl/lib/5.8.0/aix/Socket.pm line 380. - # - # Just fake it that everything is fine - $hostpath = $testfile; - } - die "UNIX domain socket path was truncated" - unless ($testfile eq $hostpath); + unless ($testfile eq $sock->hostpath()); $truncated= 0; # Yes, it worked! }; die "Unexpected failure when checking socket path length: $@" - if $@ and $@ !~ /^UNIX domain socket path was truncated/; + if $@ and not defined $truncated; $sock= undef; # Close socket rmtree($tmpdir); # Remove the tempdir and any socket file created From 687612c8c468e35d961b4b2eab12871027ffef6e Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 11 Aug 2009 12:59:43 +0200 Subject: [PATCH 11/88] Bug #44479 mysql-test-run does not detect that external server has Innodb support Variable name mismatch Map variable have_innodb=YES to innodb=ON --- mysql-test/mysql-test-run.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e6e8a77f3ed..06f02afaf5b 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1506,6 +1506,10 @@ sub collect_mysqld_features_from_running_server () } } + # "Convert" innodb flag + $mysqld_variables{'innodb'}= "ON" + if ($mysqld_variables{'have_innodb'} eq "YES"); + # Parse version my $version_str= $mysqld_variables{'version'}; if ( $version_str =~ /^([0-9]*)\.([0-9]*)\.([0-9]*)/ ) From c368771314309ae6afd7642927047e8d5435b82c Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 11 Aug 2009 15:59:05 +0200 Subject: [PATCH 12/88] Bug #45847 make --gdb disable all the timeouts by default Set to one week for testcase and suite timeout Also set one day timeout for PID file creation (not currently needed in 5.1 but might become, and is needed in azalea) --- mysql-test/mysql-test-run.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 06f02afaf5b..6a2e84d9c78 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1241,6 +1241,13 @@ sub command_line_setup { { mtr_error("Can't use --extern when using debugger"); } + # Set one week timeout (check-testcase timeout will be 1/10th) + $opt_testcase_timeout= 7 * 24 * 60; + $opt_suite_timeout= 7 * 24 * 60; + # One day to shutdown + $opt_shutdown_timeout= 24 * 60; + # One day for PID file creation (this is given in seconds not minutes) + $opt_start_timeout= 24 * 60 * 60; } # -------------------------------------------------------------------------- From c32c55eef7241d73df738faba485acffda23061c Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 11 Aug 2009 23:41:44 +0200 Subject: [PATCH 13/88] Bug #44012 mtr: test cases that are not supposed to return output always fail Output would match an empty result file but we don't check Allow empty output IFF there is an empty result file. --- client/mysqltest.cc | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a39cabdc64d..a40ee1cd1d0 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7987,6 +7987,8 @@ int main(int argc, char **argv) if (parsing_disabled) die("Test ended with parsing disabled"); + my_bool empty_result= FALSE; + /* The whole test has been executed _sucessfully_. Time to compare result or save it to record file. @@ -8027,11 +8029,20 @@ int main(int argc, char **argv) } else { - die("The test didn't produce any output"); + /* Empty output is an error *unless* we also have an empty result file */ + if (! result_file_name || record || + compare_files (log_file.file_name(), result_file_name)) + { + die("The test didn't produce any output"); + } + else + { + empty_result= TRUE; /* Meaning empty was expected */ + } } - if (!command_executed && result_file_name) - die("No queries executed but result file found!"); + if (!command_executed && result_file_name && !empty_result) + die("No queries executed but non-empty result file found!"); verbose_msg("Test has succeeded!"); timer_output(); From 94077809941513dfd32e6a95413a2be02c3133a9 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 13 Aug 2009 15:29:19 +0200 Subject: [PATCH 14/88] Bug #44979 Enhance MTR --experimental to support platform qualifier Adding @ syntax --- mysql-test/collections/README.experimental | 7 +++++++ mysql-test/collections/default.experimental | 1 + mysql-test/mysql-test-run.pl | 12 ++++++++++++ 3 files changed, 20 insertions(+) diff --git a/mysql-test/collections/README.experimental b/mysql-test/collections/README.experimental index 9eee2394423..2f5ee7b00ab 100644 --- a/mysql-test/collections/README.experimental +++ b/mysql-test/collections/README.experimental @@ -23,3 +23,10 @@ The syntax is as follows: start with the same characters up to the last letter before the asterisk are considered experimental: main.a* # get rid of main.alias, main.alibaba and main.agliolio + +6) Optionally, the test case may be followed by one or more platform + qualifiers beginning with @ or @!. The test will then be considered + experimental only/except on that platform. Basic OS names as + reported by $^O in Perl, or 'windows' are supported, this includes + solaris, linux, windows, aix, darwin, ... Example: + main.alias @aix @windows # Fails on those diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 103069f79cf..161af45f133 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -1 +1,2 @@ funcs_1.charset_collation_1 # depends on compile-time decisions +main.plugin_load @solaris # Bug #42144 diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 6a2e84d9c78..40fc7446c9e 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -984,6 +984,9 @@ sub command_line_setup { if ( $opt_experimental ) { + # $^O on Windows considered not generic enough + my $plat= (IS_WINDOWS) ? 'windows' : $^O; + # read the list of experimental test cases from the file specified on # the command line open(FILE, "<", $opt_experimental) or mtr_error("Can't read experimental file: $opt_experimental"); @@ -994,6 +997,15 @@ sub command_line_setup { # remove comments (# foo) at the beginning of the line, or after a # blank at the end of the line s/( +|^)#.*$//; + # If @ platform specifier given, use this entry only if it contains + # @ or @! where xxx != platform + if (/\@.*/) + { + next if (/\@!$plat/); + next unless (/\@$plat/ or /\@!/); + # Then remove @ and everything after it + s/\@.*$//; + } # remove whitespace s/^ +//; s/ +$//; From 7cdccfa05b9124a3cbaaccda6ba8d6f39c0b55ec Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 17 Aug 2009 11:21:02 +0200 Subject: [PATCH 15/88] Bug #46755 Wrong grammar in some skip messages: Test need instead of Test needs Fixed in two comments as well --- mysql-test/lib/mtr_cases.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 2a7b07debd0..94a4ab240b4 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -847,14 +847,14 @@ sub collect_one_test_case { if ( $tinfo->{'big_test'} and ! $::opt_big_test ) { $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need 'big-test' option"; + $tinfo->{'comment'}= "Test needs 'big-test' option"; return $tinfo } if ( $tinfo->{'need_debug'} && ! $::debug_compiled_binaries ) { $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need debug binaries"; + $tinfo->{'comment'}= "Test needs debug binaries"; return $tinfo } @@ -890,14 +890,14 @@ sub collect_one_test_case { if ($tinfo->{'federated_test'}) { - # This is a test that need federated, enable it + # This is a test that needs federated, enable it push(@{$tinfo->{'master_opt'}}, "--loose-federated"); push(@{$tinfo->{'slave_opt'}}, "--loose-federated"); } if ( $tinfo->{'innodb_test'} ) { - # This is a test that need innodb + # This is a test that needs innodb if ( $::mysqld_variables{'innodb'} eq "OFF" || ! exists $::mysqld_variables{'innodb'} ) { @@ -918,7 +918,7 @@ sub collect_one_test_case { if (grep(/^--skip-log-bin/, @::opt_extra_mysqld_opt) ) { $tinfo->{'skip'}= 1; - $tinfo->{'comment'}= "Test need binlog"; + $tinfo->{'comment'}= "Test needs binlog"; return $tinfo; } } From 1a0b63c27a1bd7a491787a69ff99608c669f371b Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 18 Aug 2009 09:38:18 +0200 Subject: [PATCH 16/88] Bug #44222 mysql-test-run --start analyses which tests it would skip. This is redundant. Quicker test collection and better output with --start[-dirty] --- mysql-test/lib/mtr_cases.pm | 15 +++++++++++++-- mysql-test/mysql-test-run.pl | 22 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 2a7b07debd0..5ce936352ce 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -41,6 +41,7 @@ our $opt_with_ndbcluster_only; our $defaults_file; our $defaults_extra_file; our $reorder= 1; +our $quick_collect; sub collect_option { my ($opt, $value)= @_; @@ -68,6 +69,9 @@ require "mtr_misc.pl"; my $do_test_reg; my $skip_test_reg; +# If "Quick collect", set to 1 once a test to run has been found. +my $some_test_found; + sub init_pattern { my ($from, $what)= @_; return undef unless defined $from; @@ -102,6 +106,7 @@ sub collect_test_cases ($$) { foreach my $suite (split(",", $suites)) { push(@$cases, collect_one_suite($suite, $opt_cases)); + last if $some_test_found; } if ( @$opt_cases ) @@ -139,7 +144,7 @@ sub collect_test_cases ($$) { } } - if ( $reorder ) + if ( $reorder && !$quick_collect) { # Reorder the test cases in an order that will make them faster to run my %sort_criteria; @@ -386,7 +391,7 @@ sub collect_one_suite($) # Read combinations for this suite and build testcases x combinations # if any combinations exists # ---------------------------------------------------------------------- - if ( ! $skip_combinations ) + if ( ! $skip_combinations && ! $quick_collect ) { my @combinations; my $combination_file= "$suitedir/combinations"; @@ -583,6 +588,12 @@ sub optimize_cases { if ( $default_engine =~ /^innodb/i ); } } + + if ($quick_collect && ! $tinfo->{'skip'}) + { + $some_test_found= 1; + return; + } } } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 40fc7446c9e..28ddd718f16 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -209,6 +209,7 @@ sub check_timeout { return $opt_testcase_timeout * 6; }; my $opt_start; my $opt_start_dirty; +my $start_only; my $opt_wait_all; my $opt_repeat= 1; my $opt_retry= 3; @@ -1262,11 +1263,19 @@ sub command_line_setup { $opt_start_timeout= 24 * 60 * 60; } + # -------------------------------------------------------------------------- + # Modified behavior with --start options + # -------------------------------------------------------------------------- + if ($opt_start or $opt_start_dirty) { + collect_option ('quick-collect', 1); + $start_only= 1; + } + # -------------------------------------------------------------------------- # Check use of wait-all # -------------------------------------------------------------------------- - if ($opt_wait_all && ! ($opt_start_dirty || $opt_start)) + if ($opt_wait_all && ! $start_only) { mtr_error("--wait-all can only be used with --start or --start-dirty"); } @@ -2824,7 +2833,7 @@ sub run_testcase_check_skip_test($) if ( $tinfo->{'skip'} ) { - mtr_report_test_skipped($tinfo); + mtr_report_test_skipped($tinfo) unless $start_only; return 1; } @@ -3311,9 +3320,16 @@ sub run_testcase ($) { # server exits # ---------------------------------------------------------------------- - if ( $opt_start or $opt_start_dirty ) + if ( $start_only ) { mtr_print("\nStarted", started(all_servers())); + mtr_print("Using config for test", $tinfo->{name}); + mtr_print("Port and socket path for server(s):"); + foreach my $mysqld ( mysqlds() ) + { + mtr_print ($mysqld->name() . " " . $mysqld->value('port') . + " " . $mysqld->value('socket')); + } mtr_print("Waiting for server(s) to exit..."); if ( $opt_wait_all ) { My::SafeProcess->wait_all(); From 0211f76d141128363046c000ccdec63b99d09504 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 18 Aug 2009 15:26:17 +0200 Subject: [PATCH 17/88] Bug #46164 memory leak in mysqltest after parse error with --debug Moved some dynstr_free() further up --- client/mysqltest.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a40ee1cd1d0..fb4b9c6ec13 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -7161,6 +7161,10 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) run_query_normal(cn, command, flags, query, query_len, ds, &ds_warnings); + dynstr_free(&ds_warnings); + if (command->type == Q_EVAL) + dynstr_free(&eval_query); + if (display_result_sorted) { /* Sort the result set and append it to result */ @@ -7191,11 +7195,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags) check_require(ds, command->require_file); } - dynstr_free(&ds_warnings); if (ds == &ds_result) dynstr_free(&ds_result); - if (command->type == Q_EVAL) - dynstr_free(&eval_query); DBUG_VOID_RETURN; } From 3efecb16260d060e9bc28309ff54b044fb8d4027 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 19 Aug 2009 13:48:56 +0200 Subject: [PATCH 18/88] Bug #39003 mtr's diff_files command failed in pushbuild without printing a result diff diff was actually called but result never outputted before exiting Added extra code to dump output *unless* failure was expected --- client/mysqltest.cc | 9 +++++++-- mysql-test/t/mysqltest.test | 12 ------------ 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index a40ee1cd1d0..09b31599268 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -3440,12 +3440,17 @@ void do_diff_files(struct st_command *command) die("command \"diff_files\" failed, file '%s' does not exist", ds_filename2.str); - if ((error= compare_files(ds_filename.str, ds_filename2.str))) + if ((error= compare_files(ds_filename.str, ds_filename2.str)) && + match_expected_error(command, error, NULL) < 0) { /* Compare of the two files failed, append them to output - so the failure can be analyzed + so the failure can be analyzed, but only if it was not + expected to fail. */ show_diff(&ds_res, ds_filename.str, ds_filename2.str); + log_file.write(&ds_res); + log_file.flush(); + dynstr_set(&ds_res, 0); } dynstr_free(&ds_filename); diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 578b2bf5c6c..92f39d943b9 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -1710,10 +1710,6 @@ EOF --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp --diff_files $MYSQLTEST_VARDIR/tmp/diff2.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp -# Write the below commands to a intermediary file and execute them with -# mysqltest in --exec, since the output will vary depending on what "diff" -# is available it is sent to /dev/null ---write_file $MYSQLTEST_VARDIR/tmp/diff.test # Compare files that differ in size --error 2 --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff3.tmp @@ -1725,13 +1721,6 @@ EOF --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff4.tmp --error 1 --diff_files $MYSQLTEST_VARDIR/tmp/diff4.tmp $MYSQLTEST_VARDIR/tmp/diff1.tmp -exit; -EOF - -# Execute the above diffs, and send their output to /dev/null - only -# interesting to see that it returns correct error codes ---exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/diff.test > /dev/null 2>&1 - # Compare equal files, again... --diff_files $MYSQLTEST_VARDIR/tmp/diff1.tmp $MYSQLTEST_VARDIR/tmp/diff2.tmp @@ -1740,7 +1729,6 @@ EOF --remove_file $MYSQLTEST_VARDIR/tmp/diff2.tmp --remove_file $MYSQLTEST_VARDIR/tmp/diff3.tmp --remove_file $MYSQLTEST_VARDIR/tmp/diff4.tmp ---remove_file $MYSQLTEST_VARDIR/tmp/diff.test # ---------------------------------------------------------------------------- From 4994e66783f4d338ffc7c3769ea60d40c74ade18 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 25 Aug 2009 15:56:50 +0200 Subject: [PATCH 19/88] Bug #42408 Faulty regex for detecting [Warning] and [ERROR] in mysqld error log Enabled proper pattern for Warnings and ERRORs Added some suppressions --- mysql-test/include/mtr_warnings.sql | 6 +++++- mysql-test/mysql-test-run.pl | 6 ++---- mysql-test/r/almost_full.result | 1 + mysql-test/r/upgrade.result | 4 ---- mysql-test/suite/rpl/r/rpl_idempotency.result | 3 ++- mysql-test/suite/rpl/t/rpl_idempotency.test | 3 ++- mysql-test/t/almost_full.test | 2 ++ mysql-test/t/upgrade.test | 2 ++ 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 73287900f3c..157244a9b0a 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -132,7 +132,7 @@ INSERT INTO global_suppressions VALUES ("Error in Log_event::read_log_event\\\(\\\): 'Sanity check failed', data_len: 258, event_type: 49"), - ("Statement is not safe to log in statement format"), + ("Statement may not be safe to log in statement format"), /* test case for Bug#bug29807 copies a stray frm into database */ ("InnoDB: Error: table `test`.`bug29807` does not exist in the InnoDB internal"), @@ -172,6 +172,10 @@ INSERT INTO global_suppressions VALUES */ ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), + /* Added 2009-08-XX after fixing Bug #42408 */ + + ("Slave: Operation DROP USER failed for '.*'@'localhost' Error_code: 1396"), + ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 28ddd718f16..c15f3990ec4 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3624,10 +3624,8 @@ sub extract_warning_lines ($) { # and correcting them shows a few additional harmless warnings. # Thus those patterns are temporarily removed from the list # of patterns. For more info see BUG#42408 - # qr/^Warning:|mysqld: Warning|\[Warning\]/, - # qr/^Error:|\[ERROR\]/, - qr/^Warning:|mysqld: Warning/, - qr/^Error:/, + qr/^Warning:|mysqld: Warning|\[Warning\]/, + qr/^Error:|\[ERROR\]/, qr/^==.* at 0x/, qr/InnoDB: Warning|InnoDB: Error/, qr/^safe_mutex:|allocated at line/, diff --git a/mysql-test/r/almost_full.result b/mysql-test/r/almost_full.result index eb28f12fa51..b2d7092aa51 100644 --- a/mysql-test/r/almost_full.result +++ b/mysql-test/r/almost_full.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("The table 't1' is full"); drop table if exists t1; set global myisam_data_pointer_size=2; CREATE TABLE t1 (a int auto_increment primary key not null, b longtext) ENGINE=MyISAM; diff --git a/mysql-test/r/upgrade.result b/mysql-test/r/upgrade.result index da6201692a9..034242079b1 100644 --- a/mysql-test/r/upgrade.result +++ b/mysql-test/r/upgrade.result @@ -108,11 +108,7 @@ a-b-c show create view `a-b-c`.v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `a`.`f1` AS `f1` from (`a-b-c`.`t1` `a` join `information_schema`.`tables` `b`) where (convert(`a`.`f1` using utf8) = `b`.`TABLE_NAME`) utf8 utf8_general_ci -Warnings: -Note 1600 Creation context of view `a-b-c`.`v1' is invalid select * from `a-b-c`.v1; f1 -Warnings: -Note 1600 Creation context of view `a-b-c`.`v1' is invalid drop database `a-b-c`; use test; diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index 3341c03db0f..bfdcbc6fa23 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -4,7 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032"); +call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); +call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); SET @old_slave_exec_mode= @@global.slave_exec_mode; CREATE TABLE t1 (a INT PRIMARY KEY); diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test index bfd1860759e..c96b88a1b1a 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -8,7 +8,8 @@ connection slave; source include/have_innodb.inc; # Add suppression for expected warning(s) in slaves error log -call mtr.add_suppression("Slave: Can\'t find record in \'t1\' Error_code: 1032"); +call mtr.add_suppression("Slave: Can't find record in 't.' Error_code: 1032"); +call mtr.add_suppression("Slave: Cannot delete or update a parent row: a foreign key constraint fails .* Error_code: 1451"); call mtr.add_suppression("Slave: Cannot add or update a child row: a foreign key constraint fails .* Error_code: 1452"); SET @old_slave_exec_mode= @@global.slave_exec_mode; diff --git a/mysql-test/t/almost_full.test b/mysql-test/t/almost_full.test index 5c67ab3c088..24801f9cbc3 100644 --- a/mysql-test/t/almost_full.test +++ b/mysql-test/t/almost_full.test @@ -2,6 +2,8 @@ # Some special cases with empty tables # +call mtr.add_suppression("The table 't1' is full"); + --disable_warnings drop table if exists t1; --enable_warnings diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test index d571a2efc7c..e390e8a1253 100644 --- a/mysql-test/t/upgrade.test +++ b/mysql-test/t/upgrade.test @@ -124,6 +124,8 @@ with_check_option=0 timestamp=2009-04-10 11:53:37 create-version=1 source=select f1 from `a-b-c`.t1 a, information_schema.tables b\nwhere a.f1 = b.table_name +client_cs_name=utf8 +connection_cl_name=utf8_general_ci EOF show databases like '%a-b-c%'; From d458d55755d7acc83db89d6ca0e2cf008000a8c7 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 27 Aug 2009 15:17:09 +0200 Subject: [PATCH 20/88] Bug #46322 Sporadic timeout in mysql_upgrade.test Apparently caused by logging to table Turn on logging to file only, add to .opt file for tests needing log to table --- mysql-test/mysql-test-run.pl | 4 ++-- mysql-test/t/events_logs_tests-master.opt | 2 +- mysql-test/t/log_tables-master.opt | 2 +- mysql-test/t/ps-master.opt | 2 +- mysql-test/t/show_check-master.opt | 2 +- mysql-test/t/status-master.opt | 1 + 6 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 mysql-test/t/status-master.opt diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c15f3990ec4..429fbfe41c6 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4105,8 +4105,8 @@ sub mysqld_arguments ($$$) { if ( $mysql_version_id >= 50106 ) { - # Turn on logging to both tables and file - mtr_add_arg($args, "--log-output=table,file"); + # Turn on logging to file + mtr_add_arg($args, "--log-output=file"); } # Check if "extra_opt" contains skip-log-bin diff --git a/mysql-test/t/events_logs_tests-master.opt b/mysql-test/t/events_logs_tests-master.opt index 35ff7911705..3ece9710a45 100644 --- a/mysql-test/t/events_logs_tests-master.opt +++ b/mysql-test/t/events_logs_tests-master.opt @@ -1 +1 @@ ---log-slow-queries +--log-output=table,file --log-slow-queries diff --git a/mysql-test/t/log_tables-master.opt b/mysql-test/t/log_tables-master.opt index 35ff7911705..3ece9710a45 100644 --- a/mysql-test/t/log_tables-master.opt +++ b/mysql-test/t/log_tables-master.opt @@ -1 +1 @@ ---log-slow-queries +--log-output=table,file --log-slow-queries diff --git a/mysql-test/t/ps-master.opt b/mysql-test/t/ps-master.opt index 3eb98fc3d6b..31c287d2bb5 100644 --- a/mysql-test/t/ps-master.opt +++ b/mysql-test/t/ps-master.opt @@ -1 +1 @@ ---log-slow-queries --log-long-format --log-queries-not-using-indexes +--log-output=table,file --log-slow-queries --log-long-format --log-queries-not-using-indexes diff --git a/mysql-test/t/show_check-master.opt b/mysql-test/t/show_check-master.opt index 7a438da06cc..aab832e2848 100644 --- a/mysql-test/t/show_check-master.opt +++ b/mysql-test/t/show_check-master.opt @@ -1 +1 @@ ---log-slow-queries --log-long-format --log-queries-not-using-indexes --myisam-recover="" +--log-output=table,file --log-slow-queries --log-long-format --log-queries-not-using-indexes --myisam-recover="" diff --git a/mysql-test/t/status-master.opt b/mysql-test/t/status-master.opt new file mode 100644 index 00000000000..eb3bb4fe50d --- /dev/null +++ b/mysql-test/t/status-master.opt @@ -0,0 +1 @@ +--log-output=table,file From 013c46cb36166e0b319c2655b5229b7c6ef319c2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 28 Aug 2009 15:02:48 +0200 Subject: [PATCH 21/88] Bug #46973 MTR: extract_warning_lines does not check it's extracting lines for current test Rewrote logic (first commit was incomplete, sorry) --- mysql-test/mysql-test-run.pl | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 429fbfe41c6..5a5d063c105 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3571,8 +3571,8 @@ sub run_testcase ($) { # error log and write all lines that look # suspicious into $error_log.warnings # -sub extract_warning_lines ($) { - my ($error_log) = @_; +sub extract_warning_lines ($$) { + my ($error_log, $tname) = @_; # Open the servers .err log file and read all lines # belonging to current tets into @lines @@ -3580,14 +3580,27 @@ sub extract_warning_lines ($) { or mtr_error("Could not open file '$error_log' for reading: $!"); my @lines; + my $found_test= 0; # Set once we've found the log of this test while ( my $line = <$Ferr> ) { - if ( $line =~ /^CURRENT_TEST:/ ) + if ($found_test) { - # Throw away lines from previous tests - @lines = (); + # If test wasn't last after all, discard what we found, test again. + if ( $line =~ /^CURRENT_TEST:/) + { + @lines= (); + $found_test= $line =~ /^CURRENT_TEST: $tname/; + } + else + { + push(@lines, $line); + } + } + else + { + # Search for beginning of test, until found + $found_test= 1 if ($line =~ /^CURRENT_TEST: $tname/); } - push(@lines, $line); } $Ferr = undef; # Close error log file @@ -3665,7 +3678,7 @@ sub start_check_warnings ($$) { my $log_error= $mysqld->value('#log-error'); # To be communicated to the test $ENV{MTR_LOG_ERROR}= $log_error; - extract_warning_lines($log_error); + extract_warning_lines($log_error, $tinfo->{name}); my $args; mtr_init_args(\$args); From dbbf8d83ffd07887f4430acf99ea2cc82bafadfd Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Fri, 28 Aug 2009 16:13:27 +0200 Subject: [PATCH 22/88] Bug #42408 Faulty regex for detecting [Warning] and [ERROR] in mysqld error log Some follow-up test fixes after seeing effect in PB2 --- mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test | 2 ++ mysql-test/r/lowercase_table3.result | 2 +- mysql-test/suite/rpl/r/rpl_bug33931.result | 2 +- mysql-test/suite/rpl/r/rpl_extraCol_innodb.result | 1 + mysql-test/suite/rpl/r/rpl_extraCol_myisam.result | 1 + mysql-test/suite/rpl/r/rpl_init_slave_errors.result | 1 + mysql-test/suite/rpl/t/rpl_bug33931.test | 2 +- mysql-test/suite/rpl/t/rpl_init_slave_errors.test | 1 + mysql-test/t/lowercase_table3.test | 2 +- 9 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test index 6890913b7d1..a7b02065144 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test @@ -22,6 +22,8 @@ DROP TABLE IF EXISTS t1, t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t14a,t15,t1 # should stop the slave. # ################################################# +call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); + --echo **** Diff Table Def Start **** ############################################## diff --git a/mysql-test/r/lowercase_table3.result b/mysql-test/r/lowercase_table3.result index 1ef7d04bb1d..22e80aaeb26 100644 --- a/mysql-test/r/lowercase_table3.result +++ b/mysql-test/r/lowercase_table3.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("Cannot find or open table test/BUG29839 from .*"); +call mtr.add_suppression("Cannot find or open table test/BUG29839 from"); DROP TABLE IF EXISTS t1,T1; CREATE TABLE t1 (a INT); SELECT * FROM T1; diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index 85c8fb0da9c..a17941f6ba9 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -1,5 +1,5 @@ reset master; -call mtr.add_suppression("Failed during slave thread initialization"); +call mtr.add_suppression("Failed during slave I/O thread initialization"); stop slave; reset slave; SET GLOBAL debug="d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result index e57daad3342..e2ec78e7adc 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** STOP SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result index 6696ddc7789..ed5b4eac27d 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** STOP SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result index ab957e6d9bc..c6ee82b13f3 100644 --- a/mysql-test/suite/rpl/r/rpl_init_slave_errors.result +++ b/mysql-test/suite/rpl/r/rpl_init_slave_errors.result @@ -9,6 +9,7 @@ reset slave; SET GLOBAL debug= "d,simulate_io_slave_error_on_init,simulate_sql_slave_error_on_init"; start slave; Reporting the following error: Failed during slave thread initialization +call mtr.add_suppression("Failed during slave I/O thread initialization"); SET GLOBAL debug= ""; stop slave; reset slave; diff --git a/mysql-test/suite/rpl/t/rpl_bug33931.test b/mysql-test/suite/rpl/t/rpl_bug33931.test index 13f781c644b..1316ddb7401 100644 --- a/mysql-test/suite/rpl/t/rpl_bug33931.test +++ b/mysql-test/suite/rpl/t/rpl_bug33931.test @@ -15,7 +15,7 @@ reset master; connection slave; # Add suppression for expected warnings in slaves error log -call mtr.add_suppression("Failed during slave thread initialization"); +call mtr.add_suppression("Failed during slave I/O thread initialization"); --disable_warnings stop slave; diff --git a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test index 4ca0de6ec66..180821730ec 100644 --- a/mysql-test/suite/rpl/t/rpl_init_slave_errors.test +++ b/mysql-test/suite/rpl/t/rpl_init_slave_errors.test @@ -57,6 +57,7 @@ source include/wait_for_slave_to_stop.inc; let $error= query_get_value(SHOW SLAVE STATUS, Last_Error, 1); echo Reporting the following error: $error; +call mtr.add_suppression("Failed during slave I/O thread initialization"); SET GLOBAL debug= ""; diff --git a/mysql-test/t/lowercase_table3.test b/mysql-test/t/lowercase_table3.test index 4748953fe95..f7ca8211288 100644 --- a/mysql-test/t/lowercase_table3.test +++ b/mysql-test/t/lowercase_table3.test @@ -9,7 +9,7 @@ --source include/have_case_insensitive_file_system.inc --source include/not_windows.inc -call mtr.add_suppression("Cannot find or open table test/BUG29839 from .*"); +call mtr.add_suppression("Cannot find or open table test/BUG29839 from"); --disable_warnings DROP TABLE IF EXISTS t1,T1; From bc6ea4ced77ff755ceec1c930622eb9637a5f6a9 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Sat, 29 Aug 2009 10:30:59 +0200 Subject: [PATCH 23/88] A few more suppression fixes after 42408 --- mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result | 1 + mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test | 3 +++ mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result | 1 + 3 files changed, 5 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index 777f7d8427b..71c17321117 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index 39f3b700f94..3a1fbe04e17 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -7,6 +7,9 @@ # 1 - Creates a table and populates it through "LOAD DATA INFILE". # 2 - Catches error. ########################################################################## + +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); + --source include/have_binlog_format_mixed_or_statement.inc --source include/have_innodb.inc --source include/have_debug.inc diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result index d51599fd18b..f812509de6f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result @@ -4,6 +4,7 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; +call mtr.add_suppression("Slave: Unknown table 't6' Error_code: 1051"); **** Diff Table Def Start **** *** On Slave *** STOP SLAVE; From 7941f3c3a0a4117ee7d8398543bece096e29d38b Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Sat, 29 Aug 2009 23:29:47 +0200 Subject: [PATCH 24/88] even more suppression fixes --- mysql-test/suite/parts/r/partition_recover_myisam.result | 2 ++ mysql-test/suite/parts/t/partition_recover_myisam.test | 4 ++++ mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result | 2 +- mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test | 4 ++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/parts/r/partition_recover_myisam.result b/mysql-test/suite/parts/r/partition_recover_myisam.result index df737ec2853..49775ee498e 100644 --- a/mysql-test/suite/parts/r/partition_recover_myisam.result +++ b/mysql-test/suite/parts/r/partition_recover_myisam.result @@ -1,3 +1,5 @@ +call mtr.add_suppression("./test/t1_will_crash"); +call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc"); CREATE TABLE t1_will_crash (a INT, KEY (a)) ENGINE=MyISAM; INSERT INTO t1_will_crash VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10), (11); FLUSH TABLES; diff --git a/mysql-test/suite/parts/t/partition_recover_myisam.test b/mysql-test/suite/parts/t/partition_recover_myisam.test index 14604bfeb15..64bc821ac37 100644 --- a/mysql-test/suite/parts/t/partition_recover_myisam.test +++ b/mysql-test/suite/parts/t/partition_recover_myisam.test @@ -1,4 +1,8 @@ # test the auto-recover (--myisam-recover) of partitioned myisam tables + +call mtr.add_suppression("./test/t1_will_crash"); +call mtr.add_suppression("Got an error from unknown thread, ha_myisam.cc"); + --source include/have_partition.inc --disable_warnings --disable_query_log diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index 71c17321117..bc6fa377dc3 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -1,4 +1,3 @@ -call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); stop slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; reset master; @@ -52,3 +51,4 @@ Last_SQL_Errno 9 Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed drop table t1; drop table t1; +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index 3a1fbe04e17..fe1fc730ba8 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -8,8 +8,6 @@ # 2 - Catches error. ########################################################################## -call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); - --source include/have_binlog_format_mixed_or_statement.inc --source include/have_innodb.inc --source include/have_debug.inc @@ -50,3 +48,5 @@ drop table t1; connection slave; drop table t1; + +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); From 2194a927a9e840a6486dc510b8c6621b3ecd76aa Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Sun, 30 Aug 2009 12:01:08 +0200 Subject: [PATCH 25/88] yet another 42408 followup --- mysql-test/suite/rpl/t/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index 38fc9e21322..cb7a2a98925 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,3 +11,4 @@ ############################################################################## rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx +rpl_slave_load_remove_tmpfile Bug#46996, unable to suppress warning From 86a3262d2605a0713ca1b489b49d7aa83e219a66 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Mon, 31 Aug 2009 09:24:59 +0200 Subject: [PATCH 26/88] forgot : in rpl's disabled.def --- mysql-test/suite/rpl/t/disabled.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index cb7a2a98925..546c0e6b194 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,4 +11,4 @@ ############################################################################## rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx -rpl_slave_load_remove_tmpfile Bug#46996, unable to suppress warning +rpl_slave_load_remove_tmpfile : Bug#46996, unable to suppress warning From 202984236ac333a46539033e4d6bdb29c4593cc2 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Tue, 1 Sep 2009 13:38:17 +0200 Subject: [PATCH 27/88] 46996 workaruond --- mysql-test/include/mtr_warnings.sql | 4 ---- mysql-test/suite/rpl/r/rpl_do_grant.result | 3 +++ .../suite/rpl/r/rpl_slave_load_remove_tmpfile.result | 2 +- mysql-test/suite/rpl/t/disabled.def | 1 - mysql-test/suite/rpl/t/rpl_do_grant.test | 7 ++++++- mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 157244a9b0a..b73234e6142 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -172,10 +172,6 @@ INSERT INTO global_suppressions VALUES */ ("Can't find file: '.\\\\test\\\\\\?{8}.frm'"), - /* Added 2009-08-XX after fixing Bug #42408 */ - - ("Slave: Operation DROP USER failed for '.*'@'localhost' Error_code: 1396"), - ("THE_LAST_SUPPRESSION")|| diff --git a/mysql-test/suite/rpl/r/rpl_do_grant.result b/mysql-test/suite/rpl/r/rpl_do_grant.result index 69bcfad4347..0913b1afdbf 100644 --- a/mysql-test/suite/rpl/r/rpl_do_grant.result +++ b/mysql-test/suite/rpl/r/rpl_do_grant.result @@ -166,4 +166,7 @@ DROP FUNCTION upgrade_del_func; DROP FUNCTION upgrade_alter_func; DROP DATABASE bug42217_db; DROP USER 'create_rout_db'@'localhost'; +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); +USE mtr; +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); "End of test" diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index bc6fa377dc3..e2efcf08d7a 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -51,4 +51,4 @@ Last_SQL_Errno 9 Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed drop table t1; drop table t1; -call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3"); diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index 546c0e6b194..38fc9e21322 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -11,4 +11,3 @@ ############################################################################## rpl_cross_version : Bug#42311 2009-03-27 joro rpl_cross_version fails on macosx -rpl_slave_load_remove_tmpfile : Bug#46996, unable to suppress warning diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index 806de780086..a8b15516682 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -207,5 +207,10 @@ DROP FUNCTION upgrade_del_func; DROP FUNCTION upgrade_alter_func; DROP DATABASE bug42217_db; DROP USER 'create_rout_db'@'localhost'; - + +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); +connection slave; +USE mtr; +call mtr.add_suppression("Slave: Operation DROP USER failed for 'create_rout_db'@'localhost' Error_code: 1396"); + --echo "End of test" diff --git a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test index fe1fc730ba8..437e1ebb92d 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test +++ b/mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test @@ -49,4 +49,4 @@ connection slave; drop table t1; -call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' (Errcode: 9) Error_code: 3"); +call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3"); From d65168fddab05ed08d95eb5fead7cb1aad38edd5 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Wed, 2 Sep 2009 11:17:33 +0200 Subject: [PATCH 28/88] Bug #32296 mysqltest fails to parse "append_file" inside a "while", it works inside a "if" Bug #41913 mysqltest cannot source files from if inside while Some commands require additional processing which only works first time Keep content for write_file or append_file with the st_command struct Add tests for those cases to mysqltest.test --- client/mysqltest.cc | 56 ++++++++++++++++++++++++++++------- mysql-test/r/mysqltest.result | 19 ++++-------- mysql-test/t/mysqltest.test | 26 ++++++++++++---- 3 files changed, 73 insertions(+), 28 deletions(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 0cf7e62ac8c..7965dafb863 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -417,6 +417,7 @@ static struct st_expected_errors saved_expected_errors; struct st_command { char *query, *query_buf,*first_argument,*last_argument,*end; + DYNAMIC_STRING content; int first_word_len, query_len; my_bool abort_on_error; struct st_expected_errors expected_errors; @@ -1138,6 +1139,8 @@ void free_used_memory() { struct st_command **q= dynamic_element(&q_lines, i, struct st_command**); my_free((*q)->query_buf,MYF(MY_ALLOW_ZERO_PTR)); + if ((*q)->content.str) + dynstr_free(&(*q)->content); my_free((*q),MYF(0)); } for (i= 0; i < 10; i++) @@ -3283,21 +3286,30 @@ void do_write_file_command(struct st_command *command, my_bool append) sizeof(write_file_args)/sizeof(struct command_arg), ' '); - /* If no delimiter was provided, use EOF */ - if (ds_delimiter.length == 0) - dynstr_set(&ds_delimiter, "EOF"); - if (!append && access(ds_filename.str, F_OK) == 0) { /* The file should not be overwritten */ die("File already exist: '%s'", ds_filename.str); } - init_dynamic_string(&ds_content, "", 1024, 1024); - read_until_delimiter(&ds_content, &ds_delimiter); - DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str)); - str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append); - dynstr_free(&ds_content); + ds_content= command->content; + /* If it hasn't been done already by a loop iteration, fill it in */ + if (! ds_content.str) + { + /* If no delimiter was provided, use EOF */ + if (ds_delimiter.length == 0) + dynstr_set(&ds_delimiter, "EOF"); + + init_dynamic_string(&ds_content, "", 1024, 1024); + read_until_delimiter(&ds_content, &ds_delimiter); + command->content= ds_content; + } + /* This function could be called even if "false", so check before printing */ + if (cur_block->ok) + { + DBUG_PRINT("info", ("Writing to file: %s", ds_filename.str)); + str_to_file2(ds_filename.str, ds_content.str, ds_content.length, append); + } dynstr_free(&ds_filename); dynstr_free(&ds_delimiter); DBUG_VOID_RETURN; @@ -7684,7 +7696,31 @@ int main(int argc, char **argv) command->type= Q_COMMENT; } - if (cur_block->ok) + my_bool ok_to_do= cur_block->ok; + /* + Some commands need to be "done" the first time if they may get + re-iterated over in a true context. This can only happen if there's + a while loop at some level above the current block. + */ + if (!ok_to_do) + { + if (command->type == Q_SOURCE || + command->type == Q_WRITE_FILE || + command->type == Q_APPEND_FILE || + command->type == Q_PERL) + { + for (struct st_block *stb= cur_block-1; stb >= block_stack; stb--) + { + if (stb->cmd == cmd_while) + { + ok_to_do= 1; + break; + } + } + } + } + + if (ok_to_do) { command->last_argument= command->first_argument; processed = 1; diff --git a/mysql-test/r/mysqltest.result b/mysql-test/r/mysqltest.result index 52a1734ea54..f68413264e4 100644 --- a/mysql-test/r/mysqltest.result +++ b/mysql-test/r/mysqltest.result @@ -314,21 +314,10 @@ here is the sourced script 1 = outer loop variable before dec 0 = outer loop variable after dec - -2 = outer loop variable after while +outer=2 ifval=0 +outer=1 ifval=1 here is the sourced script -2 = outer loop variable before dec - -1 = outer loop variable after dec - -1 = outer loop variable after while -here is the sourced script - -1 = outer loop variable before dec - -0 = outer loop variable after dec - In loop here is the sourced script @@ -538,6 +527,10 @@ mysqltest: At line 1: Missing required argument 'filename' to command 'write_fil mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found Content for test_file1 mysqltest: At line 1: File already exist: 'MYSQLTEST_VARDIR/tmp/test_file1.tmp' +These lines should be repeated, +if things work as expected +These lines should be repeated, +if things work as expected Some data for cat_file command of mysqltest diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 92f39d943b9..9859e73cfae 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -853,16 +853,18 @@ while ($outer) eval SELECT '$outer = outer loop variable after dec' AS ""; } +# Test source in an if in a while which is false on 1st iteration let $outer= 2; # Number of outer loops +let $ifval= 0; # false 1st time while ($outer) { - eval SELECT '$outer = outer loop variable after while' AS ""; + echo outer=$outer ifval=$ifval; - echo here is the sourced script; - - eval SELECT '$outer = outer loop variable before dec' AS ""; + if ($ifval) { + --source $MYSQLTEST_VARDIR/tmp/sourced.inc + } dec $outer; - eval SELECT '$outer = outer loop variable after dec' AS ""; + inc $ifval; } @@ -1663,6 +1665,20 @@ EOF remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; +# Test append_file within while +let $outer= 2; # Number of outer loops +while ($outer) +{ + append_file $MYSQLTEST_VARDIR/tmp/app_while.tmp; +These lines should be repeated, +if things work as expected +EOF + dec $outer; +} + +cat_file $MYSQLTEST_VARDIR/tmp/app_while.tmp; +remove_file $MYSQLTEST_VARDIR/tmp/app_while.tmp; + # ---------------------------------------------------------------------------- # test for cat_file # ---------------------------------------------------------------------------- From 5cdf8392b5d149961c6b7644599f3f0210700992 Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 3 Sep 2009 08:19:54 +0200 Subject: [PATCH 29/88] Bug #47075 Wildcards in experimental test names destroyed when tested first time Extract substr into local variable --- mysql-test/lib/mtr_report.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index a246c5bbef6..f2131b9bd76 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -134,8 +134,8 @@ sub mtr_report_test ($) { # an asterisk at the end, determine if the characters up to # but excluding the asterisk are the same if ( $exp ne "" && substr($exp, -1, 1) eq "*" ) { - $exp = substr($exp, 0, length($exp) - 1); - if ( substr($test_name, 0, length($exp)) ne $exp ) { + my $nexp = substr($exp, 0, length($exp) - 1); + if ( substr($test_name, 0, length($nexp)) ne $nexp ) { # no match, try next entry next; } From aabcb80e95f3e20e16ecb41183c50a29a72e19aa Mon Sep 17 00:00:00 2001 From: Bjorn Munch Date: Thu, 3 Sep 2009 08:38:06 +0200 Subject: [PATCH 30/88] A few suppression follow-ups --- mysql-test/r/bug46080.result | 2 ++ mysql-test/r/partition_csv.result | 1 + mysql-test/t/bug46080.test | 3 +++ mysql-test/t/partition_csv.test | 2 ++ 4 files changed, 8 insertions(+) diff --git a/mysql-test/r/bug46080.result b/mysql-test/r/bug46080.result index 18c7c22829a..2173768cdad 100644 --- a/mysql-test/r/bug46080.result +++ b/mysql-test/r/bug46080.result @@ -2,6 +2,8 @@ # Bug #46080: group_concat(... order by) crashes server when # sort_buffer_size cannot allocate # +call mtr.add_suppression("Out of memory at line .*, 'my_alloc.c'"); +call mtr.add_suppression("needed .* byte .*k., memory in use: .* bytes .*k"); CREATE TABLE t1(a CHAR(255)); INSERT INTO t1 VALUES ('a'); SET @@SESSION.sort_buffer_size=5*16*1000000; diff --git a/mysql-test/r/partition_csv.result b/mysql-test/r/partition_csv.result index 07651f29da4..18e28d4670a 100644 --- a/mysql-test/r/partition_csv.result +++ b/mysql-test/r/partition_csv.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("Failed to write to mysql.general_log"); drop table if exists t1; create table t1 (a int) engine = csv diff --git a/mysql-test/t/bug46080.test b/mysql-test/t/bug46080.test index 7e56e3ce421..8b4cee4d8b0 100644 --- a/mysql-test/t/bug46080.test +++ b/mysql-test/t/bug46080.test @@ -3,6 +3,9 @@ --echo # sort_buffer_size cannot allocate --echo # +call mtr.add_suppression("Out of memory at line .*, 'my_alloc.c'"); +call mtr.add_suppression("needed .* byte .*k., memory in use: .* bytes .*k"); + CREATE TABLE t1(a CHAR(255)); INSERT INTO t1 VALUES ('a'); diff --git a/mysql-test/t/partition_csv.test b/mysql-test/t/partition_csv.test index dd2ef7c1d1f..44013dd4b0a 100644 --- a/mysql-test/t/partition_csv.test +++ b/mysql-test/t/partition_csv.test @@ -10,6 +10,8 @@ --source include/have_partition.inc --source include/have_csv.inc +call mtr.add_suppression("Failed to write to mysql.general_log"); + # # Bug#19307: Partitions: csv delete failure # = CSV engine crashes From 28b0d8a218acfd62a5160952e73df550794791cc Mon Sep 17 00:00:00 2001 From: Jonathan Perkin Date: Thu, 3 Sep 2009 18:20:43 +0200 Subject: [PATCH 31/88] Raise version number after cloning 5.1.39 --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 5b9f3e0f200..b974d7076d7 100644 --- a/configure.in +++ b/configure.in @@ -10,7 +10,7 @@ AC_CANONICAL_SYSTEM # # When changing major version number please also check switch statement # in mysqlbinlog::check_master_version(). -AM_INIT_AUTOMAKE(mysql, 5.1.39) +AM_INIT_AUTOMAKE(mysql, 5.1.40) AM_CONFIG_HEADER([include/config.h:config.h.in]) PROTOCOL_VERSION=10 From 5661e72623e66d9170dbe3e7913ff4f36b79100d Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Wed, 23 Sep 2009 11:43:43 +0200 Subject: [PATCH 32/88] BUG#29288: myisam transactions replicated to a transactional slave leaves slave unstable Problem: when replicating from non-transactional to transactional engine with autocommit off, no BEGIN/COMMIT is written to the binlog. When the slave replicates, it will start a transaction that never ends. Fix: Force autocommit=on on slave by always replicating autocommit=1 from the master. --- .../rpl_ndb/r/rpl_ndb_mixed_tables.result | 286 ++++++++++++++ .../rpl_ndb/t/rpl_ndb_mixed_tables-master.opt | 1 + .../rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt | 1 + .../suite/rpl_ndb/t/rpl_ndb_mixed_tables.test | 349 ++++++++++++++++++ sql/log_event.cc | 28 +- 5 files changed, 659 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result create mode 100644 mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt create mode 100644 mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt create mode 100644 mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result new file mode 100644 index 00000000000..92fda774da5 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result @@ -0,0 +1,286 @@ +==== Initialization ==== +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +---- setup master ---- +CREATE TABLE myisam_innodb (a INT) ENGINE=MYISAM; +CREATE TABLE innodb_myisam (a INT) ENGINE=INNODB; +CREATE TABLE myisam_ndb (a INT) ENGINE=MYISAM; +CREATE TABLE ndb_myisam (a INT) ENGINE=NDB; +CREATE TABLE innodb_ndb (a INT) ENGINE=INNODB; +CREATE TABLE ndb_innodb (a INT) ENGINE=NDB; +SHOW CREATE TABLE myisam_innodb; +Table Create Table +myisam_innodb CREATE TABLE `myisam_innodb` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE innodb_myisam; +Table Create Table +innodb_myisam CREATE TABLE `innodb_myisam` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE myisam_ndb; +Table Create Table +myisam_ndb CREATE TABLE `myisam_ndb` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE ndb_myisam; +Table Create Table +ndb_myisam CREATE TABLE `ndb_myisam` ( + `a` int(11) DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +SHOW CREATE TABLE innodb_ndb; +Table Create Table +innodb_ndb CREATE TABLE `innodb_ndb` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE ndb_innodb; +Table Create Table +ndb_innodb CREATE TABLE `ndb_innodb` ( + `a` int(11) DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +---- setup slave with different engines ---- +DROP TABLE myisam_innodb, innodb_myisam; +DROP TABLE myisam_ndb, ndb_myisam; +DROP TABLE innodb_ndb, ndb_innodb; +CREATE TABLE myisam_innodb (a INT) ENGINE=INNODB; +CREATE TABLE innodb_myisam (a INT) ENGINE=MYISAM; +CREATE TABLE myisam_ndb (a INT) ENGINE=NDB; +CREATE TABLE ndb_myisam (a INT) ENGINE=MYISAM; +CREATE TABLE innodb_ndb (a INT) ENGINE=NDB; +CREATE TABLE ndb_innodb (a INT) ENGINE=INNODB; +SHOW CREATE TABLE myisam_innodb; +Table Create Table +myisam_innodb CREATE TABLE `myisam_innodb` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE innodb_myisam; +Table Create Table +innodb_myisam CREATE TABLE `innodb_myisam` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE myisam_ndb; +Table Create Table +myisam_ndb CREATE TABLE `myisam_ndb` ( + `a` int(11) DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +SHOW CREATE TABLE ndb_myisam; +Table Create Table +ndb_myisam CREATE TABLE `ndb_myisam` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE innodb_ndb; +Table Create Table +innodb_ndb CREATE TABLE `innodb_ndb` ( + `a` int(11) DEFAULT NULL +) ENGINE=ndbcluster DEFAULT CHARSET=latin1 +SHOW CREATE TABLE ndb_innodb; +Table Create Table +ndb_innodb CREATE TABLE `ndb_innodb` ( + `a` int(11) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +==== AUTOCOMMIT=0, transactions ==== +---- COMMIT ---- +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO myisam_innodb VALUES (1); +INSERT INTO myisam_innodb VALUES (2); +COMMIT; +BEGIN; +INSERT INTO innodb_myisam VALUES (3); +INSERT INTO innodb_myisam VALUES (4); +COMMIT; +BEGIN; +INSERT INTO myisam_ndb VALUES (5); +INSERT INTO myisam_ndb VALUES (6); +COMMIT; +BEGIN; +INSERT INTO ndb_myisam VALUES (7); +INSERT INTO ndb_myisam VALUES (8); +COMMIT; +BEGIN; +INSERT INTO ndb_innodb VALUES (9); +INSERT INTO ndb_innodb VALUES (10); +COMMIT; +BEGIN; +INSERT INTO innodb_ndb VALUES (11); +INSERT INTO innodb_ndb VALUES (12); +COMMIT; +---- ROLLBACK ---- +BEGIN; +INSERT INTO myisam_innodb VALUES (13); +INSERT INTO myisam_innodb VALUES (14); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO innodb_myisam VALUES (15); +INSERT INTO innodb_myisam VALUES (16); +ROLLBACK; +BEGIN; +INSERT INTO myisam_ndb VALUES (17); +INSERT INTO myisam_ndb VALUES (18); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO ndb_myisam VALUES (19); +INSERT INTO ndb_myisam VALUES (20); +ROLLBACK; +BEGIN; +INSERT INTO ndb_innodb VALUES (21); +INSERT INTO ndb_innodb VALUES (22); +ROLLBACK; +BEGIN; +INSERT INTO innodb_ndb VALUES (23); +INSERT INTO innodb_ndb VALUES (24); +ROLLBACK; +==== AUTOCOMMIT=1, transactions ==== +---- COMMIT ---- +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO myisam_innodb VALUES (25); +INSERT INTO myisam_innodb VALUES (26); +COMMIT; +BEGIN; +INSERT INTO innodb_myisam VALUES (27); +INSERT INTO innodb_myisam VALUES (28); +COMMIT; +BEGIN; +INSERT INTO myisam_ndb VALUES (29); +INSERT INTO myisam_ndb VALUES (30); +COMMIT; +BEGIN; +INSERT INTO ndb_myisam VALUES (31); +INSERT INTO ndb_myisam VALUES (32); +COMMIT; +BEGIN; +INSERT INTO ndb_innodb VALUES (33); +INSERT INTO ndb_innodb VALUES (34); +COMMIT; +BEGIN; +INSERT INTO innodb_ndb VALUES (35); +INSERT INTO innodb_ndb VALUES (36); +COMMIT; +---- ROLLBACK ---- +BEGIN; +INSERT INTO myisam_innodb VALUES (37); +INSERT INTO myisam_innodb VALUES (38); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO innodb_myisam VALUES (39); +INSERT INTO innodb_myisam VALUES (40); +ROLLBACK; +BEGIN; +INSERT INTO myisam_ndb VALUES (41); +INSERT INTO myisam_ndb VALUES (42); +ROLLBACK; +Warnings: +Warning 1196 Some non-transactional changed tables couldn't be rolled back +BEGIN; +INSERT INTO ndb_myisam VALUES (43); +INSERT INTO ndb_myisam VALUES (44); +ROLLBACK; +BEGIN; +INSERT INTO ndb_innodb VALUES (45); +INSERT INTO ndb_innodb VALUES (46); +ROLLBACK; +BEGIN; +INSERT INTO innodb_ndb VALUES (47); +INSERT INTO innodb_ndb VALUES (48); +ROLLBACK; +==== AUTOCOMMIT=1, single statements ==== +INSERT INTO myisam_innodb VALUES (49); +INSERT INTO myisam_innodb VALUES (50); +INSERT INTO innodb_myisam VALUES (51); +INSERT INTO innodb_myisam VALUES (52); +INSERT INTO myisam_ndb VALUES (53); +INSERT INTO myisam_ndb VALUES (54); +INSERT INTO ndb_myisam VALUES (55); +INSERT INTO ndb_myisam VALUES (56); +INSERT INTO ndb_innodb VALUES (57); +INSERT INTO ndb_innodb VALUES (58); +INSERT INTO innodb_ndb VALUES (59); +INSERT INTO innodb_ndb VALUES (60); +==== AUTOCOMMIT=0, single statements, myisam on master ==== +SET AUTOCOMMIT = 0; +INSERT INTO myisam_innodb VALUES (61); +INSERT INTO myisam_innodb VALUES (62); +INSERT INTO myisam_ndb VALUES (63); +INSERT INTO myisam_ndb VALUES (64); +==== Show results ==== +SELECT * FROM myisam_innodb ORDER BY a; +a +1 +2 +13 +14 +25 +26 +37 +38 +49 +50 +61 +62 +SELECT * FROM innodb_myisam ORDER BY a; +a +3 +4 +27 +28 +51 +52 +SELECT * FROM myisam_ndb ORDER BY a; +a +5 +6 +17 +18 +29 +30 +41 +42 +53 +54 +63 +64 +SELECT * FROM ndb_myisam ORDER BY a; +a +7 +8 +31 +32 +55 +56 +SELECT * FROM innodb_ndb ORDER BY a; +a +11 +12 +35 +36 +59 +60 +SELECT * FROM ndb_innodb ORDER BY a; +a +9 +10 +33 +34 +57 +58 +Comparing tables master:test.myisam_innodb and slave:test.myisam_innodb +Comparing tables master:test.innodb_myisam and slave:test.innodb_myisam +Comparing tables master:test.myisam_ndb and slave:test.myisam_ndb +Comparing tables master:test.ndb_myisam and slave:test.ndb_myisam +Comparing tables master:test.innodb_ndb and slave:test.innodb_ndb +Comparing tables master:test.ndb_innodb and slave:test.ndb_innodb +==== Clean up ==== +drop table myisam_innodb, innodb_myisam; +drop table myisam_ndb, ndb_myisam; +drop table innodb_ndb, ndb_innodb; diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt new file mode 100644 index 00000000000..b74354b22e1 --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-master.opt @@ -0,0 +1 @@ +--innodb --ndbcluster diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt new file mode 100644 index 00000000000..bbb86b2991b --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables-slave.opt @@ -0,0 +1 @@ +--innodb --ndbcluster --replicate-ignore-table=mysql.ndb_apply_status diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test new file mode 100644 index 00000000000..7d7cd5770cf --- /dev/null +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test @@ -0,0 +1,349 @@ +# ==== Purpose ==== +# +# Test replication of transactions on tables which have different +# engines on master and slave. This tests all combinations of innodb, +# myisam, and ndb. +# +# ==== Method ==== +# +# Set up six tables, each being innodb, myisam, or innodb on master, +# and another of innodb, myisam, or innodb on slave. For each table, +# do the following: +# +# - committed and rollback'ed transactions, with autocommit on and +# off +# - non-transactions with autocommit on +# - non-transactions with autocommit off, where the master table is +# myisam. +# +# Note: we are running the slave with +# --replicate-ignore-table=mysql.ndb_apply_status . See BUG#34557 for +# explanation. +# +# ==== Related bugs ==== +# +# BUG#26395: if crash during autocommit update to transactional table on master, slave fails +# BUG#29288: myisam transactions replicated to a transactional slave leaves slave unstable +# BUG#34557: Row-based replication from ndb to non-ndb gives error on slave +# BUG#34600: Rolled-back punch transactions not replicated correctly +# +# ==== Todo ==== +# +# We should eventually try transactions touching two tables which are +# of different engines on the same server (so that we try, e.g. punch +# transactions; cf BUG#34600). However, that will make the test much +# bigger (9 master-slave engine combinations [myisam->myisam, +# myisam->ndb, etc]. To try all combinations of one or more such +# tables means 2^9-1=511 transactions. We need to multiplied by 5 +# since we want to test committed/rollback'ed transactions +# with/without AUTOCOMMIT, as well as non-transactions with +# autocommit). We'd have to write a script to produce the test case. + + +--echo ==== Initialization ==== + +--source include/have_ndb.inc +--source include/have_innodb.inc +--source include/ndb_master-slave.inc + +--echo ---- setup master ---- + +CREATE TABLE myisam_innodb (a INT) ENGINE=MYISAM; +CREATE TABLE innodb_myisam (a INT) ENGINE=INNODB; +CREATE TABLE myisam_ndb (a INT) ENGINE=MYISAM; +CREATE TABLE ndb_myisam (a INT) ENGINE=NDB; +CREATE TABLE innodb_ndb (a INT) ENGINE=INNODB; +CREATE TABLE ndb_innodb (a INT) ENGINE=NDB; + +SHOW CREATE TABLE myisam_innodb; +SHOW CREATE TABLE innodb_myisam; +SHOW CREATE TABLE myisam_ndb; +SHOW CREATE TABLE ndb_myisam; +SHOW CREATE TABLE innodb_ndb; +SHOW CREATE TABLE ndb_innodb; + +--echo ---- setup slave with different engines ---- + +sync_slave_with_master; + +DROP TABLE myisam_innodb, innodb_myisam; +DROP TABLE myisam_ndb, ndb_myisam; +DROP TABLE innodb_ndb, ndb_innodb; + +CREATE TABLE myisam_innodb (a INT) ENGINE=INNODB; +CREATE TABLE innodb_myisam (a INT) ENGINE=MYISAM; +CREATE TABLE myisam_ndb (a INT) ENGINE=NDB; +CREATE TABLE ndb_myisam (a INT) ENGINE=MYISAM; +CREATE TABLE innodb_ndb (a INT) ENGINE=NDB; +CREATE TABLE ndb_innodb (a INT) ENGINE=INNODB; + +SHOW CREATE TABLE myisam_innodb; +SHOW CREATE TABLE innodb_myisam; +SHOW CREATE TABLE myisam_ndb; +SHOW CREATE TABLE ndb_myisam; +SHOW CREATE TABLE innodb_ndb; +SHOW CREATE TABLE ndb_innodb; + +connection master; + + +--echo ==== AUTOCOMMIT=0, transactions ==== + +--echo ---- COMMIT ---- + +SET AUTOCOMMIT = 0; + +BEGIN; +INSERT INTO myisam_innodb VALUES (1); +INSERT INTO myisam_innodb VALUES (2); +COMMIT; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO innodb_myisam VALUES (3); +INSERT INTO innodb_myisam VALUES (4); +COMMIT; +sync_slave_with_master; +connection master; + +BEGIN; +INSERT INTO myisam_ndb VALUES (5); +INSERT INTO myisam_ndb VALUES (6); +COMMIT; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO ndb_myisam VALUES (7); +INSERT INTO ndb_myisam VALUES (8); +COMMIT; +sync_slave_with_master; +connection master; + +BEGIN; +INSERT INTO ndb_innodb VALUES (9); +INSERT INTO ndb_innodb VALUES (10); +COMMIT; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO innodb_ndb VALUES (11); +INSERT INTO innodb_ndb VALUES (12); +COMMIT; +sync_slave_with_master; +connection master; + +--echo ---- ROLLBACK ---- + +BEGIN; +INSERT INTO myisam_innodb VALUES (13); +INSERT INTO myisam_innodb VALUES (14); +ROLLBACK; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO innodb_myisam VALUES (15); +INSERT INTO innodb_myisam VALUES (16); +ROLLBACK; +sync_slave_with_master; +connection master; + +BEGIN; +INSERT INTO myisam_ndb VALUES (17); +INSERT INTO myisam_ndb VALUES (18); +ROLLBACK; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO ndb_myisam VALUES (19); +INSERT INTO ndb_myisam VALUES (20); +ROLLBACK; +sync_slave_with_master; +connection master; + +BEGIN; +INSERT INTO ndb_innodb VALUES (21); +INSERT INTO ndb_innodb VALUES (22); +ROLLBACK; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO innodb_ndb VALUES (23); +INSERT INTO innodb_ndb VALUES (24); +ROLLBACK; +sync_slave_with_master; +connection master; + + +--echo ==== AUTOCOMMIT=1, transactions ==== + +--echo ---- COMMIT ---- + +SET AUTOCOMMIT = 1; + +BEGIN; +INSERT INTO myisam_innodb VALUES (25); +INSERT INTO myisam_innodb VALUES (26); +COMMIT; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO innodb_myisam VALUES (27); +INSERT INTO innodb_myisam VALUES (28); +COMMIT; +sync_slave_with_master; +connection master; + +BEGIN; +INSERT INTO myisam_ndb VALUES (29); +INSERT INTO myisam_ndb VALUES (30); +COMMIT; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO ndb_myisam VALUES (31); +INSERT INTO ndb_myisam VALUES (32); +COMMIT; +sync_slave_with_master; +connection master; + +BEGIN; +INSERT INTO ndb_innodb VALUES (33); +INSERT INTO ndb_innodb VALUES (34); +COMMIT; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO innodb_ndb VALUES (35); +INSERT INTO innodb_ndb VALUES (36); +COMMIT; +sync_slave_with_master; +connection master; + +--echo ---- ROLLBACK ---- + +BEGIN; +INSERT INTO myisam_innodb VALUES (37); +INSERT INTO myisam_innodb VALUES (38); +ROLLBACK; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO innodb_myisam VALUES (39); +INSERT INTO innodb_myisam VALUES (40); +ROLLBACK; +sync_slave_with_master; +connection master; + +BEGIN; +INSERT INTO myisam_ndb VALUES (41); +INSERT INTO myisam_ndb VALUES (42); +ROLLBACK; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO ndb_myisam VALUES (43); +INSERT INTO ndb_myisam VALUES (44); +ROLLBACK; +sync_slave_with_master; +connection master; + +BEGIN; +INSERT INTO ndb_innodb VALUES (45); +INSERT INTO ndb_innodb VALUES (46); +ROLLBACK; +sync_slave_with_master; +connection master; +BEGIN; +INSERT INTO innodb_ndb VALUES (47); +INSERT INTO innodb_ndb VALUES (48); +ROLLBACK; +sync_slave_with_master; +connection master; + + +--echo ==== AUTOCOMMIT=1, single statements ==== + +INSERT INTO myisam_innodb VALUES (49); +INSERT INTO myisam_innodb VALUES (50); +sync_slave_with_master; +connection master; +INSERT INTO innodb_myisam VALUES (51); +INSERT INTO innodb_myisam VALUES (52); +sync_slave_with_master; +connection master; + +INSERT INTO myisam_ndb VALUES (53); +INSERT INTO myisam_ndb VALUES (54); +sync_slave_with_master; +connection master; +INSERT INTO ndb_myisam VALUES (55); +INSERT INTO ndb_myisam VALUES (56); +sync_slave_with_master; +connection master; + +INSERT INTO ndb_innodb VALUES (57); +INSERT INTO ndb_innodb VALUES (58); +sync_slave_with_master; +connection master; +INSERT INTO innodb_ndb VALUES (59); +INSERT INTO innodb_ndb VALUES (60); +sync_slave_with_master; +connection master; + + +--echo ==== AUTOCOMMIT=0, single statements, myisam on master ==== + +SET AUTOCOMMIT = 0; + +# This tests BUG#29288. +INSERT INTO myisam_innodb VALUES (61); +INSERT INTO myisam_innodb VALUES (62); +sync_slave_with_master; +connection master; + +INSERT INTO myisam_ndb VALUES (63); +INSERT INTO myisam_ndb VALUES (64); +sync_slave_with_master; +connection master; + + +--echo ==== Show results ==== + +SELECT * FROM myisam_innodb ORDER BY a; +SELECT * FROM innodb_myisam ORDER BY a; +SELECT * FROM myisam_ndb ORDER BY a; +SELECT * FROM ndb_myisam ORDER BY a; +SELECT * FROM innodb_ndb ORDER BY a; +SELECT * FROM ndb_innodb ORDER BY a; + +let $diff_table_1=master:test.myisam_innodb; +let $diff_table_2=slave:test.myisam_innodb; +source include/diff_tables.inc; + +let $diff_table_1=master:test.innodb_myisam; +let $diff_table_2=slave:test.innodb_myisam; +source include/diff_tables.inc; + +let $diff_table_1=master:test.myisam_ndb; +let $diff_table_2=slave:test.myisam_ndb; +source include/diff_tables.inc; + +let $diff_table_1=master:test.ndb_myisam; +let $diff_table_2=slave:test.ndb_myisam; +source include/diff_tables.inc; + +let $diff_table_1=master:test.innodb_ndb; +let $diff_table_2=slave:test.innodb_ndb; +source include/diff_tables.inc; + +let $diff_table_1=master:test.ndb_innodb; +let $diff_table_2=slave:test.ndb_innodb; +source include/diff_tables.inc; + + +--echo ==== Clean up ==== + +drop table myisam_innodb, innodb_myisam; +drop table myisam_ndb, ndb_myisam; +drop table innodb_ndb, ndb_innodb; +sync_slave_with_master; diff --git a/sql/log_event.cc b/sql/log_event.cc index 0cda724b698..fb6a5230fda 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2389,13 +2389,29 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg, charset_database_number= thd_arg->variables.collation_database->number; /* - If we don't use flags2 for anything else than options contained in - thd_arg->options, it would be more efficient to flags2=thd_arg->options - (OPTIONS_WRITTEN_TO_BIN_LOG would be used only at reading time). - But it's likely that we don't want to use 32 bits for 3 bits; in the future - we will probably want to reclaim the 29 bits. So we need the &. + We only replicate over the bits of flags2 that we need: the rest + are masked out by "& OPTIONS_WRITTEN_TO_BINLOG". + + We also force AUTOCOMMIT=1. Rationale (cf. BUG#29288): After + fixing BUG#26395, we always write BEGIN and COMMIT around all + transactions (even single statements in autocommit mode). This is + so that replication from non-transactional to transactional table + and error recovery from XA to non-XA table should work as + expected. The BEGIN/COMMIT are added in log.cc. However, there is + one exception: MyISAM bypasses log.cc and writes directly to the + binlog. So if autocommit is off, master has MyISAM, and slave has + a transactional engine, then the slave will just see one long + never-ending transaction. The only way to bypass explicit + BEGIN/COMMIT in the binlog is by using a non-transactional table. + So setting AUTOCOMMIT=1 will make this work as expected. + + Note: explicitly replicate AUTOCOMMIT=1 from master. We do not + assume AUTOCOMMIT=1 on slave; the slave still reads the state of + the autocommit flag as written by the master to the binlog. This + behavior may change after WL#4162 has been implemented. */ - flags2= (uint32) (thd_arg->options & OPTIONS_WRITTEN_TO_BIN_LOG); + flags2= (uint32) (thd_arg->options & + (OPTIONS_WRITTEN_TO_BIN_LOG & ~OPTION_NOT_AUTOCOMMIT)); DBUG_ASSERT(thd_arg->variables.character_set_client->number < 256*256); DBUG_ASSERT(thd_arg->variables.collation_connection->number < 256*256); DBUG_ASSERT(thd_arg->variables.collation_server->number < 256*256); From 8f35f7c907992c77b1bda584956cf8acf97e88d5 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Wed, 23 Sep 2009 13:20:48 +0200 Subject: [PATCH 33/88] Bug #37221: SET AUTOCOMMIT=1 does not commit binary log When setting AUTOCOMMIT=1 after starting a transaction, the binary log did not commit the outstanding transaction. The reason was that the binary log commit function saw the values of the new settings, deciding that there were nothing to commit. Fixed the problem by moving the implicit commit to before the thread option flags were changed, so that the binary log sees the old values of the flags instead of the values they will take after the statement. --- mysql-test/extra/binlog_tests/implicit.test | 28 ++ .../binlog/r/binlog_implicit_commit.result | 345 ++++++++++++++++++ .../binlog/t/binlog_implicit_commit.test | 63 ++++ sql/set_var.cc | 11 +- 4 files changed, 445 insertions(+), 2 deletions(-) create mode 100644 mysql-test/extra/binlog_tests/implicit.test create mode 100644 mysql-test/suite/binlog/r/binlog_implicit_commit.result create mode 100644 mysql-test/suite/binlog/t/binlog_implicit_commit.test diff --git a/mysql-test/extra/binlog_tests/implicit.test b/mysql-test/extra/binlog_tests/implicit.test new file mode 100644 index 00000000000..84d80288d36 --- /dev/null +++ b/mysql-test/extra/binlog_tests/implicit.test @@ -0,0 +1,28 @@ +# First part: outside a transaction +RESET MASTER; +eval $prepare; + +INSERT INTO t1 VALUES (1); +source include/show_binlog_events.inc; +eval $statement; +source include/show_binlog_events.inc; +if (`select '$cleanup' != ''`) { + eval $cleanup; +} + +# Second part: inside a transaction +RESET MASTER; +eval $prepare; +BEGIN; +INSERT INTO t1 VALUES (2); +source include/show_binlog_events.inc; +eval $statement; +source include/show_binlog_events.inc; +INSERT INTO t1 VALUES (3); +source include/show_binlog_events.inc; +COMMIT; +source include/show_binlog_events.inc; +if (`select '$cleanup' != ''`) { + eval $cleanup; +} + diff --git a/mysql-test/suite/binlog/r/binlog_implicit_commit.result b/mysql-test/suite/binlog/r/binlog_implicit_commit.result new file mode 100644 index 00000000000..ea43b31bde9 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_implicit_commit.result @@ -0,0 +1,345 @@ +CREATE TABLE t1 (id INT) ENGINE = InnoDB; +SET BINLOG_FORMAT = STATEMENT; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Xid # # COMMIT /* XID */ +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +SET BINLOG_FORMAT = ROW; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 1; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 1; +BEGIN; +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +SET AUTOCOMMIT = 0; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +INSERT INTO t1 VALUES (3); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +LOCK TABLES t1 WRITE; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +INSERT INTO t1 VALUES (2); +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +UNLOCK TABLES; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +COMMIT; +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Xid # # COMMIT /* XID */ +DROP TABLE t1; diff --git a/mysql-test/suite/binlog/t/binlog_implicit_commit.test b/mysql-test/suite/binlog/t/binlog_implicit_commit.test new file mode 100644 index 00000000000..a682ab95e3d --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_implicit_commit.test @@ -0,0 +1,63 @@ +# The purpose of this test is to test that setting autocommit does a +# commit of outstanding transactions and nothing is left pending in +# the transaction cache. + +source include/have_log_bin.inc; +source include/have_innodb.inc; + +# We need a transactional engine, so let's use InnoDB +CREATE TABLE t1 (id INT) ENGINE = InnoDB; + +# Testing SET AUTOCOMMIT +SET BINLOG_FORMAT = STATEMENT; + +let $cleanup = COMMIT; + +let $prepare = SET AUTOCOMMIT = 0; +let $statement = SET AUTOCOMMIT = 1; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 1; +let $statement = SET AUTOCOMMIT = 1; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 0; +let $statement = SET AUTOCOMMIT = 0; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 1; +let $statement = SET AUTOCOMMIT = 0; +source extra/binlog_tests/implicit.test; + +SET BINLOG_FORMAT = ROW; +let $prepare = SET AUTOCOMMIT = 0; +let $statement = SET AUTOCOMMIT = 1; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 1; +let $statement = SET AUTOCOMMIT = 1; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 0; +let $statement = SET AUTOCOMMIT = 0; +source extra/binlog_tests/implicit.test; + +let $prepare = SET AUTOCOMMIT = 1; +let $statement = SET AUTOCOMMIT = 0; +source extra/binlog_tests/implicit.test; + +RESET MASTER; +SET AUTOCOMMIT = 0; +INSERT INTO t1 VALUES (1); +source include/show_binlog_events.inc; +LOCK TABLES t1 WRITE; +source include/show_binlog_events.inc; +INSERT INTO t1 VALUES (2); +source include/show_binlog_events.inc; +UNLOCK TABLES; +source include/show_binlog_events.inc; +COMMIT; +source include/show_binlog_events.inc; + +# Cleaning up +DROP TABLE t1; diff --git a/sql/set_var.cc b/sql/set_var.cc index 0b89333ce03..5025356230c 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -3054,6 +3054,15 @@ static bool set_option_autocommit(THD *thd, set_var *var) ulonglong org_options= thd->options; + /* + If we are setting AUTOCOMMIT=1 and it was not already 1, then we + need to commit any outstanding transactions. + */ + if (var->save_result.ulong_value != 0 && + (thd->options & OPTION_NOT_AUTOCOMMIT) && + ha_commit(thd)) + return 1; + if (var->save_result.ulong_value != 0) thd->options&= ~((sys_var_thd_bit*) var->var)->bit_flag; else @@ -3067,8 +3076,6 @@ static bool set_option_autocommit(THD *thd, set_var *var) thd->options&= ~(ulonglong) (OPTION_BEGIN | OPTION_KEEP_LOG); thd->transaction.all.modified_non_trans_table= FALSE; thd->server_status|= SERVER_STATUS_AUTOCOMMIT; - if (ha_commit(thd)) - return 1; } else { From 4ad8ef060260885f6cb64c50f187a33826dee664 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Wed, 23 Sep 2009 23:32:31 +0200 Subject: [PATCH 34/88] WL#5016: Fix header file include guards Adding header include file guards to files that are missing such. --- client/my_readline.h | 5 +++++ client/sql_string.h | 5 +++++ include/atomic/gcc_builtins.h | 5 +++++ include/atomic/nolock.h | 4 ++++ include/atomic/rwlock.h | 4 ++++ include/atomic/x86-gcc.h | 4 ++++ include/config-win.h | 5 +++++ include/errmsg.h | 4 ++++ include/help_end.h | 4 ++++ include/help_start.h | 4 ++++ include/my_aes.h | 5 +++++ include/my_atomic.h | 4 ++++ include/my_bit.h | 5 +++++ include/my_libwrap.h | 4 ++++ include/my_md5.h | 5 +++++ include/my_no_pthread.h | 8 +++++--- include/my_uctype.h | 4 ++++ include/myisampack.h | 4 ++++ include/mysql_embed.h | 4 ++++ include/rijndael.h | 5 +++++ include/sha1.h | 5 +++++ include/sql_common.h | 4 ++++ include/sslopt-case.h | 4 ++++ include/sslopt-longopts.h | 4 ++++ include/sslopt-vars.h | 4 ++++ libmysql/client_settings.h | 6 ++++++ mysys/my_handler_errors.h | 3 +++ mysys/my_static.h | 5 +++++ sql/authors.h | 5 +++++ sql/client_settings.h | 6 ++++++ sql/contributors.h | 5 +++++ sql/field.h | 5 +++++ sql/gstream.h | 5 +++++ sql/ha_ndbcluster.h | 5 +++++ sql/ha_ndbcluster_binlog.h | 5 +++++ sql/ha_ndbcluster_cond.h | 5 +++++ sql/ha_ndbcluster_tables.h | 5 +++++ sql/ha_partition.h | 5 +++++ sql/handler.h | 4 ++++ sql/item.h | 5 +++++ sql/item_cmpfunc.h | 5 +++++ sql/item_func.h | 4 ++++ sql/item_geofunc.h | 4 ++++ sql/item_row.h | 5 +++++ sql/item_strfunc.h | 4 ++++ sql/item_subselect.h | 5 ++++- sql/item_sum.h | 5 +++++ sql/item_timefunc.h | 5 +++++ sql/item_xmlfunc.h | 4 ++++ sql/lex.h | 5 +++++ sql/message.h | 7 +++++++ sql/mysqld_suffix.h | 4 ++++ sql/nt_servc.h | 5 +++++ sql/partition_element.h | 5 +++++ sql/partition_info.h | 5 +++++ sql/procedure.h | 5 +++++ sql/protocol.h | 4 ++++ sql/repl_failsafe.h | 4 ++++ sql/scheduler.h | 5 +++++ sql/set_var.h | 5 +++++ sql/sql_acl.h | 4 ++++ sql/sql_analyse.h | 5 +++++ sql/sql_array.h | 4 ++++ sql/sql_class.h | 4 ++++ sql/sql_crypt.h | 5 +++++ sql/sql_lex.h | 4 ++++ sql/sql_map.h | 5 +++++ sql/sql_partition.h | 4 ++++ sql/sql_repl.h | 4 ++++ sql/sql_select.h | 4 ++++ sql/sql_servers.h | 5 +++++ sql/sql_sort.h | 5 +++++ sql/sql_string.h | 5 +++++ sql/sql_trigger.h | 4 ++++ sql/sql_udf.h | 4 ++++ sql/sql_view.h | 4 ++++ sql/structs.h | 5 +++++ sql/table.h | 4 ++++ sql/tzfile.h | 5 +++++ sql/tztime.h | 4 ++++ sql/unireg.h | 5 +++-- strings/strings-not-used.h | 4 ++++ vio/vio_priv.h | 4 ++++ 83 files changed, 377 insertions(+), 6 deletions(-) diff --git a/client/my_readline.h b/client/my_readline.h index 62ad19bece9..08cff565819 100644 --- a/client/my_readline.h +++ b/client/my_readline.h @@ -1,3 +1,6 @@ +#ifndef CLIENT_MY_READLINE_INCLUDED +#define CLIENT_MY_READLINE_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -31,3 +34,5 @@ extern LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file); extern LINE_BUFFER *batch_readline_command(LINE_BUFFER *buffer, char * str); extern char *batch_readline(LINE_BUFFER *buffer, bool *truncated); extern void batch_readline_end(LINE_BUFFER *buffer); + +#endif /* CLIENT_MY_READLINE_INCLUDED */ diff --git a/client/sql_string.h b/client/sql_string.h index da19c1ccfe5..0e6d6da4476 100644 --- a/client/sql_string.h +++ b/client/sql_string.h @@ -1,3 +1,6 @@ +#ifndef CLIENT_SQL_STRING_INCLUDED +#define CLIENT_SQL_STRING_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -353,3 +356,5 @@ public: return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length); } }; + +#endif /* CLIENT_SQL_STRING_INCLUDED */ diff --git a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h index 509701b30a5..01ebc38707e 100644 --- a/include/atomic/gcc_builtins.h +++ b/include/atomic/gcc_builtins.h @@ -1,3 +1,6 @@ +#ifndef ATOMIC_GCC_BUILTINS_INCLUDED +#define ATOMIC_GCC_BUILTINS_INCLUDED + /* Copyright (C) 2008 MySQL AB This program is free software; you can redistribute it and/or modify @@ -31,3 +34,5 @@ #define make_atomic_store_body(S) \ (void) __sync_lock_test_and_set(a, v); #endif + +#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */ diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h index 10ac17884b6..2c652fd52c1 100644 --- a/include/atomic/nolock.h +++ b/include/atomic/nolock.h @@ -1,3 +1,6 @@ +#ifndef ATOMIC_NOLOCK_INCLUDED +#define ATOMIC_NOLOCK_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -42,3 +45,4 @@ typedef struct { } my_atomic_rwlock_t; #endif +#endif /* ATOMIC_NOLOCK_INCLUDED */ diff --git a/include/atomic/rwlock.h b/include/atomic/rwlock.h index 18b77e93d80..0ff4d16c545 100644 --- a/include/atomic/rwlock.h +++ b/include/atomic/rwlock.h @@ -1,3 +1,6 @@ +#ifndef ATOMIC_RWLOCK_INCLUDED +#define ATOMIC_RWLOCK_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -46,3 +49,4 @@ typedef struct {pthread_rwlock_t rw;} my_atomic_rwlock_t; #define make_atomic_load_body(S) ret= *a; #define make_atomic_store_body(S) *a= v; +#endif /* ATOMIC_RWLOCK_INCLUDED */ diff --git a/include/atomic/x86-gcc.h b/include/atomic/x86-gcc.h index d79dadbf05e..d8afa5bfbf1 100644 --- a/include/atomic/x86-gcc.h +++ b/include/atomic/x86-gcc.h @@ -1,3 +1,6 @@ +#ifndef ATOMIC_X86_GCC_INCLUDED +#define ATOMIC_X86_GCC_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -56,3 +59,4 @@ asm volatile ("; xchg %0, %1;" : "+m" (*a) : "r" (v)) #endif +#endif /* ATOMIC_X86_GCC_INCLUDED */ diff --git a/include/config-win.h b/include/config-win.h index af4915440b1..c00e26866b9 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -1,3 +1,6 @@ +#ifndef CONFIG_WIN_INCLUDED +#define CONFIG_WIN_INCLUDED + /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -410,3 +413,5 @@ inline ulonglong double2ulonglong(double d) #define HAVE_UCA_COLLATIONS 1 #define HAVE_BOOL 1 + +#endif /* CONFIG_WIN_INCLUDED */ diff --git a/include/errmsg.h b/include/errmsg.h index a6d8c770de8..5754e99ba5e 100644 --- a/include/errmsg.h +++ b/include/errmsg.h @@ -1,3 +1,6 @@ +#ifndef ERRMSG_INCLUDED +#define ERRMSG_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -100,3 +103,4 @@ extern const char *client_errors[]; /* Error messages */ #define CR_ERROR_LAST /*Copy last error nr:*/ 2057 /* Add error numbers before CR_ERROR_LAST and change it accordingly. */ +#endif /* ERRMSG_INCLUDED */ diff --git a/include/help_end.h b/include/help_end.h index 4426cb80bce..92953efe35a 100644 --- a/include/help_end.h +++ b/include/help_end.h @@ -1,3 +1,6 @@ +#ifndef HELP_END_INCLUDED +#define HELP_END_INCLUDED + /* Copyright (C) 2004-2005 MySQL AB This program is free software; you can redistribute it and/or modify @@ -20,3 +23,4 @@ #undef fputc #undef putchar #endif +#endif /* HELP_END_INCLUDED */ diff --git a/include/help_start.h b/include/help_start.h index 3ae20eea7d7..414f7ec93a0 100644 --- a/include/help_start.h +++ b/include/help_start.h @@ -1,3 +1,6 @@ +#ifndef HELP_START_INCLUDED +#define HELP_START_INCLUDED + /* Copyright (C) 2004-2005 MySQL AB This program is free software; you can redistribute it and/or modify @@ -22,3 +25,4 @@ #define fputc(s,f) consoleprintf("%c", s) #define putchar(s) consoleprintf("%c", s) #endif +#endif /* HELP_START_INCLUDED */ diff --git a/include/my_aes.h b/include/my_aes.h index 1bbdf5663ea..2e2a66b4968 100644 --- a/include/my_aes.h +++ b/include/my_aes.h @@ -1,3 +1,6 @@ +#ifndef MY_AES_INCLUDED +#define MY_AES_INCLUDED + /* Copyright (C) 2002 MySQL AB This program is free software; you can redistribute it and/or modify @@ -63,3 +66,5 @@ int my_aes_decrypt(const char *source, int source_length, char *dest, int my_aes_get_size(int source_length); C_MODE_END + +#endif /* MY_AES_INCLUDED */ diff --git a/include/my_atomic.h b/include/my_atomic.h index ed439e5fe87..8481b8e6d5a 100644 --- a/include/my_atomic.h +++ b/include/my_atomic.h @@ -1,3 +1,6 @@ +#ifndef MY_ATOMIC_INCLUDED +#define MY_ATOMIC_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -140,3 +143,4 @@ extern int my_atomic_initialize(); #endif +#endif /* MY_ATOMIC_INCLUDED */ diff --git a/include/my_bit.h b/include/my_bit.h index 2e464e89049..5cbf4f8b83e 100644 --- a/include/my_bit.h +++ b/include/my_bit.h @@ -1,3 +1,6 @@ +#ifndef MY_BIT_INCLUDED +#define MY_BIT_INCLUDED + /* Some useful bit functions */ @@ -107,3 +110,5 @@ extern uint my_count_bits(ulonglong v); extern uint my_count_bits_ushort(ushort v); #endif /* HAVE_INLINE */ C_MODE_END + +#endif /* MY_BIT_INCLUDED */ diff --git a/include/my_libwrap.h b/include/my_libwrap.h index 9a8579475fb..8235c00d8f3 100644 --- a/include/my_libwrap.h +++ b/include/my_libwrap.h @@ -1,3 +1,6 @@ +#ifndef MY_LIBWRAP_INCLUDED +#define MY_LIBWRAP_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -25,3 +28,4 @@ extern int my_hosts_access(struct request_info *req); extern char *my_eval_client(struct request_info *req); #endif /* HAVE_LIBWRAP */ +#endif /* MY_LIBWRAP_INCLUDED */ diff --git a/include/my_md5.h b/include/my_md5.h index 6458f27c5cc..782bef8a27a 100644 --- a/include/my_md5.h +++ b/include/my_md5.h @@ -1,3 +1,6 @@ +#ifndef MY_MD5_INCLUDED +#define MY_MD5_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -52,3 +55,5 @@ do { \ my_MD5Update (&ctx, buf, len); \ my_MD5Final (digest, &ctx); \ } while (0) + +#endif /* MY_MD__INCLUDED */ diff --git a/include/my_no_pthread.h b/include/my_no_pthread.h index b11dbff42f0..31c1bf2b6ac 100644 --- a/include/my_no_pthread.h +++ b/include/my_no_pthread.h @@ -1,3 +1,6 @@ +#ifndef MY_NO_PTHREAD_INCLUDED +#define MY_NO_PTHREAD_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -14,9 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#if !defined(_my_no_pthread_h) && !defined(THREAD) -#define _my_no_pthread_h - +#ifndef THREAD /* This block is to access some thread-related type definitions @@ -48,3 +49,4 @@ #define rwlock_destroy(A) #endif +#endif /* MY_NO_PTHREAD_INCLUDED */ diff --git a/include/my_uctype.h b/include/my_uctype.h index 9aaf478810c..580eb646e11 100644 --- a/include/my_uctype.h +++ b/include/my_uctype.h @@ -1,3 +1,6 @@ +#ifndef MY_UCTYPE_INCLUDED +#define MY_UCTYPE_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -1477,3 +1480,4 @@ MY_UNI_CTYPE my_uni_ctype[256]={ }; +#endif /* MY_UCTYPE_INCLUDED */ diff --git a/include/myisampack.h b/include/myisampack.h index 7d4871bd1cb..ecf35520a88 100644 --- a/include/myisampack.h +++ b/include/myisampack.h @@ -1,3 +1,6 @@ +#ifndef MYISAMPACK_INCLUDED +#define MYISAMPACK_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -236,3 +239,4 @@ mi_int4store(((T) + 4), A); }} #define mi_sizekorr(T) mi_uint4korr((uchar*) (T) + 4) #endif +#endif /* MYISAMPACK_INCLUDED */ diff --git a/include/mysql_embed.h b/include/mysql_embed.h index 4a7fd3ef63c..0e5a360585e 100644 --- a/include/mysql_embed.h +++ b/include/mysql_embed.h @@ -1,3 +1,6 @@ +#ifndef MYSQL_EMBED_INCLUDED +#define MYSQL_EMBED_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -28,3 +31,4 @@ #define DONT_USE_RAID #endif /* EMBEDDED_LIBRARY */ +#endif /* MYSQL_EMBED_INCLUDED */ diff --git a/include/rijndael.h b/include/rijndael.h index 89963a85c99..71df1c48dbf 100644 --- a/include/rijndael.h +++ b/include/rijndael.h @@ -1,3 +1,6 @@ +#ifndef RIJNDAEL_INCLUDED +#define RIJNDAEL_INCLUDED + /* Copyright (C) 2002 MySQL AB This program is free software; you can redistribute it and/or modify @@ -39,3 +42,5 @@ void rijndaelEncrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, const uint8 pt[16], uint8 ct[16]); void rijndaelDecrypt(const uint32 rk[/*4*(Nr + 1)*/], int Nr, const uint8 ct[16], uint8 pt[16]); + +#endif /* RIJNDAEL_INCLUDED */ diff --git a/include/sha1.h b/include/sha1.h index e476456a9bd..5b4dc5d46ed 100644 --- a/include/sha1.h +++ b/include/sha1.h @@ -1,3 +1,6 @@ +#ifndef SHA1_INCLUDED +#define SHA1_INCLUDED + /* Copyright (C) 2002, 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -64,3 +67,5 @@ int mysql_sha1_input(SHA1_CONTEXT*, const uint8 *, unsigned int); int mysql_sha1_result(SHA1_CONTEXT* , uint8 Message_Digest[SHA1_HASH_SIZE]); C_MODE_END + +#endif /* SHA__INCLUDED */ diff --git a/include/sql_common.h b/include/sql_common.h index 9e43d076ba9..5fd8778d62b 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -1,3 +1,6 @@ +#ifndef SQL_COMMON_INCLUDED +#define SQL_COMMON_INCLUDED + /* Copyright (C) 2003-2004, 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -48,3 +51,4 @@ void set_mysql_error(MYSQL *mysql, int errcode, const char *sqlstate); #define protocol_41(A) ((A)->server_capabilities & CLIENT_PROTOCOL_41) +#endif /* SQL_COMMON_INCLUDED */ diff --git a/include/sslopt-case.h b/include/sslopt-case.h index adb9a28503b..ce46cf65cc9 100644 --- a/include/sslopt-case.h +++ b/include/sslopt-case.h @@ -1,3 +1,6 @@ +#ifndef SSLOPT_CASE_INCLUDED +#define SSLOPT_CASE_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -26,3 +29,4 @@ opt_use_ssl= 1; break; #endif +#endif /* SSLOPT_CASE_INCLUDED */ diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h index c76b5dcd252..eae1424238b 100644 --- a/include/sslopt-longopts.h +++ b/include/sslopt-longopts.h @@ -1,3 +1,6 @@ +#ifndef SSLOPT_LONGOPTS_INCLUDED +#define SSLOPT_LONGOPTS_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -43,3 +46,4 @@ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif #endif /* HAVE_OPENSSL */ +#endif /* SSLOPT_LONGOPTS_INCLUDED */ diff --git a/include/sslopt-vars.h b/include/sslopt-vars.h index 3369f870db2..4493fbc59ab 100644 --- a/include/sslopt-vars.h +++ b/include/sslopt-vars.h @@ -1,3 +1,6 @@ +#ifndef SSLOPT_VARS_INCLUDED +#define SSLOPT_VARS_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -29,3 +32,4 @@ SSL_STATIC char *opt_ssl_key = 0; SSL_STATIC my_bool opt_ssl_verify_server_cert= 0; #endif #endif +#endif /* SSLOPT_VARS_INCLUDED */ diff --git a/libmysql/client_settings.h b/libmysql/client_settings.h index f87e625771f..1fd8619a746 100644 --- a/libmysql/client_settings.h +++ b/libmysql/client_settings.h @@ -13,6 +13,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef CLIENT_SETTINGS_INCLUDED +#define CLIENT_SETTINGS_INCLUDED +#else +#error You have already included an client_settings.h and it should not be included twice +#endif /* CLIENT_SETTINGS_INCLUDED */ + extern uint mysql_port; extern char * mysql_unix_port; diff --git a/mysys/my_handler_errors.h b/mysys/my_handler_errors.h index c239cabb168..e4e62f47fed 100644 --- a/mysys/my_handler_errors.h +++ b/mysys/my_handler_errors.h @@ -1,3 +1,5 @@ +#ifndef MYSYS_MY_HANDLER_ERRORS_INCLUDED +#define MYSYS_MY_HANDLER_ERRORS_INCLUDED /* Errors a handler can give you @@ -66,3 +68,4 @@ static const char *handler_error_messages[]= "Too many active concurrent transactions" }; +#endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */ diff --git a/mysys/my_static.h b/mysys/my_static.h index 90168b099a8..c336115bc35 100644 --- a/mysys/my_static.h +++ b/mysys/my_static.h @@ -1,3 +1,6 @@ +#ifndef MYSYS_MY_STATIC_INCLUDED +#define MYSYS_MY_STATIC_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -72,3 +75,5 @@ extern ulonglong query_performance_frequency, query_performance_offset; extern sigset_t my_signals; /* signals blocked by mf_brkhant */ #endif C_MODE_END + +#endif /* MYSYS_MY_STATIC_INCLUDED */ diff --git a/sql/authors.h b/sql/authors.h index dfe3b143e2f..90cdae9c0a0 100644 --- a/sql/authors.h +++ b/sql/authors.h @@ -1,3 +1,6 @@ +#ifndef AUTHORS_INCLUDED +#define AUTHORS_INCLUDED + /* Copyright (C) 2005-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -150,3 +153,5 @@ struct show_table_authors_st show_table_authors[]= { "SHA1(), AES_ENCRYPT(), AES_DECRYPT(), bug fixing" }, {NULL, NULL, NULL} }; + +#endif /* AUTHORS_INCLUDED */ diff --git a/sql/client_settings.h b/sql/client_settings.h index 4f06c15a29e..fd50bfdbb88 100644 --- a/sql/client_settings.h +++ b/sql/client_settings.h @@ -14,6 +14,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef CLIENT_SETTINGS_INCLUDED +#define CLIENT_SETTINGS_INCLUDED +#else +#error You have already included an client_settings.h and it should not be included twice +#endif /* CLIENT_SETTINGS_INCLUDED */ + #include #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | \ diff --git a/sql/contributors.h b/sql/contributors.h index 87001e29d88..6cf8bb88e3b 100644 --- a/sql/contributors.h +++ b/sql/contributors.h @@ -1,3 +1,6 @@ +#ifndef CONTRIBUTORS_INCLUDED +#define CONTRIBUTORS_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -37,3 +40,5 @@ struct show_table_contributors_st show_table_contributors[]= { {"Mark Shuttleworth", "London, UK.", "EFF contribution for UC2006 Auction"}, {NULL, NULL, NULL} }; + +#endif /* CONTRIBUTORS_INCLUDED */ diff --git a/sql/field.h b/sql/field.h index a9299256f88..36569428ee0 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1,3 +1,6 @@ +#ifndef FIELD_INCLUDED +#define FIELD_INCLUDED + /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -2180,3 +2183,5 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions); #define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT) #define f_bit_as_char(x) ((x) & FIELDFLAG_TREAT_BIT_AS_CHAR) #define f_is_hex_escape(x) ((x) & FIELDFLAG_HEX_ESCAPE) + +#endif /* FIELD_INCLUDED */ diff --git a/sql/gstream.h b/sql/gstream.h index 1ef90ad5bf0..ea7158ee1a3 100644 --- a/sql/gstream.h +++ b/sql/gstream.h @@ -1,3 +1,6 @@ +#ifndef GSTREAM_INCLUDED +#define GSTREAM_INCLUDED + /* Copyright (C) 2000-2004 MySQL AB This program is free software; you can redistribute it and/or modify @@ -73,3 +76,5 @@ protected: char *m_err_msg; CHARSET_INFO *m_charset; }; + +#endif /* GSTREAM_INCLUDED */ diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h index a17323d3fd6..662655c42b9 100644 --- a/sql/ha_ndbcluster.h +++ b/sql/ha_ndbcluster.h @@ -1,3 +1,6 @@ +#ifndef HA_NDBCLUSTER_INCLUDED +#define HA_NDBCLUSTER_INCLUDED + /* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify @@ -581,3 +584,5 @@ static const int ndbcluster_hton_name_length=sizeof(ndbcluster_hton_name)-1; extern int ndbcluster_terminating; extern int ndb_util_thread_running; extern pthread_cond_t COND_ndb_util_ready; + +#endif /* HA_NDBCLUSTER_INCLUDED */ diff --git a/sql/ha_ndbcluster_binlog.h b/sql/ha_ndbcluster_binlog.h index 1cad643e5ec..d80dfe9ee74 100644 --- a/sql/ha_ndbcluster_binlog.h +++ b/sql/ha_ndbcluster_binlog.h @@ -1,3 +1,6 @@ +#ifndef HA_NDBCLUSTER_BINLOG_INCLUDED +#define HA_NDBCLUSTER_BINLOG_INCLUDED + /* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify @@ -225,3 +228,5 @@ set_thd_ndb(THD *thd, Thd_ndb *thd_ndb) { thd_set_ha_data(thd, ndbcluster_hton, thd_ndb); } Ndb* check_ndb_in_thd(THD* thd); + +#endif /* HA_NDBCLUSTER_BINLOG_INCLUDED */ diff --git a/sql/ha_ndbcluster_cond.h b/sql/ha_ndbcluster_cond.h index 4401a93c9e1..4ccc7e062ec 100644 --- a/sql/ha_ndbcluster_cond.h +++ b/sql/ha_ndbcluster_cond.h @@ -1,3 +1,6 @@ +#ifndef HA_NDBCLUSTER_COND_INCLUDED +#define HA_NDBCLUSTER_COND_INCLUDED + /* Copyright (C) 2000-2007 MySQL AB This program is free software; you can redistribute it and/or modify @@ -486,3 +489,5 @@ private: Ndb_cond_stack *m_cond_stack; }; + +#endif /* HA_NDBCLUSTER_COND_INCLUDED */ diff --git a/sql/ha_ndbcluster_tables.h b/sql/ha_ndbcluster_tables.h index c6bc8f577f8..ba2e8ec251b 100644 --- a/sql/ha_ndbcluster_tables.h +++ b/sql/ha_ndbcluster_tables.h @@ -1,3 +1,6 @@ +#ifndef HA_NDBCLUSTER_TABLES_INCLUDED +#define HA_NDBCLUSTER_TABLES_INCLUDED + /* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify @@ -21,3 +24,5 @@ #define OLD_NDB_APPLY_TABLE "apply_status" #define NDB_SCHEMA_TABLE "ndb_schema" #define OLD_NDB_SCHEMA_TABLE "schema" + +#endif /* HA_NDBCLUSTER_TABLES_INCLUDED */ diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 8a81a759e2a..804db028953 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1,3 +1,6 @@ +#ifndef HA_PARTITION_INCLUDED +#define HA_PARTITION_INCLUDED + /* Copyright 2005-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -1090,3 +1093,5 @@ public: virtual void append_create_info(String *packet) */ }; + +#endif /* HA_PARTITION_INCLUDED */ diff --git a/sql/handler.h b/sql/handler.h index f759239d66e..a281aaa0ad7 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1,3 +1,6 @@ +#ifndef HANDLER_INCLUDED +#define HANDLER_INCLUDED + /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -2064,3 +2067,4 @@ int ha_binlog_end(THD *thd); #define ha_binlog_wait(a) do {} while (0) #define ha_binlog_end(a) do {} while (0) #endif +#endif /* HANDLER_INCLUDED */ diff --git a/sql/item.h b/sql/item.h index a2cff3ab3a9..b44e84f4b15 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1,3 +1,6 @@ +#ifndef ITEM_INCLUDED +#define ITEM_INCLUDED + /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -3126,3 +3129,5 @@ extern Cached_item *new_Cached_item(THD *thd, Item *item); extern Item_result item_cmp_type(Item_result a,Item_result b); extern void resolve_const_item(THD *thd, Item **ref, Item *cmp_item); extern int stored_field_cmp_to_item(Field *field, Item *item); + +#endif /* ITEM_INCLUDED */ diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index c2227fa04e0..3462bed94a2 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1,3 +1,6 @@ +#ifndef ITEM_CMPFUNC_INCLUDED +#define ITEM_CMPFUNC_INCLUDED + /* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify @@ -1721,3 +1724,5 @@ inline Item *and_conds(Item *a, Item *b) } Item *and_expressions(Item *a, Item *b, Item **org_item); + +#endif /* ITEM_CMPFUNC_INCLUDED */ diff --git a/sql/item_func.h b/sql/item_func.h index fdbbff89e60..628878bcaed 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1,3 +1,6 @@ +#ifndef ITEM_FUNC_INCLUDED +#define ITEM_FUNC_INCLUDED + /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -1718,3 +1721,4 @@ public: bool check_partition_func_processor(uchar *int_arg) {return FALSE;} }; +#endif /* ITEM_FUNC_INCLUDED */ diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index edbe104e307..9a55ea7d5b1 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -1,3 +1,6 @@ +#ifndef ITEM_GEOFUNC_INCLUDED +#define ITEM_GEOFUNC_INCLUDED + /* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify @@ -386,3 +389,4 @@ public: #endif +#endif /* ITEM_GEOFUNC_INCLUDED */ diff --git a/sql/item_row.h b/sql/item_row.h index 67441f49603..7c08c5888e0 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -1,3 +1,6 @@ +#ifndef ITEM_ROW_INCLUDED +#define ITEM_ROW_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -77,3 +80,5 @@ public: bool null_inside() { return with_null; }; void bring_value(); }; + +#endif /* ITEM_ROW_INCLUDED */ diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index 2cdb45100ae..fc70b04ca68 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -1,3 +1,6 @@ +#ifndef ITEM_STRFUNC_INCLUDED +#define ITEM_STRFUNC_INCLUDED + /* Copyright (C) 2000-2003 MySQL AB This program is free software; you can redistribute it and/or modify @@ -842,3 +845,4 @@ public: String *val_str(String *); }; +#endif /* ITEM_STRFUNC_INCLUDED */ diff --git a/sql/item_subselect.h b/sql/item_subselect.h index d4aa621c083..ea59521aab1 100644 --- a/sql/item_subselect.h +++ b/sql/item_subselect.h @@ -1,3 +1,6 @@ +#ifndef ITEM_SUBSELECT_INCLUDED +#define ITEM_SUBSELECT_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -579,4 +582,4 @@ inline bool Item_subselect::is_uncacheable() const return engine->uncacheable(); } - +#endif /* ITEM_SUBSELECT_INCLUDED */ diff --git a/sql/item_sum.h b/sql/item_sum.h index d991327d847..993ec1597b4 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1,3 +1,6 @@ +#ifndef ITEM_SUM_INCLUDED +#define ITEM_SUM_INCLUDED + /* Copyright (C) 2000-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -1279,3 +1282,5 @@ public: virtual bool change_context_processor(uchar *cntx) { context= (Name_resolution_context *)cntx; return FALSE; } }; + +#endif /* ITEM_SUM_INCLUDED */ diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index 9e3c2e8c89f..7f1b2ed3a53 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -1,3 +1,6 @@ +#ifndef ITEM_TIMEFUNC_INCLUDED +#define ITEM_TIMEFUNC_INCLUDED + /* Copyright (C) 2000-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -1026,3 +1029,5 @@ public: const char *func_name() const { return "last_day"; } bool get_date(MYSQL_TIME *res, uint fuzzy_date); }; + +#endif /* ITEM_TIMEFUNC_INCLUDED */ diff --git a/sql/item_xmlfunc.h b/sql/item_xmlfunc.h index dadbb5ccf42..6373bde0aab 100644 --- a/sql/item_xmlfunc.h +++ b/sql/item_xmlfunc.h @@ -1,3 +1,6 @@ +#ifndef ITEM_XMLFUNC_INCLUDED +#define ITEM_XMLFUNC_INCLUDED + /* Copyright (C) 2000-2005 MySQL AB This program is free software; you can redistribute it and/or modify @@ -61,3 +64,4 @@ public: String *val_str(String *); }; +#endif /* ITEM_XMLFUNC_INCLUDED */ diff --git a/sql/lex.h b/sql/lex.h index 0a85824f6f7..b199a79350b 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -1,3 +1,6 @@ +#ifndef LEX_INCLUDED +#define LEX_INCLUDED + /* Copyright (C) 2000-2002 MySQL AB This program is free software; you can redistribute it and/or modify @@ -634,3 +637,5 @@ static SYMBOL sql_functions[] = { { "VAR_POP", SYM(VARIANCE_SYM)}, { "VAR_SAMP", SYM(VAR_SAMP_SYM)}, }; + +#endif /* LEX_INCLUDED */ diff --git a/sql/message.h b/sql/message.h index 0e7c282d5a1..97d039352b4 100644 --- a/sql/message.h +++ b/sql/message.h @@ -1,3 +1,6 @@ +#ifndef MESSAGE_INCLUDED +#define MESSAGE_INCLUDED + /* To change or add messages mysqld writes to the Windows error log, run mc.exe message.mc @@ -6,6 +9,8 @@ mc.exe can be installed with Windows SDK, some Visual Studio distributions do not include it. */ + + // // Values are 32 bit values layed out as follows: // @@ -53,3 +58,5 @@ // #define MSG_DEFAULT 0xC0000064L +#endif /* MESSAGE_INCLUDED */ + diff --git a/sql/mysqld_suffix.h b/sql/mysqld_suffix.h index 654d7cf88c1..c7ab212f2a2 100644 --- a/sql/mysqld_suffix.h +++ b/sql/mysqld_suffix.h @@ -1,3 +1,6 @@ +#ifndef MYSQLD_SUFFIX_INCLUDED +#define MYSQLD_SUFFIX_INCLUDED + /* Copyright (C) 2000-2004 MySQL AB This program is free software; you can redistribute it and/or modify @@ -27,3 +30,4 @@ #else #define MYSQL_SERVER_SUFFIX_STR MYSQL_SERVER_SUFFIX_DEF #endif +#endif /* MYSQLD_SUFFIX_INCLUDED */ diff --git a/sql/nt_servc.h b/sql/nt_servc.h index 2f0d07df543..5bee42dedf0 100644 --- a/sql/nt_servc.h +++ b/sql/nt_servc.h @@ -1,3 +1,6 @@ +#ifndef NT_SERVC_INCLUDED +#define NT_SERVC_INCLUDED + /** @file @@ -98,3 +101,5 @@ class NTService }; /* ------------------------- the end -------------------------------------- */ + +#endif /* NT_SERVC_INCLUDED */ diff --git a/sql/partition_element.h b/sql/partition_element.h index 905bc38165b..d67259b9605 100644 --- a/sql/partition_element.h +++ b/sql/partition_element.h @@ -1,3 +1,6 @@ +#ifndef PARTITION_ELEMENT_INCLUDED +#define PARTITION_ELEMENT_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -97,3 +100,5 @@ public: } ~partition_element() {} }; + +#endif /* PARTITION_ELEMENT_INCLUDED */ diff --git a/sql/partition_info.h b/sql/partition_info.h index 9f438e8260b..b5a6c4a0961 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -1,3 +1,6 @@ +#ifndef PARTITION_INFO_INCLUDED +#define PARTITION_INFO_INCLUDED + /* Copyright 2006-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -314,3 +317,5 @@ void init_all_partitions_iterator(partition_info *part_info, part_iter->ret_null_part= part_iter->ret_null_part_orig= FALSE; part_iter->get_next= get_next_partition_id_range; } + +#endif /* PARTITION_INFO_INCLUDED */ diff --git a/sql/procedure.h b/sql/procedure.h index ceb586766b1..c6f50493876 100644 --- a/sql/procedure.h +++ b/sql/procedure.h @@ -1,3 +1,6 @@ +#ifndef PROCEDURE_INCLUDED +#define PROCEDURE_INCLUDED + /* Copyright (C) 2000-2005 MySQL AB This program is free software; you can redistribute it and/or modify @@ -149,3 +152,5 @@ public: Procedure *setup_procedure(THD *thd,ORDER *proc_param,select_result *result, List &field_list,int *error); + +#endif /* PROCEDURE_INCLUDED */ diff --git a/sql/protocol.h b/sql/protocol.h index 251ba6fbc33..a39636a1595 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -1,3 +1,6 @@ +#ifndef PROTOCOL_INCLUDED +#define PROTOCOL_INCLUDED + /* Copyright (C) 2002-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -180,3 +183,4 @@ uchar *net_store_data(uchar *to,const uchar *from, size_t length); uchar *net_store_data(uchar *to,int32 from); uchar *net_store_data(uchar *to,longlong from); +#endif /* PROTOCOL_INCLUDED */ diff --git a/sql/repl_failsafe.h b/sql/repl_failsafe.h index 6ff78067aca..bce2c727050 100644 --- a/sql/repl_failsafe.h +++ b/sql/repl_failsafe.h @@ -1,3 +1,6 @@ +#ifndef REPL_FAILSAFE_INCLUDED +#define REPL_FAILSAFE_INCLUDED + /* Copyright (C) 2001-2005 MySQL AB & Sasha This program is free software; you can redistribute it and/or modify @@ -49,3 +52,4 @@ int register_slave(THD* thd, uchar* packet, uint packet_length); void unregister_slave(THD* thd, bool only_mine, bool need_mutex); #endif /* HAVE_REPLICATION */ +#endif /* REPL_FAILSAFE_INCLUDED */ diff --git a/sql/scheduler.h b/sql/scheduler.h index 46bbd300cbb..e7916031a27 100644 --- a/sql/scheduler.h +++ b/sql/scheduler.h @@ -1,3 +1,6 @@ +#ifndef SCHEDULER_INCLUDED +#define SCHEDULER_INCLUDED + /* Copyright (C) 2007 MySQL AB This program is free software; you can redistribute it and/or modify @@ -58,3 +61,5 @@ enum pool_command_op class thd_scheduler {}; + +#endif /* SCHEDULER_INCLUDED */ diff --git a/sql/set_var.h b/sql/set_var.h index 10e6e0f9c35..a3ed8e5be15 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -1,3 +1,6 @@ +#ifndef SET_VAR_INCLUDED +#define SET_VAR_INCLUDED + /* Copyright (C) 2002-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -1449,3 +1452,5 @@ void free_key_cache(const char *name, KEY_CACHE *key_cache); bool process_key_caches(process_key_cache_t func); void delete_elements(I_List *list, void (*free_element)(const char*, uchar*)); + +#endif /* SET_VAR_INCLUDED */ diff --git a/sql/sql_acl.h b/sql/sql_acl.h index a8090fba2e7..c0622bd747c 100644 --- a/sql/sql_acl.h +++ b/sql/sql_acl.h @@ -1,3 +1,6 @@ +#ifndef SQL_ACL_INCLUDED +#define SQL_ACL_INCLUDED + /* Copyright (C) 2000-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -273,3 +276,4 @@ bool is_acl_user(const char *host, const char *user); #define check_grant(A,B,C,D,E,F) 0 #define check_grant_db(A,B) 0 #endif +#endif /* SQL_ACL_INCLUDED */ diff --git a/sql/sql_analyse.h b/sql/sql_analyse.h index 8807b40857e..8f52b90c874 100644 --- a/sql/sql_analyse.h +++ b/sql/sql_analyse.h @@ -1,3 +1,6 @@ +#ifndef SQL_ANALYSE_INCLUDED +#define SQL_ANALYSE_INCLUDED + /* Copyright (C) 2000-2003, 2005 MySQL AB This program is free software; you can redistribute it and/or modify @@ -355,3 +358,5 @@ public: select_result *result, List &field_list); }; + +#endif /* SQL_ANALYSE_INCLUDED */ diff --git a/sql/sql_array.h b/sql/sql_array.h index e1b22921519..dfaa9b02947 100644 --- a/sql/sql_array.h +++ b/sql/sql_array.h @@ -1,3 +1,6 @@ +#ifndef SQL_ARRAY_INCLUDED +#define SQL_ARRAY_INCLUDED + /* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify @@ -66,3 +69,4 @@ public: } }; +#endif /* SQL_ARRAY_INCLUDED */ diff --git a/sql/sql_class.h b/sql/sql_class.h index f52d5fae76f..49f9bc3fd5e 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -14,6 +14,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef SQL_CLASS_INCLUDED +#define SQL_CLASS_INCLUDED + /* Classes in mysql */ #ifdef USE_PRAGMA_INTERFACE @@ -3003,3 +3006,4 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, void mark_transaction_to_rollback(THD *thd, bool all); #endif /* MYSQL_SERVER */ +#endif /* SQL_CLASS_INCLUDED */ diff --git a/sql/sql_crypt.h b/sql/sql_crypt.h index a5a6bee8a58..8d5a761cbdf 100644 --- a/sql/sql_crypt.h +++ b/sql/sql_crypt.h @@ -1,3 +1,6 @@ +#ifndef SQL_CRYPT_INCLUDED +#define SQL_CRYPT_INCLUDED + /* Copyright (C) 2000-2001, 2005 MySQL AB This program is free software; you can redistribute it and/or modify @@ -35,3 +38,5 @@ class SQL_CRYPT :public Sql_alloc void encode(char *str, uint length); void decode(char *str, uint length); }; + +#endif /* SQL_CRYPT_INCLUDED */ diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 76fd5354c51..6f9f667a75a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -17,6 +17,9 @@ @defgroup Semantic_Analysis Semantic Analysis */ +#ifndef SQL_LEX_INCLUDED +#define SQL_LEX_INCLUDED + /* YACC and LEX Definitions */ /* These may not be declared yet */ @@ -1979,3 +1982,4 @@ extern bool is_lex_native_function(const LEX_STRING *name); int my_missing_function_error(const LEX_STRING &token, const char *name); #endif /* MYSQL_SERVER */ +#endif /* SQL_LEX_INCLUDED */ diff --git a/sql/sql_map.h b/sql/sql_map.h index a1efba0da6f..5ae260841e0 100644 --- a/sql/sql_map.h +++ b/sql/sql_map.h @@ -1,3 +1,6 @@ +#ifndef SQL_MAP_INCLUDED +#define SQL_MAP_INCLUDED + /* Copyright (C) 2000-2001, 2005 MySQL AB This program is free software; you can redistribute it and/or modify @@ -60,3 +63,5 @@ public: return file->map; } }; + +#endif /* SQL_MAP_INCLUDED */ diff --git a/sql/sql_partition.h b/sql/sql_partition.h index 282e24f1853..0c47340016c 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -1,3 +1,6 @@ +#ifndef SQL_PARTITION_INCLUDED +#define SQL_PARTITION_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -209,3 +212,4 @@ typedef int (*get_partitions_in_range_iter)(partition_info *part_info, #include "partition_info.h" +#endif /* SQL_PARTITION_INCLUDED */ diff --git a/sql/sql_repl.h b/sql/sql_repl.h index d5c9040f8dc..aa71ac96ff8 100644 --- a/sql/sql_repl.h +++ b/sql/sql_repl.h @@ -13,6 +13,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef SQL_REPL_INCLUDED +#define SQL_REPL_INCLUDED + #include "rpl_filter.h" #ifdef HAVE_REPLICATION @@ -65,3 +68,4 @@ int init_replication_sys_vars(); #endif /* HAVE_REPLICATION */ +#endif /* SQL_REPL_INCLUDED */ diff --git a/sql/sql_select.h b/sql/sql_select.h index a0366d47149..12cfebfc374 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1,3 +1,6 @@ +#ifndef SQL_SELECT_INCLUDED +#define SQL_SELECT_INCLUDED + /* Copyright (C) 2000-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -736,3 +739,4 @@ inline bool optimizer_flag(THD *thd, uint flag) return (thd->variables.optimizer_switch & flag); } +#endif /* SQL_SELECT_INCLUDED */ diff --git a/sql/sql_servers.h b/sql/sql_servers.h index 63c691893d1..12855f8473c 100644 --- a/sql/sql_servers.h +++ b/sql/sql_servers.h @@ -1,3 +1,6 @@ +#ifndef SQL_SERVERS_INCLUDED +#define SQL_SERVERS_INCLUDED + /* Copyright (C) 2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -41,3 +44,5 @@ int alter_server(THD *thd, LEX_SERVER_OPTIONS *server_options); /* lookup functions */ FOREIGN_SERVER *get_server_by_name(MEM_ROOT *mem, const char *server_name, FOREIGN_SERVER *server_buffer); + +#endif /* SQL_SERVERS_INCLUDED */ diff --git a/sql/sql_sort.h b/sql/sql_sort.h index 1e9322f7f5b..102b3ef0a11 100644 --- a/sql/sql_sort.h +++ b/sql/sql_sort.h @@ -1,3 +1,6 @@ +#ifndef SQL_SORT_INCLUDED +#define SQL_SORT_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -87,3 +90,5 @@ int merge_buffers(SORTPARAM *param,IO_CACHE *from_file, BUFFPEK *lastbuff,BUFFPEK *Fb, BUFFPEK *Tb,int flag); void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint key_length); + +#endif /* SQL_SORT_INCLUDED */ diff --git a/sql/sql_string.h b/sql/sql_string.h index d62908e5d66..7b10aafbff1 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -1,3 +1,6 @@ +#ifndef SQL_STRING_INCLUDED +#define SQL_STRING_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -389,3 +392,5 @@ static inline bool check_if_only_end_space(CHARSET_INFO *cs, char *str, { return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end; } + +#endif /* SQL_STRING_INCLUDED */ diff --git a/sql/sql_trigger.h b/sql/sql_trigger.h index f6754a75284..b411acf2ac5 100644 --- a/sql/sql_trigger.h +++ b/sql/sql_trigger.h @@ -1,3 +1,6 @@ +#ifndef SQL_TRIGGER_INCLUDED +#define SQL_TRIGGER_INCLUDED + /* Copyright (C) 2004-2005 MySQL AB This program is free software; you can redistribute it and/or modify @@ -174,3 +177,4 @@ bool load_table_name_for_trigger(THD *thd, const LEX_STRING *trn_path, LEX_STRING *tbl_name); +#endif /* SQL_TRIGGER_INCLUDED */ diff --git a/sql/sql_udf.h b/sql/sql_udf.h index 4b8b492698e..95cb167869e 100644 --- a/sql/sql_udf.h +++ b/sql/sql_udf.h @@ -1,3 +1,6 @@ +#ifndef SQL_UDF_INCLUDED +#define SQL_UDF_INCLUDED + /* Copyright (C) 2000-2001, 2003-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -140,3 +143,4 @@ void free_udf(udf_func *udf); int mysql_create_function(THD *thd,udf_func *udf); int mysql_drop_function(THD *thd,const LEX_STRING *name); #endif +#endif /* SQL_UDF_INCLUDED */ diff --git a/sql/sql_view.h b/sql/sql_view.h index e08c2168e14..3de51c3264e 100644 --- a/sql/sql_view.h +++ b/sql/sql_view.h @@ -1,3 +1,6 @@ +#ifndef SQL_VIEW_INCLUDED +#define SQL_VIEW_INCLUDED + /* -*- C++ -*- */ /* Copyright (C) 2004 MySQL AB @@ -42,3 +45,4 @@ bool mysql_rename_view(THD *thd, const char *new_db, const char *new_name, #define VIEW_ANY_ACL (SELECT_ACL | UPDATE_ACL | INSERT_ACL | DELETE_ACL) +#endif /* SQL_VIEW_INCLUDED */ diff --git a/sql/structs.h b/sql/structs.h index a58c18f97c5..bcda7b1e787 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -1,3 +1,6 @@ +#ifndef STRUCTS_INCLUDED +#define STRUCTS_INCLUDED + /* Copyright (C) 2000-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -380,3 +383,5 @@ public: Discrete_interval* get_tail() const { return tail; }; Discrete_interval* get_current() const { return current; }; }; + +#endif /* STRUCTS_INCLUDED */ diff --git a/sql/table.h b/sql/table.h index 40372fa91cf..7c43ab339e5 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1,3 +1,6 @@ +#ifndef TABLE_INCLUDED +#define TABLE_INCLUDED + /* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify @@ -1729,3 +1732,4 @@ static inline void dbug_tmp_restore_column_maps(MY_BITMAP *read_set, size_t max_row_length(TABLE *table, const uchar *data); +#endif /* TABLE_INCLUDED */ diff --git a/sql/tzfile.h b/sql/tzfile.h index 1ff82d62329..1c1800ba1ed 100644 --- a/sql/tzfile.h +++ b/sql/tzfile.h @@ -1,3 +1,6 @@ +#ifndef TZFILE_INCLUDED +#define TZFILE_INCLUDED + /* Copyright (C) 2004 MySQL AB This program is free software; you can redistribute it and/or modify @@ -134,3 +137,5 @@ struct tzhead { */ #define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0)) + +#endif diff --git a/sql/tztime.h b/sql/tztime.h index 9bf103519c4..9990e91f17b 100644 --- a/sql/tztime.h +++ b/sql/tztime.h @@ -1,3 +1,6 @@ +#ifndef TZTIME_INCLUDED +#define TZTIME_INCLUDED + /* Copyright (C) 2004 MySQL AB This program is free software; you can redistribute it and/or modify @@ -79,3 +82,4 @@ static const int MY_TZ_TABLES_COUNT= 4; #endif /* !defined(TESTTIME) && !defined(TZINFO2SQL) */ +#endif /* TZTIME_INCLUDED */ diff --git a/sql/unireg.h b/sql/unireg.h index 3ff7f058e3c..6c9080aea79 100644 --- a/sql/unireg.h +++ b/sql/unireg.h @@ -1,3 +1,6 @@ +#ifndef UNIREG_INCLUDED +#define UNIREG_INCLUDED + /* Copyright (C) 2000-2006 MySQL AB This program is free software; you can redistribute it and/or modify @@ -16,8 +19,6 @@ /* Extra functions used by unireg library */ -#ifndef _unireg_h - #ifndef NO_ALARM_LOOP #define NO_ALARM_LOOP /* lib5 and popen can't use alarm */ #endif diff --git a/strings/strings-not-used.h b/strings/strings-not-used.h index 3efaa8ab6eb..8311545f22f 100644 --- a/strings/strings-not-used.h +++ b/strings/strings-not-used.h @@ -1,3 +1,6 @@ +#ifndef STRINGS_NOT_USED_INCLUDED +#define STRINGS_NOT_USED_INCLUDED + /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -35,3 +38,4 @@ #define _AlphabetSize 256 #endif /* NullS */ +#endif /* STRINGS_NOT_USED_INCLUDED */ diff --git a/vio/vio_priv.h b/vio/vio_priv.h index b9f5dd0c9c4..792fad4cc66 100644 --- a/vio/vio_priv.h +++ b/vio/vio_priv.h @@ -1,3 +1,6 @@ +#ifndef VIO_PRIV_INCLUDED +#define VIO_PRIV_INCLUDED + /* Copyright (C) 2003 MySQL AB This program is free software; you can redistribute it and/or modify @@ -38,3 +41,4 @@ void vio_ssl_delete(Vio *vio); int vio_ssl_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode); #endif /* HAVE_OPENSSL */ +#endif /* VIO_PRIV_INCLUDED */ From 14cf09c12ab4108777767d627e264d021f5e8515 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Fri, 25 Sep 2009 11:47:15 +0200 Subject: [PATCH 35/88] Bug #47645: Segmentation fault when out of memory during handlerton initialization There is a missing check for memory allocation failure when allocating memory for the handlerton structure. If the handlerton init function tries to de-reference the pointer, it will cause a segmentation fault and crash the server. This patch fixes the problem by not calling the init function if memory allocation failed, and instead prints an informative error message and reports the error to the caller. --- sql/handler.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sql/handler.cc b/sql/handler.cc index e5c64452aaf..f966a9099ee 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -430,6 +430,14 @@ int ha_initialize_handlerton(st_plugin_int *plugin) hton= (handlerton *)my_malloc(sizeof(handlerton), MYF(MY_WME | MY_ZEROFILL)); + + if (hton == NULL) + { + sql_print_error("Unable to allocate memory for plugin '%s' handlerton.", + plugin->name.str); + goto err_no_hton_memory; + } + /* Historical Requirement */ plugin->data= hton; // shortcut for the future if (plugin->plugin->init && plugin->plugin->init(hton)) @@ -540,6 +548,7 @@ err_deinit: err: my_free((uchar*) hton, MYF(0)); +err_no_hton_memory: plugin->data= NULL; DBUG_RETURN(1); } From 06442da289d351aae0540d0aca8bb69652ab6e13 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Sat, 26 Sep 2009 12:49:49 +0800 Subject: [PATCH 36/88] Backporting WL#4398 WL#1720 Backporting BUG#44058 BUG#42244 BUG#45672 BUG#45673 Backporting BUG#45819 BUG#45973 BUG#39012 --- .bzr-mysql/default.conf | 2 +- include/mysql/plugin.h | 77 +- include/mysql/plugin.h.pp | 12 + libmysqld/CMakeLists.txt | 1 + libmysqld/Makefile.am | 3 +- mysql-test/mysql-test-run.pl | 20 + mysql-test/suite/rpl/t/rpl000017.test | 1 + plugin/semisync/Makefile.am | 35 + plugin/semisync/configure.in | 9 + plugin/semisync/plug.in | 3 + plugin/semisync/semisync.cc | 30 + plugin/semisync/semisync.h | 95 ++ plugin/semisync/semisync_master.cc | 1199 +++++++++++++++++++++ plugin/semisync/semisync_master.h | 366 +++++++ plugin/semisync/semisync_master_plugin.cc | 380 +++++++ plugin/semisync/semisync_slave.cc | 122 +++ plugin/semisync/semisync_slave.h | 99 ++ plugin/semisync/semisync_slave_plugin.cc | 224 ++++ sql/CMakeLists.txt | 1 + sql/Makefile.am | 6 +- sql/handler.cc | 12 + sql/log.cc | 35 +- sql/log.h | 16 +- sql/mysqld.cc | 10 + sql/replication.h | 490 +++++++++ sql/rpl_handler.cc | 493 +++++++++ sql/rpl_handler.h | 213 ++++ sql/slave.cc | 124 ++- sql/sql_class.cc | 36 + sql/sql_class.h | 21 +- sql/sql_parse.cc | 1 + sql/sql_plugin.cc | 17 +- sql/sql_plugin.h | 8 + sql/sql_repl.cc | 164 ++- 34 files changed, 4240 insertions(+), 85 deletions(-) create mode 100644 plugin/semisync/Makefile.am create mode 100644 plugin/semisync/configure.in create mode 100644 plugin/semisync/plug.in create mode 100644 plugin/semisync/semisync.cc create mode 100644 plugin/semisync/semisync.h create mode 100644 plugin/semisync/semisync_master.cc create mode 100644 plugin/semisync/semisync_master.h create mode 100644 plugin/semisync/semisync_master_plugin.cc create mode 100644 plugin/semisync/semisync_slave.cc create mode 100644 plugin/semisync/semisync_slave.h create mode 100644 plugin/semisync/semisync_slave_plugin.cc create mode 100644 sql/replication.h create mode 100644 sql/rpl_handler.cc create mode 100644 sql/rpl_handler.h diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index f044f8e62da..44969de4744 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.1" +tree_name = "mysql-5.1-rep-semisync" diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 2e59262d061..45d0234cb67 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -16,6 +16,11 @@ #ifndef _my_plugin_h #define _my_plugin_h +/* size_t */ +#include + +typedef struct st_mysql MYSQL; + /* On Windows, exports from DLL need to be declared @@ -75,7 +80,8 @@ typedef struct st_mysql_xid MYSQL_XID; #define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ #define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */ #define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */ -#define MYSQL_MAX_PLUGIN_TYPE_NUM 5 /* The number of plugin types */ +#define MYSQL_REPLICATION_PLUGIN 5 /* The replication plugin type */ +#define MYSQL_MAX_PLUGIN_TYPE_NUM 6 /* The number of plugin types */ /* We use the following strings to define licenses for plugins */ #define PLUGIN_LICENSE_PROPRIETARY 0 @@ -650,6 +656,17 @@ struct st_mysql_information_schema int interface_version; }; +/* + API for Replication plugin. (MYSQL_REPLICATION_PLUGIN) +*/ + #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0100 + + /** + Replication plugin descriptor + */ + struct Mysql_replication { + int interface_version; + }; /* st_mysql_value struct for reading values from mysqld. @@ -801,6 +818,64 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd, const char *key, unsigned int key_length, int using_trx); +/** + Get the value of user variable as an integer. + + This function will return the value of variable @a name as an + integer. If the original value of the variable is not an integer, + the value will be converted into an integer. + + @param name user variable name + @param value pointer to return the value + @param null_value if not NULL, the function will set it to true if + the value of variable is null, set to false if not + + @retval 0 Success + @retval 1 Variable not found +*/ +int get_user_var_int(const char *name, + long long int *value, int *null_value); + +/** + Get the value of user variable as a double precision float number. + + This function will return the value of variable @a name as real + number. If the original value of the variable is not a real number, + the value will be converted into a real number. + + @param name user variable name + @param value pointer to return the value + @param null_value if not NULL, the function will set it to true if + the value of variable is null, set to false if not + + @retval 0 Success + @retval 1 Variable not found +*/ +int get_user_var_real(const char *name, + double *value, int *null_value); + +/** + Get the value of user variable as a string. + + This function will return the value of variable @a name as + string. If the original value of the variable is not a string, + the value will be converted into a string. + + @param name user variable name + @param value pointer to the value buffer + @param len length of the value buffer + @param precision precision of the value if it is a float number + @param null_value if not NULL, the function will set it to true if + the value of variable is null, set to false if not + + @retval 0 Success + @retval 1 Variable not found +*/ +int get_user_var_str(const char *name, + char *value, unsigned long len, + unsigned int precision, int *null_value); + + #ifdef __cplusplus } #endif diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp index 50511f515ab..d864140333b 100644 --- a/include/mysql/plugin.h.pp +++ b/include/mysql/plugin.h.pp @@ -1,3 +1,5 @@ +#include +typedef struct st_mysql MYSQL; struct st_mysql_lex_string { char *str; @@ -105,6 +107,9 @@ struct st_mysql_information_schema { int interface_version; }; +struct Mysql_replication { + int interface_version; +}; struct st_mysql_value { int (*value_type)(struct st_mysql_value *); @@ -137,3 +142,10 @@ void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, const char *key, unsigned int key_length, int using_trx); +int get_user_var_int(const char *name, + long long int *value, int *null_value); +int get_user_var_real(const char *name, + double *value, int *null_value); +int get_user_var_str(const char *name, + char *value, unsigned long len, + unsigned int precision, int *null_value); diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 8500d73863a..f7be98889ef 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -139,6 +139,7 @@ SET(LIBMYSQLD_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc ../sql/partition_info.cc ../sql/sql_connect.cc ../sql/scheduler.cc ../sql/event_parse_data.cc + ../sql/rpl_handler.cc ${GEN_SOURCES} ${LIB_SOURCES}) diff --git a/libmysqld/Makefile.am b/libmysqld/Makefile.am index a9bd8d9e17c..244400e1b8d 100644 --- a/libmysqld/Makefile.am +++ b/libmysqld/Makefile.am @@ -76,7 +76,8 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ rpl_filter.cc sql_partition.cc sql_builtin.cc sql_plugin.cc \ sql_tablespace.cc \ rpl_injector.cc my_user.c partition_info.cc \ - sql_servers.cc event_parse_data.cc + sql_servers.cc event_parse_data.cc \ + rpl_handler.cc libmysqld_int_a_SOURCES= $(libmysqld_sources) nodist_libmysqld_int_a_SOURCES= $(libmysqlsources) $(sqlsources) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 114b6c84aa3..434896df6a5 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1815,6 +1815,26 @@ sub environment_setup { $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=;EXAMPLE=".$plugin_filename.";"; } + # -------------------------------------------------------------------------- + # Add the path where mysqld will find semisync plugins + # -------------------------------------------------------------------------- + my $lib_semisync_master_plugin= + mtr_file_exists("$basedir/plugin/semisync/.libs/libsemisync_master.so"); + my $lib_semisync_slave_plugin= + mtr_file_exists("$basedir/plugin/semisync/.libs/libsemisync_slave.so"); + if ($lib_semisync_master_plugin && $lib_semisync_slave_plugin) + { + $ENV{'SEMISYNC_MASTER_PLUGIN'}= basename($lib_semisync_master_plugin); + $ENV{'SEMISYNC_SLAVE_PLUGIN'}= basename($lib_semisync_slave_plugin); + $ENV{'SEMISYNC_PLUGIN_OPT'}= "--plugin-dir=".dirname($lib_semisync_master_plugin); + } + else + { + $ENV{'SEMISYNC_MASTER_PLUGIN'}= ""; + $ENV{'SEMISYNC_SLAVE_PLUGIN'}= ""; + $ENV{'SEMISYNC_PLUGIN_OPT'}=""; + } + # ---------------------------------------------------- # Add the path where mysqld will find mypluglib.so # ---------------------------------------------------- diff --git a/mysql-test/suite/rpl/t/rpl000017.test b/mysql-test/suite/rpl/t/rpl000017.test index 2ba321cd8c3..d6b3e46fa31 100644 --- a/mysql-test/suite/rpl/t/rpl000017.test +++ b/mysql-test/suite/rpl/t/rpl000017.test @@ -6,6 +6,7 @@ grant replication slave on *.* to replicate@localhost identified by 'aaaaaaaaaaa grant replication slave on *.* to replicate@127.0.0.1 identified by 'aaaaaaaaaaaaaaab'; connection slave; start slave; +source include/wait_for_slave_to_start.inc; connection master; --disable_warnings drop table if exists t1; diff --git a/plugin/semisync/Makefile.am b/plugin/semisync/Makefile.am new file mode 100644 index 00000000000..dd9a630670c --- /dev/null +++ b/plugin/semisync/Makefile.am @@ -0,0 +1,35 @@ +# Copyright (C) 2006 MySQL AB +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +## Makefile.am for semi-synchronous replication + +pkgplugindir = $(pkglibdir)/plugin +INCLUDES = -I$(top_srcdir)/include \ + -I$(top_srcdir)/sql \ + -I$(srcdir) + +noinst_HEADERS = semisync.h semisync_master.h semisync_slave.h + +pkgplugin_LTLIBRARIES = libsemisync_master.la libsemisync_slave.la + +libsemisync_master_la_LDFLAGS = -module +libsemisync_master_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libsemisync_master_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libsemisync_master_la_SOURCES = semisync.cc semisync_master.cc semisync_master_plugin.cc + +libsemisync_slave_la_LDFLAGS = -module +libsemisync_slave_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libsemisync_slave_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN +libsemisync_slave_la_SOURCES = semisync.cc semisync_slave.cc semisync_slave_plugin.cc diff --git a/plugin/semisync/configure.in b/plugin/semisync/configure.in new file mode 100644 index 00000000000..894251258db --- /dev/null +++ b/plugin/semisync/configure.in @@ -0,0 +1,9 @@ +# configure.in for semi-synchronous replication + +AC_INIT(mysql-semi-sync-plugin, 0.2) +AM_INIT_AUTOMAKE +AC_DISABLE_STATIC +AC_PROG_LIBTOOL +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT + diff --git a/plugin/semisync/plug.in b/plugin/semisync/plug.in new file mode 100644 index 00000000000..917c8950f02 --- /dev/null +++ b/plugin/semisync/plug.in @@ -0,0 +1,3 @@ +MYSQL_PLUGIN(semisync,[Semi-synchronous Replication Plugin], + [Semi-synchronous replication plugin.]) +MYSQL_PLUGIN_DYNAMIC(semisync, [libsemisync_master.la libsemisync_slave.la]) diff --git a/plugin/semisync/semisync.cc b/plugin/semisync/semisync.cc new file mode 100644 index 00000000000..83c7791c14b --- /dev/null +++ b/plugin/semisync/semisync.cc @@ -0,0 +1,30 @@ +/* Copyright (C) 2007 Google Inc. + Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#include "semisync.h" + +const unsigned char ReplSemiSyncBase::kPacketMagicNum = 0xef; +const unsigned char ReplSemiSyncBase::kPacketFlagSync = 0x01; + + +const unsigned long Trace::kTraceGeneral = 0x0001; +const unsigned long Trace::kTraceDetail = 0x0010; +const unsigned long Trace::kTraceNetWait = 0x0020; +const unsigned long Trace::kTraceFunction = 0x0040; + +const char ReplSemiSyncBase::kSyncHeader[2] = + {ReplSemiSyncBase::kPacketMagicNum, 0}; diff --git a/plugin/semisync/semisync.h b/plugin/semisync/semisync.h new file mode 100644 index 00000000000..c9d35a093f6 --- /dev/null +++ b/plugin/semisync/semisync.h @@ -0,0 +1,95 @@ +/* Copyright (C) 2007 Google Inc. + Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#ifndef SEMISYNC_H +#define SEMISYNC_H + +#include +#include +#include +#include +#include +#include +#include +#include + +typedef uint32_t uint32; +typedef unsigned long long my_off_t; +#define FN_REFLEN 512 /* Max length of full path-name */ +void sql_print_error(const char *format, ...); +void sql_print_warning(const char *format, ...); +void sql_print_information(const char *format, ...); +extern unsigned long max_connections; + +#define MYSQL_SERVER +#define HAVE_REPLICATION +#include +#include +#include +#include + +typedef struct st_mysql_show_var SHOW_VAR; +typedef struct st_mysql_sys_var SYS_VAR; + + +/** + This class is used to trace function calls and other process + information +*/ +class Trace { +public: + static const unsigned long kTraceFunction; + static const unsigned long kTraceGeneral; + static const unsigned long kTraceDetail; + static const unsigned long kTraceNetWait; + + unsigned long trace_level_; /* the level for tracing */ + + inline void function_enter(const char *func_name) + { + if (trace_level_ & kTraceFunction) + sql_print_information("---> %s enter", func_name); + } + inline int function_exit(const char *func_name, int exit_code) + { + if (trace_level_ & kTraceFunction) + sql_print_information("<--- %s exit (%d)", func_name, exit_code); + return exit_code; + } + + Trace() + :trace_level_(0L) + {} + Trace(unsigned long trace_level) + :trace_level_(trace_level) + {} +}; + +/** + Base class for semi-sync master and slave classes +*/ +class ReplSemiSyncBase + :public Trace { +public: + static const char kSyncHeader[2]; /* three byte packet header */ + + /* Constants in network packet header. */ + static const unsigned char kPacketMagicNum; + static const unsigned char kPacketFlagSync; +}; + +#endif /* SEMISYNC_H */ diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc new file mode 100644 index 00000000000..b3454c49829 --- /dev/null +++ b/plugin/semisync/semisync_master.cc @@ -0,0 +1,1199 @@ +/* Copyright (C) 2007 Google Inc. + Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#include "semisync_master.h" + +#define TIME_THOUSAND 1000 +#define TIME_MILLION 1000000 +#define TIME_BILLION 1000000000 + +/* This indicates whether semi-synchronous replication is enabled. */ +char rpl_semi_sync_master_enabled; +unsigned long rpl_semi_sync_master_timeout; +unsigned long rpl_semi_sync_master_trace_level; +unsigned long rpl_semi_sync_master_status = 0; +unsigned long rpl_semi_sync_master_yes_transactions = 0; +unsigned long rpl_semi_sync_master_no_transactions = 0; +unsigned long rpl_semi_sync_master_off_times = 0; +unsigned long rpl_semi_sync_master_timefunc_fails = 0; +unsigned long rpl_semi_sync_master_num_timeouts = 0; +unsigned long rpl_semi_sync_master_wait_sessions = 0; +unsigned long rpl_semi_sync_master_back_wait_pos = 0; +unsigned long rpl_semi_sync_master_trx_wait_time = 0; +unsigned long long rpl_semi_sync_master_trx_wait_num = 0; +unsigned long rpl_semi_sync_master_net_wait_time = 0; +unsigned long long rpl_semi_sync_master_net_wait_num = 0; +unsigned long rpl_semi_sync_master_clients = 0; +unsigned long long rpl_semi_sync_master_net_wait_total_time = 0; +unsigned long long rpl_semi_sync_master_trx_wait_total_time = 0; + + +static int getWaitTime(const struct timeval& start_tv); + +/******************************************************************************* + * + * class : manage all active transaction nodes + * + ******************************************************************************/ + +ActiveTranx::ActiveTranx(int max_connections, + pthread_mutex_t *lock, + unsigned long trace_level) + : Trace(trace_level), num_transactions_(max_connections), + num_entries_(max_connections << 1), + lock_(lock) +{ + /* Allocate the memory for the array */ + node_array_ = new TranxNode[num_transactions_]; + for (int idx = 0; idx < num_transactions_; ++idx) + { + node_array_[idx].log_pos_ = 0; + node_array_[idx].hash_next_ = NULL; + node_array_[idx].next_ = node_array_ + idx + 1; + + node_array_[idx].log_name_ = new char[FN_REFLEN]; + node_array_[idx].log_name_[0] = '\x0'; + } + node_array_[num_transactions_-1].next_ = NULL; + + /* All nodes in the array go to the pool initially. */ + free_pool_ = node_array_; + + /* No transactions are in the list initially. */ + trx_front_ = NULL; + trx_rear_ = NULL; + + /* Create the hash table to find a transaction's ending event. */ + trx_htb_ = new TranxNode *[num_entries_]; + for (int idx = 0; idx < num_entries_; ++idx) + trx_htb_[idx] = NULL; + + sql_print_information("Semi-sync replication initialized for %d " + "transactions.", num_transactions_); +} + +ActiveTranx::~ActiveTranx() +{ + for (int idx = 0; idx < num_transactions_; ++idx) + { + delete [] node_array_[idx].log_name_; + node_array_[idx].log_name_ = NULL; + } + + delete [] node_array_; + delete [] trx_htb_; + + node_array_ = NULL; + trx_htb_ = NULL; + num_transactions_ = 0; + num_entries_ = 0; +} + +unsigned int ActiveTranx::calc_hash(const unsigned char *key, + unsigned int length) +{ + unsigned int nr = 1, nr2 = 4; + + /* The hash implementation comes from calc_hashnr() in mysys/hash.c. */ + while (length--) + { + nr ^= (((nr & 63)+nr2)*((unsigned int) (unsigned char) *key++))+ (nr << 8); + nr2 += 3; + } + return((unsigned int) nr); +} + +unsigned int ActiveTranx::get_hash_value(const char *log_file_name, + my_off_t log_file_pos) +{ + unsigned int hash1 = calc_hash((const unsigned char *)log_file_name, + strlen(log_file_name)); + unsigned int hash2 = calc_hash((const unsigned char *)(&log_file_pos), + sizeof(log_file_pos)); + + return (hash1 + hash2) % num_entries_; +} + +ActiveTranx::TranxNode* ActiveTranx::alloc_tranx_node() +{ + TranxNode *ptr = free_pool_; + + if (free_pool_) + { + free_pool_ = free_pool_->next_; + ptr->next_ = NULL; + ptr->hash_next_ = NULL; + } + else + { + /* + free_pool should never be NULL here, because we have + max_connections number of pre-allocated nodes. + */ + sql_print_error("You have encountered a semi-sync bug (free_pool == NULL), " + "please report to http://bugs.mysql.com"); + assert(free_pool_); + } + + return ptr; +} + +int ActiveTranx::compare(const char *log_file_name1, my_off_t log_file_pos1, + const char *log_file_name2, my_off_t log_file_pos2) +{ + int cmp = strcmp(log_file_name1, log_file_name2); + + if (cmp != 0) + return cmp; + + if (log_file_pos1 > log_file_pos2) + return 1; + else if (log_file_pos1 < log_file_pos2) + return -1; + return 0; +} + +int ActiveTranx::insert_tranx_node(const char *log_file_name, + my_off_t log_file_pos) +{ + const char *kWho = "ActiveTranx:insert_tranx_node"; + TranxNode *ins_node; + int result = 0; + unsigned int hash_val; + + function_enter(kWho); + + ins_node = alloc_tranx_node(); + if (!ins_node) + { + sql_print_error("%s: transaction node allocation failed for: (%s, %lu)", + kWho, log_file_name, (unsigned long)log_file_pos); + result = -1; + goto l_end; + } + + /* insert the binlog position in the active transaction list. */ + strcpy(ins_node->log_name_, log_file_name); + ins_node->log_pos_ = log_file_pos; + + if (!trx_front_) + { + /* The list is empty. */ + trx_front_ = trx_rear_ = ins_node; + } + else + { + int cmp = compare(ins_node, trx_rear_); + if (cmp > 0) + { + /* Compare with the tail first. If the transaction happens later in + * binlog, then make it the new tail. + */ + trx_rear_->next_ = ins_node; + trx_rear_ = ins_node; + } + else + { + /* Otherwise, it is an error because the transaction should hold the + * mysql_bin_log.LOCK_log when appending events. + */ + sql_print_error("%s: binlog write out-of-order, tail (%s, %lu), " + "new node (%s, %lu)", kWho, + trx_rear_->log_name_, (unsigned long)trx_rear_->log_pos_, + ins_node->log_name_, (unsigned long)ins_node->log_pos_); + result = -1; + goto l_end; + } + } + + hash_val = get_hash_value(ins_node->log_name_, ins_node->log_pos_); + ins_node->hash_next_ = trx_htb_[hash_val]; + trx_htb_[hash_val] = ins_node; + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: insert (%s, %lu) in entry(%u)", kWho, + ins_node->log_name_, (unsigned long)ins_node->log_pos_, + hash_val); + + l_end: + return function_exit(kWho, result); +} + +bool ActiveTranx::is_tranx_end_pos(const char *log_file_name, + my_off_t log_file_pos) +{ + const char *kWho = "ActiveTranx::is_tranx_end_pos"; + function_enter(kWho); + + unsigned int hash_val = get_hash_value(log_file_name, log_file_pos); + TranxNode *entry = trx_htb_[hash_val]; + + while (entry != NULL) + { + if (compare(entry, log_file_name, log_file_pos) == 0) + break; + + entry = entry->hash_next_; + } + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: probe (%s, %lu) in entry(%u)", kWho, + log_file_name, (unsigned long)log_file_pos, hash_val); + + function_exit(kWho, (entry != NULL)); + return (entry != NULL); +} + +int ActiveTranx::clear_active_tranx_nodes(const char *log_file_name, + my_off_t log_file_pos) +{ + const char *kWho = "ActiveTranx::::clear_active_tranx_nodes"; + TranxNode *new_front; + + function_enter(kWho); + + if (log_file_name != NULL) + { + new_front = trx_front_; + + while (new_front) + { + if (compare(new_front, log_file_name, log_file_pos) > 0) + break; + new_front = new_front->next_; + } + } + else + { + /* If log_file_name is NULL, clear everything. */ + new_front = NULL; + } + + if (new_front == NULL) + { + /* No active transaction nodes after the call. */ + + /* Clear the hash table. */ + memset(trx_htb_, 0, num_entries_ * sizeof(TranxNode *)); + + /* Clear the active transaction list. */ + if (trx_front_ != NULL) + { + trx_rear_->next_ = free_pool_; + free_pool_ = trx_front_; + trx_front_ = NULL; + trx_rear_ = NULL; + } + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: free all nodes back to free list", kWho); + } + else if (new_front != trx_front_) + { + TranxNode *curr_node, *next_node; + + /* Delete all transaction nodes before the confirmation point. */ + int n_frees = 0; + curr_node = trx_front_; + while (curr_node != new_front) + { + next_node = curr_node->next_; + + /* Put the node in the memory pool. */ + curr_node->next_ = free_pool_; + free_pool_ = curr_node; + n_frees++; + + /* Remove the node from the hash table. */ + unsigned int hash_val = get_hash_value(curr_node->log_name_, curr_node->log_pos_); + TranxNode **hash_ptr = &(trx_htb_[hash_val]); + while ((*hash_ptr) != NULL) + { + if ((*hash_ptr) == curr_node) + { + (*hash_ptr) = curr_node->hash_next_; + break; + } + hash_ptr = &((*hash_ptr)->hash_next_); + } + + curr_node = next_node; + } + + trx_front_ = new_front; + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: free %d nodes back until pos (%s, %lu)", + kWho, n_frees, + trx_front_->log_name_, (unsigned long)trx_front_->log_pos_); + } + + return function_exit(kWho, 0); +} + + +/******************************************************************************* + * + * class: the basic code layer for sync-replication master. + * class: the basic code layer for sync-replication slave. + * + * The most important functions during semi-syn replication listed: + * + * Master: + * . reportReplyBinlog(): called by the binlog dump thread when it receives + * the slave's status information. + * . updateSyncHeader(): based on transaction waiting information, decide + * whether to request the slave to reply. + * . writeTraxInBinlog(): called by the transaction thread when it finishes + * writing all transaction events in binlog. + * . commitTrx(): transaction thread wait for the slave reply. + * + * Slave: + * . slaveReadSyncHeader(): read the semi-sync header from the master, get the + * sync status and get the payload for events. + * . slaveReply(): reply to the master about the replication progress. + * + ******************************************************************************/ + +ReplSemiSyncMaster::ReplSemiSyncMaster() + : active_tranxs_(NULL), + init_done_(false), + reply_file_name_inited_(false), + reply_file_pos_(0L), + wait_file_name_inited_(false), + wait_file_pos_(0), + master_enabled_(false), + wait_timeout_(0L), + state_(0), + enabled_transactions_(0), + disabled_transactions_(0), + switched_off_times_(0), + timefunc_fails_(0), + wait_sessions_(0), + wait_backtraverse_(0), + total_trx_wait_num_(0), + total_trx_wait_time_(0), + total_net_wait_num_(0), + total_net_wait_time_(0), + max_transactions_(0L) +{ + strcpy(reply_file_name_, ""); + strcpy(wait_file_name_, ""); +} + +int ReplSemiSyncMaster::initObject() +{ + int result; + const char *kWho = "ReplSemiSyncMaster::initObject"; + + if (init_done_) + { + fprintf(stderr, "%s called twice\n", kWho); + return 1; + } + init_done_ = true; + + /* References to the parameter works after set_options(). */ + setWaitTimeout(rpl_semi_sync_master_timeout); + setTraceLevel(rpl_semi_sync_master_trace_level); + max_transactions_ = (int)max_connections; + + /* Mutex initialization can only be done after MY_INIT(). */ + pthread_mutex_init(&LOCK_binlog_, MY_MUTEX_INIT_FAST); + pthread_cond_init(&COND_binlog_send_, NULL); + + if (rpl_semi_sync_master_enabled) + result = enableMaster(); + else + result = disableMaster(); + + return result; +} + +int ReplSemiSyncMaster::enableMaster() +{ + int result = 0; + + /* Must have the lock when we do enable of disable. */ + lock(); + + if (!getMasterEnabled()) + { + active_tranxs_ = new ActiveTranx(max_connections, + &LOCK_binlog_, + trace_level_); + if (active_tranxs_ != NULL) + { + commit_file_name_inited_ = false; + reply_file_name_inited_ = false; + wait_file_name_inited_ = false; + + set_master_enabled(true); + state_ = true; + sql_print_information("Semi-sync replication enabled on the master."); + } + else + { + sql_print_error("Cannot allocate memory to enable semi-sync on the master."); + result = -1; + } + } + + unlock(); + + return result; +} + +int ReplSemiSyncMaster::disableMaster() +{ + /* Must have the lock when we do enable of disable. */ + lock(); + + if (getMasterEnabled()) + { + /* Switch off the semi-sync first so that waiting transaction will be + * waken up. + */ + switch_off(); + + assert(active_tranxs_ != NULL); + delete active_tranxs_; + active_tranxs_ = NULL; + + reply_file_name_inited_ = false; + wait_file_name_inited_ = false; + commit_file_name_inited_ = false; + + set_master_enabled(false); + sql_print_information("Semi-sync replication disabled on the master."); + } + + unlock(); + + return 0; +} + +ReplSemiSyncMaster::~ReplSemiSyncMaster() +{ + if (init_done_) + { + pthread_mutex_destroy(&LOCK_binlog_); + pthread_cond_destroy(&COND_binlog_send_); + } + + delete active_tranxs_; +} + +void ReplSemiSyncMaster::lock() +{ + pthread_mutex_lock(&LOCK_binlog_); +} + +void ReplSemiSyncMaster::unlock() +{ + pthread_mutex_unlock(&LOCK_binlog_); +} + +void ReplSemiSyncMaster::cond_broadcast() +{ + pthread_cond_broadcast(&COND_binlog_send_); +} + +int ReplSemiSyncMaster::cond_timewait(struct timespec *wait_time) +{ + const char *kWho = "ReplSemiSyncMaster::cond_timewait()"; + int wait_res; + + function_enter(kWho); + wait_res = pthread_cond_timedwait(&COND_binlog_send_, + &LOCK_binlog_, wait_time); + return function_exit(kWho, wait_res); +} + +void ReplSemiSyncMaster::add_slave() +{ + lock(); + rpl_semi_sync_master_clients++; + unlock(); +} + +void ReplSemiSyncMaster::remove_slave() +{ + lock(); + rpl_semi_sync_master_clients--; + unlock(); +} + +bool ReplSemiSyncMaster::is_semi_sync_slave() +{ + int null_value; + long long val= 0; + get_user_var_int("rpl_semi_sync_slave", &val, &null_value); + return val; +} + +int ReplSemiSyncMaster::reportReplyBinlog(const char *log_file_pos) +{ + char log_name[FN_REFLEN]; + char *endptr; + my_off_t log_pos= strtoull(log_file_pos, &endptr, 10); + if (!log_pos || !endptr || *endptr != ':' ) + return 1; + endptr++; // skip the ':' seperator + strncpy(log_name, endptr, FN_REFLEN); + uint32 server_id= 0; + return reportReplyBinlog(server_id, log_name, log_pos); +} + +int ReplSemiSyncMaster::reportReplyBinlog(uint32 server_id, + const char *log_file_name, + my_off_t log_file_pos) +{ + const char *kWho = "ReplSemiSyncMaster::reportReplyBinlog"; + int cmp; + bool can_release_threads = false; + bool need_copy_send_pos = true; + + if (!(getMasterEnabled())) + return 0; + + function_enter(kWho); + + lock(); + + /* This is the real check inside the mutex. */ + if (!getMasterEnabled()) + goto l_end; + + if (!is_on()) + /* We check to see whether we can switch semi-sync ON. */ + try_switch_on(server_id, log_file_name, log_file_pos); + + /* The position should increase monotonically, if there is only one + * thread sending the binlog to the slave. + * In reality, to improve the transaction availability, we allow multiple + * sync replication slaves. So, if any one of them get the transaction, + * the transaction session in the primary can move forward. + */ + if (reply_file_name_inited_) + { + cmp = ActiveTranx::compare(log_file_name, log_file_pos, + reply_file_name_, reply_file_pos_); + + /* If the requested position is behind the sending binlog position, + * would not adjust sending binlog position. + * We based on the assumption that there are multiple semi-sync slave, + * and at least one of them shou/ld be up to date. + * If all semi-sync slaves are behind, at least initially, the primary + * can find the situation after the waiting timeout. After that, some + * slaves should catch up quickly. + */ + if (cmp < 0) + { + /* If the position is behind, do not copy it. */ + need_copy_send_pos = false; + } + } + + if (need_copy_send_pos) + { + strcpy(reply_file_name_, log_file_name); + reply_file_pos_ = log_file_pos; + reply_file_name_inited_ = true; + + /* Remove all active transaction nodes before this point. */ + assert(active_tranxs_ != NULL); + active_tranxs_->clear_active_tranx_nodes(log_file_name, log_file_pos); + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: Got reply at (%s, %lu)", kWho, + log_file_name, (unsigned long)log_file_pos); + } + + if (wait_sessions_ > 0) + { + /* Let us check if some of the waiting threads doing a trx + * commit can now proceed. + */ + cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_, + wait_file_name_, wait_file_pos_); + if (cmp >= 0) + { + /* Yes, at least one waiting thread can now proceed: + * let us release all waiting threads with a broadcast + */ + can_release_threads = true; + wait_file_name_inited_ = false; + } + } + + l_end: + unlock(); + + if (can_release_threads) + { + if (trace_level_ & kTraceDetail) + sql_print_information("%s: signal all waiting threads.", kWho); + + cond_broadcast(); + } + + return function_exit(kWho, 0); +} + +int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, + my_off_t trx_wait_binlog_pos) +{ + const char *kWho = "ReplSemiSyncMaster::commitTrx"; + + function_enter(kWho); + + if (getMasterEnabled() && trx_wait_binlog_name) + { + struct timeval start_tv; + struct timespec abstime; + int wait_result, start_time_err; + const char *old_msg= 0; + + start_time_err = gettimeofday(&start_tv, 0); + + /* Acquire the mutex. */ + lock(); + + /* This must be called after acquired the lock */ + old_msg= thd_enter_cond(NULL, &COND_binlog_send_, &LOCK_binlog_, + "Waiting for semi-sync ACK from slave"); + + /* This is the real check inside the mutex. */ + if (!getMasterEnabled() || !is_on() || !rpl_semi_sync_master_clients) + goto l_end; + + if (trace_level_ & kTraceDetail) + { + sql_print_information("%s: wait pos (%s, %lu), repl(%d)\n", kWho, + trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos, + (int)is_on()); + } + + while (is_on()) + { + int cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_, + trx_wait_binlog_name, trx_wait_binlog_pos); + if (cmp >= 0) + { + /* We have already sent the relevant binlog to the slave: no need to + * wait here. + */ + if (trace_level_ & kTraceDetail) + sql_print_information("%s: Binlog reply is ahead (%s, %lu),", + kWho, reply_file_name_, (unsigned long)reply_file_pos_); + break; + } + + /* Let us update the info about the minimum binlog position of waiting + * threads. + */ + if (wait_file_name_inited_) + { + cmp = ActiveTranx::compare(trx_wait_binlog_name, trx_wait_binlog_pos, + wait_file_name_, wait_file_pos_); + if (cmp <= 0) + { + /* This thd has a lower position, let's update the minimum info. */ + strcpy(wait_file_name_, trx_wait_binlog_name); + wait_file_pos_ = trx_wait_binlog_pos; + + wait_backtraverse_++; + if (trace_level_ & kTraceDetail) + sql_print_information("%s: move back wait position (%s, %lu),", + kWho, wait_file_name_, (unsigned long)wait_file_pos_); + } + } + else + { + strcpy(wait_file_name_, trx_wait_binlog_name); + wait_file_pos_ = trx_wait_binlog_pos; + wait_file_name_inited_ = true; + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: init wait position (%s, %lu),", + kWho, wait_file_name_, (unsigned long)wait_file_pos_); + } + + if (start_time_err == 0) + { + int diff_usecs = start_tv.tv_usec + wait_timeout_ * TIME_THOUSAND; + + /* Calcuate the waiting period. */ + abstime.tv_sec = start_tv.tv_sec; + if (diff_usecs < TIME_MILLION) + { + abstime.tv_nsec = diff_usecs * TIME_THOUSAND; + } + else + { + while (diff_usecs >= TIME_MILLION) + { + abstime.tv_sec++; + diff_usecs -= TIME_MILLION; + } + abstime.tv_nsec = diff_usecs * TIME_THOUSAND; + } + + /* In semi-synchronous replication, we wait until the binlog-dump + * thread has received the reply on the relevant binlog segment from the + * replication slave. + * + * Let us suspend this thread to wait on the condition; + * when replication has progressed far enough, we will release + * these waiting threads. + */ + wait_sessions_++; + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: wait %lu ms for binlog sent (%s, %lu)", + kWho, wait_timeout_, + wait_file_name_, (unsigned long)wait_file_pos_); + + wait_result = cond_timewait(&abstime); + wait_sessions_--; + + if (wait_result != 0) + { + /* This is a real wait timeout. */ + sql_print_warning("Timeout waiting for reply of binlog (file: %s, pos: %lu), " + "semi-sync up to file %s, position %lu.", + trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos, + reply_file_name_, (unsigned long)reply_file_pos_); + total_wait_timeouts_++; + + /* switch semi-sync off */ + switch_off(); + } + else + { + int wait_time; + + wait_time = getWaitTime(start_tv); + if (wait_time < 0) + { + if (trace_level_ & kTraceGeneral) + { + /* This is a time/gettimeofday function call error. */ + sql_print_error("Replication semi-sync gettimeofday fail1 at " + "wait position (%s, %lu)", + trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos); + } + timefunc_fails_++; + } + else + { + total_trx_wait_num_++; + total_trx_wait_time_ += wait_time; + } + } + } + else + { + if (trace_level_ & kTraceGeneral) + { + /* This is a gettimeofday function call error. */ + sql_print_error("Replication semi-sync gettimeofday fail2 at " + "wait position (%s, %lu)", + trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos); + } + timefunc_fails_++; + + /* switch semi-sync off */ + switch_off(); + } + } + + l_end: + /* Update the status counter. */ + if (is_on() && rpl_semi_sync_master_clients) + enabled_transactions_++; + else + disabled_transactions_++; + + /* The lock held will be released by thd_exit_cond, so no need to + call unlock() here */ + thd_exit_cond(NULL, old_msg); + } + + return function_exit(kWho, 0); +} + +/* Indicate that semi-sync replication is OFF now. + * + * What should we do when it is disabled? The problem is that we want + * the semi-sync replication enabled again when the slave catches up + * later. But, it is not that easy to detect that the slave has caught + * up. This is caused by the fact that MySQL's replication protocol is + * asynchronous, meaning that if the master does not use the semi-sync + * protocol, the slave would not send anything to the master. + * Still, if the master is sending (N+1)-th event, we assume that it is + * an indicator that the slave has received N-th event and earlier ones. + * + * If semi-sync is disabled, all transactions still update the wait + * position with the last position in binlog. But no transactions will + * wait for confirmations and the active transaction list would not be + * maintained. In binlog dump thread, updateSyncHeader() checks whether + * the current sending event catches up with last wait position. If it + * does match, semi-sync will be switched on again. + */ +int ReplSemiSyncMaster::switch_off() +{ + const char *kWho = "ReplSemiSyncMaster::switch_off"; + int result; + + function_enter(kWho); + state_ = false; + + /* Clear the active transaction list. */ + assert(active_tranxs_ != NULL); + result = active_tranxs_->clear_active_tranx_nodes(NULL, 0); + + switched_off_times_++; + wait_file_name_inited_ = false; + reply_file_name_inited_ = false; + sql_print_information("Semi-sync replication switched OFF."); + cond_broadcast(); /* wake up all waiting threads */ + + return function_exit(kWho, result); +} + +int ReplSemiSyncMaster::try_switch_on(int server_id, + const char *log_file_name, + my_off_t log_file_pos) +{ + const char *kWho = "ReplSemiSyncMaster::try_switch_on"; + bool semi_sync_on = false; + + function_enter(kWho); + + /* If the current sending event's position is larger than or equal to the + * 'largest' commit transaction binlog position, the slave is already + * catching up now and we can switch semi-sync on here. + * If commit_file_name_inited_ indicates there are no recent transactions, + * we can enable semi-sync immediately. + */ + if (commit_file_name_inited_) + { + int cmp = ActiveTranx::compare(log_file_name, log_file_pos, + commit_file_name_, commit_file_pos_); + semi_sync_on = (cmp >= 0); + } + else + { + semi_sync_on = true; + } + + if (semi_sync_on) + { + /* Switch semi-sync replication on. */ + state_ = true; + + sql_print_information("Semi-sync replication switched ON with slave (server_id: %d) " + "at (%s, %lu)", + server_id, log_file_name, + (unsigned long)log_file_pos); + } + + return function_exit(kWho, 0); +} + +int ReplSemiSyncMaster::reserveSyncHeader(unsigned char *header, + unsigned long size) +{ + const char *kWho = "ReplSemiSyncMaster::reserveSyncHeader"; + function_enter(kWho); + + int hlen=0; + if (!is_semi_sync_slave()) + { + hlen= 0; + } + else + { + /* No enough space for the extra header, disable semi-sync master */ + if (sizeof(kSyncHeader) > size) + { + sql_print_warning("No enough space in the packet " + "for semi-sync extra header, " + "semi-sync replication disabled"); + disableMaster(); + return 0; + } + + /* Set the magic number and the sync status. By default, no sync + * is required. + */ + memcpy(header, kSyncHeader, sizeof(kSyncHeader)); + hlen= sizeof(kSyncHeader); + } + return function_exit(kWho, hlen); +} + +int ReplSemiSyncMaster::updateSyncHeader(unsigned char *packet, + const char *log_file_name, + my_off_t log_file_pos, + uint32 server_id) +{ + const char *kWho = "ReplSemiSyncMaster::updateSyncHeader"; + int cmp = 0; + bool sync = false; + + /* If the semi-sync master is not enabled, or the slave is not a semi-sync + * target, do not request replies from the slave. + */ + if (!getMasterEnabled() || !is_semi_sync_slave()) + { + sync = false; + return 0; + } + + function_enter(kWho); + + lock(); + + /* This is the real check inside the mutex. */ + if (!getMasterEnabled()) + { + sync = false; + goto l_end; + } + + if (is_on()) + { + /* semi-sync is ON */ + sync = false; /* No sync unless a transaction is involved. */ + + if (reply_file_name_inited_) + { + cmp = ActiveTranx::compare(log_file_name, log_file_pos, + reply_file_name_, reply_file_pos_); + if (cmp <= 0) + { + /* If we have already got the reply for the event, then we do + * not need to sync the transaction again. + */ + goto l_end; + } + } + + if (wait_file_name_inited_) + { + cmp = ActiveTranx::compare(log_file_name, log_file_pos, + wait_file_name_, wait_file_pos_); + } + else + { + cmp = 1; + } + + /* If we are already waiting for some transaction replies which + * are later in binlog, do not wait for this one event. + */ + if (cmp >= 0) + { + /* + * We only wait if the event is a transaction's ending event. + */ + assert(active_tranxs_ != NULL); + sync = active_tranxs_->is_tranx_end_pos(log_file_name, + log_file_pos); + } + } + else + { + if (commit_file_name_inited_) + { + int cmp = ActiveTranx::compare(log_file_name, log_file_pos, + commit_file_name_, commit_file_pos_); + sync = (cmp >= 0); + } + else + { + sync = true; + } + } + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: server(%d), (%s, %lu) sync(%d), repl(%d)", + kWho, server_id, log_file_name, + (unsigned long)log_file_pos, sync, (int)is_on()); + + l_end: + unlock(); + + /* We do not need to clear sync flag because we set it to 0 when we + * reserve the packet header. + */ + if (sync) + (packet)[2] = kPacketFlagSync; + + return function_exit(kWho, 0); +} + +int ReplSemiSyncMaster::writeTranxInBinlog(const char* log_file_name, + my_off_t log_file_pos) +{ + const char *kWho = "ReplSemiSyncMaster::writeTranxInBinlog"; + int result = 0; + + function_enter(kWho); + + lock(); + + /* This is the real check inside the mutex. */ + if (!getMasterEnabled()) + goto l_end; + + /* Update the 'largest' transaction commit position seen so far even + * though semi-sync is switched off. + * It is much better that we update commit_file_* here, instead of + * inside commitTrx(). This is mostly because updateSyncHeader() + * will watch for commit_file_* to decide whether to switch semi-sync + * on. The detailed reason is explained in function updateSyncHeader(). + */ + if (commit_file_name_inited_) + { + int cmp = ActiveTranx::compare(log_file_name, log_file_pos, + commit_file_name_, commit_file_pos_); + if (cmp > 0) + { + /* This is a larger position, let's update the maximum info. */ + strcpy(commit_file_name_, log_file_name); + commit_file_pos_ = log_file_pos; + } + } + else + { + strcpy(commit_file_name_, log_file_name); + commit_file_pos_ = log_file_pos; + commit_file_name_inited_ = true; + } + + if (is_on() && rpl_semi_sync_master_clients) + { + assert(active_tranxs_ != NULL); + if(active_tranxs_->insert_tranx_node(log_file_name, log_file_pos)) + { + /* + if insert tranx_node failed, print a warning message + and turn off semi-sync + */ + sql_print_warning("Semi-sync failed to insert tranx_node for binlog file: %s, position: %ul", + log_file_name, log_file_pos); + switch_off(); + } + } + + l_end: + unlock(); + + return function_exit(kWho, result); +} + +int ReplSemiSyncMaster::resetMaster() +{ + const char *kWho = "ReplSemiSyncMaster::resetMaster"; + int result = 0; + + function_enter(kWho); + + + lock(); + + state_ = getMasterEnabled()? 1 : 0; + + wait_file_name_inited_ = false; + reply_file_name_inited_ = false; + commit_file_name_inited_ = false; + + enabled_transactions_ = 0; + disabled_transactions_ = 0; + switched_off_times_ = 0; + timefunc_fails_ = 0; + wait_sessions_ = 0; + wait_backtraverse_ = 0; + total_trx_wait_num_ = 0; + total_trx_wait_time_ = 0; + total_net_wait_num_ = 0; + total_net_wait_time_ = 0; + + unlock(); + + return function_exit(kWho, result); +} + +void ReplSemiSyncMaster::setExportStats() +{ + lock(); + + rpl_semi_sync_master_status = state_ && rpl_semi_sync_master_clients; + rpl_semi_sync_master_yes_transactions = enabled_transactions_; + rpl_semi_sync_master_no_transactions = disabled_transactions_; + rpl_semi_sync_master_off_times = switched_off_times_; + rpl_semi_sync_master_timefunc_fails = timefunc_fails_; + rpl_semi_sync_master_num_timeouts = total_wait_timeouts_; + rpl_semi_sync_master_wait_sessions = wait_sessions_; + rpl_semi_sync_master_back_wait_pos = wait_backtraverse_; + rpl_semi_sync_master_trx_wait_num = total_trx_wait_num_; + rpl_semi_sync_master_trx_wait_time = + ((total_trx_wait_num_) ? + (unsigned long)((double)total_trx_wait_time_ / + ((double)total_trx_wait_num_)) : 0); + rpl_semi_sync_master_net_wait_num = total_net_wait_num_; + rpl_semi_sync_master_net_wait_time = + ((total_net_wait_num_) ? + (unsigned long)((double)total_net_wait_time_ / + ((double)total_net_wait_num_)) : 0); + + rpl_semi_sync_master_net_wait_total_time = total_net_wait_time_; + rpl_semi_sync_master_trx_wait_total_time = total_trx_wait_time_; + + unlock(); +} + +/* Get the waiting time given the wait's staring time. + * + * Return: + * >= 0: the waiting time in microsecons(us) + * < 0: error in gettimeofday or time back traverse + */ +static int getWaitTime(const struct timeval& start_tv) +{ + unsigned long long start_usecs, end_usecs; + struct timeval end_tv; + int end_time_err; + + /* Starting time in microseconds(us). */ + start_usecs = start_tv.tv_sec * TIME_MILLION + start_tv.tv_usec; + + /* Get the wait time interval. */ + end_time_err = gettimeofday(&end_tv, 0); + + /* Ending time in microseconds(us). */ + end_usecs = end_tv.tv_sec * TIME_MILLION + end_tv.tv_usec; + + if (end_time_err != 0 || end_usecs < start_usecs) + return -1; + + return (int)(end_usecs - start_usecs); +} diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h new file mode 100644 index 00000000000..a1697b2ae67 --- /dev/null +++ b/plugin/semisync/semisync_master.h @@ -0,0 +1,366 @@ +/* Copyright (C) 2007 Google Inc. + Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#ifndef SEMISYNC_MASTER_H +#define SEMISYNC_MASTER_H + +#include "semisync.h" + +/** + This class manages memory for active transaction list. + + We record each active transaction with a TranxNode. Because each + session can only have only one open transaction, the total active + transaction nodes can not exceed the maximum sessions. Currently + in MySQL, sessions are the same as connections. +*/ +class ActiveTranx + :public Trace { +private: + struct TranxNode { + char *log_name_; + my_off_t log_pos_; + struct TranxNode *next_; /* the next node in the sorted list */ + struct TranxNode *hash_next_; /* the next node during hash collision */ + }; + + /* The following data structure maintains an active transaction list. */ + TranxNode *node_array_; + TranxNode *free_pool_; + + /* These two record the active transaction list in sort order. */ + TranxNode *trx_front_, *trx_rear_; + + TranxNode **trx_htb_; /* A hash table on active transactions. */ + + int num_transactions_; /* maximum transactions */ + int num_entries_; /* maximum hash table entries */ + pthread_mutex_t *lock_; /* mutex lock */ + + inline void assert_lock_owner(); + + inline TranxNode* alloc_tranx_node(); + + inline unsigned int calc_hash(const unsigned char *key,unsigned int length); + unsigned int get_hash_value(const char *log_file_name, my_off_t log_file_pos); + + int compare(const char *log_file_name1, my_off_t log_file_pos1, + const TranxNode *node2) { + return compare(log_file_name1, log_file_pos1, + node2->log_name_, node2->log_pos_); + } + int compare(const TranxNode *node1, + const char *log_file_name2, my_off_t log_file_pos2) { + return compare(node1->log_name_, node1->log_pos_, + log_file_name2, log_file_pos2); + } + int compare(const TranxNode *node1, const TranxNode *node2) { + return compare(node1->log_name_, node1->log_pos_, + node2->log_name_, node2->log_pos_); + } + +public: + ActiveTranx(int max_connections, pthread_mutex_t *lock, + unsigned long trace_level); + ~ActiveTranx(); + + /* Insert an active transaction node with the specified position. + * + * Return: + * 0: success; -1 or otherwise: error + */ + int insert_tranx_node(const char *log_file_name, my_off_t log_file_pos); + + /* Clear the active transaction nodes until(inclusive) the specified + * position. + * If log_file_name is NULL, everything will be cleared: the sorted + * list and the hash table will be reset to empty. + * + * Return: + * 0: success; -1 or otherwise: error + */ + int clear_active_tranx_nodes(const char *log_file_name, + my_off_t log_file_pos); + + /* Given a position, check to see whether the position is an active + * transaction's ending position by probing the hash table. + */ + bool is_tranx_end_pos(const char *log_file_name, my_off_t log_file_pos); + + /* Given two binlog positions, compare which one is bigger based on + * (file_name, file_position). + */ + static int compare(const char *log_file_name1, my_off_t log_file_pos1, + const char *log_file_name2, my_off_t log_file_pos2); + +}; + +/** + The extension class for the master of semi-synchronous replication +*/ +class ReplSemiSyncMaster + :public ReplSemiSyncBase { + private: + ActiveTranx *active_tranxs_; /* active transaction list: the list will + be cleared when semi-sync switches off. */ + + /* True when initObject has been called */ + bool init_done_; + + /* This cond variable is signaled when enough binlog has been sent to slave, + * so that a waiting trx can return the 'ok' to the client for a commit. + */ + pthread_cond_t COND_binlog_send_; + + /* Mutex that protects the following state variables and the active + * transaction list. + * Under no cirumstances we can acquire mysql_bin_log.LOCK_log if we are + * already holding LOCK_binlog_ because it can cause deadlocks. + */ + pthread_mutex_t LOCK_binlog_; + + /* This is set to true when reply_file_name_ contains meaningful data. */ + bool reply_file_name_inited_; + + /* The binlog name up to which we have received replies from any slaves. */ + char reply_file_name_[FN_REFLEN]; + + /* The position in that file up to which we have the reply from any slaves. */ + my_off_t reply_file_pos_; + + /* This is set to true when we know the 'smallest' wait position. */ + bool wait_file_name_inited_; + + /* NULL, or the 'smallest' filename that a transaction is waiting for + * slave replies. + */ + char wait_file_name_[FN_REFLEN]; + + /* The smallest position in that file that a trx is waiting for: the trx + * can proceed and send an 'ok' to the client when the master has got the + * reply from the slave indicating that it already got the binlog events. + */ + my_off_t wait_file_pos_; + + /* This is set to true when we know the 'largest' transaction commit + * position in the binlog file. + * We always maintain the position no matter whether semi-sync is switched + * on switched off. When a transaction wait timeout occurs, semi-sync will + * switch off. Binlog-dump thread can use the three fields to detect when + * slaves catch up on replication so that semi-sync can switch on again. + */ + bool commit_file_name_inited_; + + /* The 'largest' binlog filename that a commit transaction is seeing. */ + char commit_file_name_[FN_REFLEN]; + + /* The 'largest' position in that file that a commit transaction is seeing. */ + my_off_t commit_file_pos_; + + /* All global variables which can be set by parameters. */ + volatile bool master_enabled_; /* semi-sync is enabled on the master */ + unsigned long wait_timeout_; /* timeout period(ms) during tranx wait */ + + /* All status variables. */ + bool state_; /* whether semi-sync is switched */ + unsigned long enabled_transactions_; /* semi-sync'ed tansactions */ + unsigned long disabled_transactions_; /* non-semi-sync'ed tansactions */ + unsigned long switched_off_times_; /* how many times are switched off? */ + unsigned long timefunc_fails_; /* how many time function fails? */ + unsigned long total_wait_timeouts_; /* total number of wait timeouts */ + unsigned long wait_sessions_; /* how many sessions wait for replies? */ + unsigned long wait_backtraverse_; /* wait position back traverses */ + unsigned long long total_trx_wait_num_; /* total trx waits: non-timeout ones */ + unsigned long long total_trx_wait_time_; /* total trx wait time: in us */ + unsigned long long total_net_wait_num_; /* total network waits */ + unsigned long long total_net_wait_time_; /* total network wait time */ + + /* The number of maximum active transactions. This should be the same as + * maximum connections because MySQL does not do connection sharing now. + */ + int max_transactions_; + + void lock(); + void unlock(); + void cond_broadcast(); + int cond_timewait(struct timespec *wait_time); + + /* Is semi-sync replication on? */ + bool is_on() { + return (state_); + } + + void set_master_enabled(bool enabled) { + master_enabled_ = enabled; + } + + /* Switch semi-sync off because of timeout in transaction waiting. */ + int switch_off(); + + /* Switch semi-sync on when slaves catch up. */ + int try_switch_on(int server_id, + const char *log_file_name, my_off_t log_file_pos); + + public: + ReplSemiSyncMaster(); + ~ReplSemiSyncMaster(); + + bool getMasterEnabled() { + return master_enabled_; + } + void setTraceLevel(unsigned long trace_level) { + trace_level_ = trace_level; + if (active_tranxs_) + active_tranxs_->trace_level_ = trace_level; + } + + /* Set the transaction wait timeout period, in milliseconds. */ + void setWaitTimeout(unsigned long wait_timeout) { + wait_timeout_ = wait_timeout; + } + + /* Initialize this class after MySQL parameters are initialized. this + * function should be called once at bootstrap time. + */ + int initObject(); + + /* Enable the object to enable semi-sync replication inside the master. */ + int enableMaster(); + + /* Enable the object to enable semi-sync replication inside the master. */ + int disableMaster(); + + /* Add a semi-sync replication slave */ + void add_slave(); + + /* Remove a semi-sync replication slave */ + void remove_slave(); + + /* Is the slave servered by the thread requested semi-sync */ + bool is_semi_sync_slave(); + + int reportReplyBinlog(const char *log_file_pos); + + /* In semi-sync replication, reports up to which binlog position we have + * received replies from the slave indicating that it already get the events. + * + * Input: + * server_id - (IN) master server id number + * log_file_name - (IN) binlog file name + * end_offset - (IN) the offset in the binlog file up to which we have + * the replies from the slave + * + * Return: + * 0: success; -1 or otherwise: error + */ + int reportReplyBinlog(uint32 server_id, + const char* log_file_name, + my_off_t end_offset); + + /* Commit a transaction in the final step. This function is called from + * InnoDB before returning from the low commit. If semi-sync is switch on, + * the function will wait to see whether binlog-dump thread get the reply for + * the events of the transaction. Remember that this is not a direct wait, + * instead, it waits to see whether the binlog-dump thread has reached the + * point. If the wait times out, semi-sync status will be switched off and + * all other transaction would not wait either. + * + * Input: (the transaction events' ending binlog position) + * trx_wait_binlog_name - (IN) ending position's file name + * trx_wait_binlog_pos - (IN) ending position's file offset + * + * Return: + * 0: success; -1 or otherwise: error + */ + int commitTrx(const char* trx_wait_binlog_name, + my_off_t trx_wait_binlog_pos); + + /* Reserve space in the replication event packet header: + * . slave semi-sync off: 1 byte - (0) + * . slave semi-sync on: 3 byte - (0, 0xef, 0/1} + * + * Input: + * header - (IN) the header buffer + * size - (IN) size of the header buffer + * + * Return: + * size of the bytes reserved for header + */ + int reserveSyncHeader(unsigned char *header, unsigned long size); + + /* Update the sync bit in the packet header to indicate to the slave whether + * the master will wait for the reply of the event. If semi-sync is switched + * off and we detect that the slave is catching up, we switch semi-sync on. + * + * Input: + * packet - (IN) the packet containing the replication event + * log_file_name - (IN) the event ending position's file name + * log_file_pos - (IN) the event ending position's file offset + * server_id - (IN) master server id number + * + * Return: + * 0: success; -1 or otherwise: error + */ + int updateSyncHeader(unsigned char *packet, + const char *log_file_name, + my_off_t log_file_pos, + uint32 server_id); + + /* Called when a transaction finished writing binlog events. + * . update the 'largest' transactions' binlog event position + * . insert the ending position in the active transaction list if + * semi-sync is on + * + * Input: (the transaction events' ending binlog position) + * log_file_name - (IN) transaction ending position's file name + * log_file_pos - (IN) transaction ending position's file offset + * + * Return: + * 0: success; -1 or otherwise: error + */ + int writeTranxInBinlog(const char* log_file_name, my_off_t log_file_pos); + + /* Export internal statistics for semi-sync replication. */ + void setExportStats(); + + /* 'reset master' command is issued from the user and semi-sync need to + * go off for that. + */ + int resetMaster(); +}; + +/* System and status variables for the master component */ +extern char rpl_semi_sync_master_enabled; +extern unsigned long rpl_semi_sync_master_timeout; +extern unsigned long rpl_semi_sync_master_trace_level; +extern unsigned long rpl_semi_sync_master_status; +extern unsigned long rpl_semi_sync_master_yes_transactions; +extern unsigned long rpl_semi_sync_master_no_transactions; +extern unsigned long rpl_semi_sync_master_off_times; +extern unsigned long rpl_semi_sync_master_timefunc_fails; +extern unsigned long rpl_semi_sync_master_num_timeouts; +extern unsigned long rpl_semi_sync_master_wait_sessions; +extern unsigned long rpl_semi_sync_master_back_wait_pos; +extern unsigned long rpl_semi_sync_master_trx_wait_time; +extern unsigned long rpl_semi_sync_master_net_wait_time; +extern unsigned long long rpl_semi_sync_master_net_wait_num; +extern unsigned long long rpl_semi_sync_master_trx_wait_num; +extern unsigned long long rpl_semi_sync_master_net_wait_total_time; +extern unsigned long long rpl_semi_sync_master_trx_wait_total_time; +extern unsigned long rpl_semi_sync_master_clients; + +#endif /* SEMISYNC_MASTER_H */ diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc new file mode 100644 index 00000000000..dc19d09e622 --- /dev/null +++ b/plugin/semisync/semisync_master_plugin.cc @@ -0,0 +1,380 @@ +/* Copyright (C) 2007 Google Inc. + Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#include "semisync_master.h" + +ReplSemiSyncMaster repl_semisync; + +int repl_semi_report_binlog_update(Binlog_storage_param *param, + const char *log_file, + my_off_t log_pos, uint32 flags) +{ + int error= 0; + + if (repl_semisync.getMasterEnabled()) + { + /* + Let us store the binlog file name and the position, so that + we know how long to wait for the binlog to the replicated to + the slave in synchronous replication. + */ + error= repl_semisync.writeTranxInBinlog(log_file, + log_pos); + } + + return error; +} + +int repl_semi_request_commit(Trans_param *param) +{ + return 0; +} + +int repl_semi_report_commit(Trans_param *param) +{ + + bool is_real_trans= param->flags & TRANS_IS_REAL_TRANS; + + if (is_real_trans && param->log_pos) + { + const char *binlog_name= param->log_file; + return repl_semisync.commitTrx(binlog_name, param->log_pos); + } + return 0; +} + +int repl_semi_report_rollback(Trans_param *param) +{ + return repl_semi_report_commit(param); +} + +int repl_semi_binlog_dump_start(Binlog_transmit_param *param, + const char *log_file, + my_off_t log_pos) +{ + bool semi_sync_slave= repl_semisync.is_semi_sync_slave(); + + if (semi_sync_slave) + /* One more semi-sync slave */ + repl_semisync.add_slave(); + sql_print_information("Start %s binlog_dump to slave (server_id: %d), pos(%s, %lu)", + semi_sync_slave ? "semi-sync" : "asynchronous", + param->server_id, log_file, (unsigned long)log_pos); + + return 0; +} + +int repl_semi_binlog_dump_end(Binlog_transmit_param *param) +{ + bool semi_sync_slave= repl_semisync.is_semi_sync_slave(); + + sql_print_information("Stop %s binlog_dump to slave (server_id: %d)", + semi_sync_slave ? "semi-sync" : "asynchronous", + param->server_id); + if (semi_sync_slave) + { + /* One less semi-sync slave */ + repl_semisync.remove_slave(); + } + return 0; +} + +int repl_semi_reserve_header(Binlog_transmit_param *param, + unsigned char *header, + unsigned long size, unsigned long *len) +{ + *len += repl_semisync.reserveSyncHeader(header, size); + return 0; +} + +int repl_semi_before_send_event(Binlog_transmit_param *param, + unsigned char *packet, unsigned long len, + const char *log_file, my_off_t log_pos) +{ + return repl_semisync.updateSyncHeader(packet, + log_file, + log_pos, + param->server_id); +} + +int repl_semi_after_send_event(Binlog_transmit_param *param, + const char *event_buf, unsigned long len) +{ + return 0; +} + +int repl_semi_reset_master(Binlog_transmit_param *param) +{ + if (repl_semisync.resetMaster()) + return 1; + return 0; +} + +/* + semisync system variables + */ +static void fix_rpl_semi_sync_master_timeout(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val); + +static void fix_rpl_semi_sync_master_trace_level(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val); + +static void fix_rpl_semi_sync_master_enabled(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val); + +static void fix_rpl_semi_sync_master_reply_log_file_pos(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val); + +static MYSQL_SYSVAR_BOOL(enabled, rpl_semi_sync_master_enabled, + PLUGIN_VAR_OPCMDARG, + "Enable semi-synchronous replication master (disabled by default). ", + NULL, // check + &fix_rpl_semi_sync_master_enabled, // update + 0); + +static MYSQL_SYSVAR_ULONG(timeout, rpl_semi_sync_master_timeout, + PLUGIN_VAR_OPCMDARG, + "The timeout value (in ms) for semi-synchronous replication in the master", + NULL, // check + fix_rpl_semi_sync_master_timeout, // update + 10000, 0, ~0L, 1); + +static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_master_trace_level, + PLUGIN_VAR_OPCMDARG, + "The tracing level for semi-sync replication.", + NULL, // check + &fix_rpl_semi_sync_master_trace_level, // update + 32, 0, ~0L, 1); + +/* + Use a SESSION instead of GLOBAL variable for slave to send reply to + avoid requiring SUPER privilege. +*/ +static MYSQL_THDVAR_STR(reply_log_file_pos, + PLUGIN_VAR_NOCMDOPT, + "The log filename and position slave has queued to relay log.", + NULL, // check + &fix_rpl_semi_sync_master_reply_log_file_pos, + ""); + +static SYS_VAR* semi_sync_master_system_vars[]= { + MYSQL_SYSVAR(enabled), + MYSQL_SYSVAR(timeout), + MYSQL_SYSVAR(trace_level), + MYSQL_SYSVAR(reply_log_file_pos), + NULL, +}; + + +static void fix_rpl_semi_sync_master_timeout(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val) +{ + *(unsigned long *)ptr= *(unsigned long *)val; + repl_semisync.setWaitTimeout(rpl_semi_sync_master_timeout); + return; +} + +static void fix_rpl_semi_sync_master_trace_level(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val) +{ + *(unsigned long *)ptr= *(unsigned long *)val; + repl_semisync.setTraceLevel(rpl_semi_sync_master_trace_level); + return; +} + +static void fix_rpl_semi_sync_master_enabled(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val) +{ + *(char *)ptr= *(char *)val; + if (rpl_semi_sync_master_enabled) + { + if (repl_semisync.enableMaster() != 0) + rpl_semi_sync_master_enabled = false; + } + else + { + if (repl_semisync.disableMaster() != 0) + rpl_semi_sync_master_enabled = true; + } + + return; +} + +static void fix_rpl_semi_sync_master_reply_log_file_pos(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val) +{ + const char *log_file_pos= *(char **)val; + + if (repl_semisync.reportReplyBinlog(log_file_pos)) + sql_print_error("report slave binlog reply failed."); + + return; +} + +Trans_observer trans_observer = { + sizeof(Trans_observer), // len + + repl_semi_report_commit, // after_commit + repl_semi_report_rollback, // after_rollback +}; + +Binlog_storage_observer storage_observer = { + sizeof(Binlog_storage_observer), // len + + repl_semi_report_binlog_update, // report_update +}; + +Binlog_transmit_observer transmit_observer = { + sizeof(Binlog_transmit_observer), // len + + repl_semi_binlog_dump_start, // start + repl_semi_binlog_dump_end, // stop + repl_semi_reserve_header, // reserve_header + repl_semi_before_send_event, // before_send_event + repl_semi_after_send_event, // after_send_event + repl_semi_reset_master, // reset +}; + + +#define SHOW_FNAME(name) \ + rpl_semi_sync_master_show_##name + +#define DEF_SHOW_FUNC(name, show_type) \ + static int SHOW_FNAME(name)(MYSQL_THD thd, SHOW_VAR *var, char *buff) \ + { \ + repl_semisync.setExportStats(); \ + var->type= show_type; \ + var->value= (char *)&rpl_semi_sync_master_##name; \ + return 0; \ + } + +DEF_SHOW_FUNC(clients, SHOW_LONG) +DEF_SHOW_FUNC(net_wait_time, SHOW_LONG) +DEF_SHOW_FUNC(net_wait_total_time, SHOW_LONGLONG) +DEF_SHOW_FUNC(net_wait_num, SHOW_LONGLONG) +DEF_SHOW_FUNC(off_times, SHOW_LONG) +DEF_SHOW_FUNC(no_transactions, SHOW_LONG) +DEF_SHOW_FUNC(status, SHOW_BOOL) +DEF_SHOW_FUNC(timefunc_fails, SHOW_LONG) +DEF_SHOW_FUNC(trx_wait_time, SHOW_LONG) +DEF_SHOW_FUNC(trx_wait_total_time, SHOW_LONGLONG) +DEF_SHOW_FUNC(trx_wait_num, SHOW_LONGLONG) +DEF_SHOW_FUNC(back_wait_pos, SHOW_LONG) +DEF_SHOW_FUNC(wait_sessions, SHOW_LONG) +DEF_SHOW_FUNC(yes_transactions, SHOW_LONG) + + +/* plugin status variables */ +static SHOW_VAR semi_sync_master_status_vars[]= { + {"Rpl_semi_sync_master_clients", (char*) &SHOW_FNAME(clients), SHOW_FUNC}, + {"Rpl_semi_sync_master_net_avg_wait_time", + (char*) &SHOW_FNAME(net_wait_time), SHOW_FUNC}, + {"Rpl_semi_sync_master_net_wait_time", + (char*) &SHOW_FNAME(net_wait_total_time), SHOW_FUNC}, + {"Rpl_semi_sync_master_net_waits", (char*) &SHOW_FNAME(net_wait_num), SHOW_FUNC}, + {"Rpl_semi_sync_master_no_times", (char*) &SHOW_FNAME(off_times), SHOW_FUNC}, + {"Rpl_semi_sync_master_no_tx", (char*) &SHOW_FNAME(no_transactions), SHOW_FUNC}, + {"Rpl_semi_sync_master_status", (char*) &SHOW_FNAME(status), SHOW_FUNC}, + {"Rpl_semi_sync_master_timefunc_failures", + (char*) &SHOW_FNAME(timefunc_fails), SHOW_FUNC}, + {"Rpl_semi_sync_master_tx_avg_wait_time", + (char*) &SHOW_FNAME(trx_wait_time), SHOW_FUNC}, + {"Rpl_semi_sync_master_tx_wait_time", + (char*) &SHOW_FNAME(trx_wait_total_time), SHOW_FUNC}, + {"Rpl_semi_sync_master_tx_waits", (char*) &SHOW_FNAME(trx_wait_num), SHOW_FUNC}, + {"Rpl_semi_sync_master_wait_pos_backtraverse", + (char*) &SHOW_FNAME(back_wait_pos), SHOW_FUNC}, + {"Rpl_semi_sync_master_wait_sessions", + (char*) &SHOW_FNAME(wait_sessions), SHOW_FUNC}, + {"Rpl_semi_sync_master_yes_tx", (char*) &SHOW_FNAME(yes_transactions), SHOW_FUNC}, + {NULL, NULL, SHOW_LONG}, +}; + + +static int semi_sync_master_plugin_init(void *p) +{ + if (repl_semisync.initObject()) + return 1; + if (register_trans_observer(&trans_observer, p)) + return 1; + if (register_binlog_storage_observer(&storage_observer, p)) + return 1; + if (register_binlog_transmit_observer(&transmit_observer, p)) + return 1; + return 0; +} + +static int semi_sync_master_plugin_deinit(void *p) +{ + if (unregister_trans_observer(&trans_observer, p)) + { + sql_print_error("unregister_trans_observer failed"); + return 1; + } + if (unregister_binlog_storage_observer(&storage_observer, p)) + { + sql_print_error("unregister_binlog_storage_observer failed"); + return 1; + } + if (unregister_binlog_transmit_observer(&transmit_observer, p)) + { + sql_print_error("unregister_binlog_transmit_observer failed"); + return 1; + } + sql_print_information("unregister_replicator OK"); + return 0; +} + +struct Mysql_replication semi_sync_master_plugin= { + MYSQL_REPLICATION_INTERFACE_VERSION +}; + +/* + Plugin library descriptor +*/ +mysql_declare_plugin(semi_sync_master) +{ + MYSQL_REPLICATION_PLUGIN, + &semi_sync_master_plugin, + "rpl_semi_sync_master", + "He Zhenxing", + "Semi-synchronous replication master", + PLUGIN_LICENSE_GPL, + semi_sync_master_plugin_init, /* Plugin Init */ + semi_sync_master_plugin_deinit, /* Plugin Deinit */ + 0x0100 /* 1.0 */, + semi_sync_master_status_vars, /* status variables */ + semi_sync_master_system_vars, /* system variables */ + NULL /* config options */ +} +mysql_declare_plugin_end; diff --git a/plugin/semisync/semisync_slave.cc b/plugin/semisync/semisync_slave.cc new file mode 100644 index 00000000000..f6bbb17ce9d --- /dev/null +++ b/plugin/semisync/semisync_slave.cc @@ -0,0 +1,122 @@ +/* Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#include "semisync_slave.h" + +char rpl_semi_sync_slave_enabled; +unsigned long rpl_semi_sync_slave_status= 0; +unsigned long rpl_semi_sync_slave_trace_level; + +int ReplSemiSyncSlave::initObject() +{ + int result= 0; + const char *kWho = "ReplSemiSyncSlave::initObject"; + + if (init_done_) + { + fprintf(stderr, "%s called twice\n", kWho); + return 1; + } + init_done_ = true; + + /* References to the parameter works after set_options(). */ + setSlaveEnabled(rpl_semi_sync_slave_enabled); + setTraceLevel(rpl_semi_sync_slave_trace_level); + + return result; +} + +int ReplSemiSyncSlave::slaveReplyConnect() +{ + if (!mysql_reply && !(mysql_reply= rpl_connect_master(NULL))) + { + sql_print_error("Semisync slave connect to master for reply failed"); + return 1; + } + return 0; +} + +int ReplSemiSyncSlave::slaveReadSyncHeader(const char *header, + unsigned long total_len, + bool *need_reply, + const char **payload, + unsigned long *payload_len) +{ + const char *kWho = "ReplSemiSyncSlave::slaveReadSyncHeader"; + int read_res = 0; + function_enter(kWho); + + if ((unsigned char)(header[0]) == kPacketMagicNum) + { + *need_reply = (header[1] & kPacketFlagSync); + *payload_len = total_len - 2; + *payload = header + 2; + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: reply - %d", kWho, *need_reply); + } + else + { + sql_print_error("Missing magic number for semi-sync packet, packet " + "len: %lu", total_len); + read_res = -1; + } + + return function_exit(kWho, read_res); +} + +int ReplSemiSyncSlave::slaveStart(Binlog_relay_IO_param *param) +{ + bool semi_sync= getSlaveEnabled(); + + sql_print_information("Slave I/O thread: Start %s replication to\ + master '%s@%s:%d' in log '%s' at position %lu", + semi_sync ? "semi-sync" : "asynchronous", + param->user, param->host, param->port, + param->master_log_name[0] ? param->master_log_name : "FIRST", + (unsigned long)param->master_log_pos); + + if (semi_sync && !rpl_semi_sync_slave_status) + rpl_semi_sync_slave_status= 1; + return 0; +} + +int ReplSemiSyncSlave::slaveStop(Binlog_relay_IO_param *param) +{ + if (rpl_semi_sync_slave_status) + rpl_semi_sync_slave_status= 0; + if (mysql_reply) + mysql_close(mysql_reply); + mysql_reply= 0; + return 0; +} + +int ReplSemiSyncSlave::slaveReply(const char *log_name, my_off_t log_pos) +{ + char query[FN_REFLEN + 100]; + sprintf(query, "SET SESSION rpl_semi_sync_master_reply_log_file_pos='%llu:%s'", + (unsigned long long)log_pos, log_name); + if (mysql_real_query(mysql_reply, query, strlen(query))) + { + sql_print_error("Set 'rpl_semi_sync_master_reply_log_file_pos' on master failed"); + mysql_free_result(mysql_store_result(mysql_reply)); + mysql_close(mysql_reply); + mysql_reply= 0; + return 1; + } + mysql_free_result(mysql_store_result(mysql_reply)); + return 0; +} diff --git a/plugin/semisync/semisync_slave.h b/plugin/semisync/semisync_slave.h new file mode 100644 index 00000000000..73bc8aeeade --- /dev/null +++ b/plugin/semisync/semisync_slave.h @@ -0,0 +1,99 @@ +/* Copyright (C) 2006 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#ifndef SEMISYNC_SLAVE_H +#define SEMISYNC_SLAVE_H + +#include "semisync.h" + +/** + The extension class for the slave of semi-synchronous replication +*/ +class ReplSemiSyncSlave + :public ReplSemiSyncBase { +public: + ReplSemiSyncSlave() + :slave_enabled_(false) + {} + ~ReplSemiSyncSlave() {} + + void setTraceLevel(unsigned long trace_level) { + trace_level_ = trace_level; + } + + /* Initialize this class after MySQL parameters are initialized. this + * function should be called once at bootstrap time. + */ + int initObject(); + + bool getSlaveEnabled() { + return slave_enabled_; + } + void setSlaveEnabled(bool enabled) { + slave_enabled_ = enabled; + } + + /* A slave reads the semi-sync packet header and separate the metadata + * from the payload data. + * + * Input: + * header - (IN) packet header pointer + * total_len - (IN) total packet length: metadata + payload + * need_reply - (IN) whether the master is waiting for the reply + * payload - (IN) payload: the replication event + * payload_len - (IN) payload length + * + * Return: + * 0: success; -1 or otherwise: error + */ + int slaveReadSyncHeader(const char *header, unsigned long total_len, bool *need_reply, + const char **payload, unsigned long *payload_len); + + /* A slave replies to the master indicating its replication process. It + * indicates that the slave has received all events before the specified + * binlog position. + * + * Input: + * log_name - (IN) the reply point's binlog file name + * log_pos - (IN) the reply point's binlog file offset + * + * Return: + * 0: success; -1 or otherwise: error + */ + int slaveReply(const char *log_name, my_off_t log_pos); + + /* + Connect to master for sending reply + */ + int slaveReplyConnect(); + + int slaveStart(Binlog_relay_IO_param *param); + int slaveStop(Binlog_relay_IO_param *param); + +private: + /* True when initObject has been called */ + bool init_done_; + bool slave_enabled_; /* semi-sycn is enabled on the slave */ + MYSQL *mysql_reply; /* connection to send reply */ +}; + + +/* System and status variables for the slave component */ +extern char rpl_semi_sync_slave_enabled; +extern unsigned long rpl_semi_sync_slave_trace_level; +extern unsigned long rpl_semi_sync_slave_status; + +#endif /* SEMISYNC_SLAVE_H */ diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc new file mode 100644 index 00000000000..ffc663c9bdb --- /dev/null +++ b/plugin/semisync/semisync_slave_plugin.cc @@ -0,0 +1,224 @@ +/* Copyright (C) 2007 Google Inc. + Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#include "semisync_slave.h" + +ReplSemiSyncSlave repl_semisync; + +/* + indicate whether or not the slave should send a reply to the master. + + This is set to true in repl_semi_slave_read_event if the current + event read is the last event of a transaction. And the value is + checked in repl_semi_slave_queue_event. +*/ +bool semi_sync_need_reply= false; + +int repl_semi_reset_slave(Binlog_relay_IO_param *param) +{ + // TODO: reset semi-sync slave status here + return 0; +} + +int repl_semi_slave_request_dump(Binlog_relay_IO_param *param, + uint32 flags) +{ + MYSQL *mysql= param->mysql; + MYSQL_RES *res= 0; + MYSQL_ROW row; + const char *query; + + if (!repl_semisync.getSlaveEnabled()) + return 0; + + /* + Create the connection that is used to send slave ACK replies to + master + */ + if (repl_semisync.slaveReplyConnect()) + return 1; + + /* Check if master server has semi-sync plugin installed */ + query= "SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled'"; + if (mysql_real_query(mysql, query, strlen(query)) || + !(res= mysql_store_result(mysql))) + { + mysql_free_result(mysql_store_result(mysql)); + sql_print_error("Execution failed on master: %s", query); + return 1; + } + + row= mysql_fetch_row(res); + if (!row || strcmp(row[1], "ON")) + { + /* Master does not support or not configured semi-sync */ + sql_print_warning("Master server does not support or not configured semi-sync replication, fallback to asynchronous"); + rpl_semi_sync_slave_status= 0; + return 0; + } + + /* + Tell master dump thread that we want to do semi-sync + replication + */ + query= "SET @rpl_semi_sync_slave= 1"; + if (mysql_real_query(mysql, query, strlen(query))) + { + sql_print_error("Set 'rpl_semi_sync_slave=1' on master failed"); + mysql_free_result(mysql_store_result(mysql)); + return 1; + } + mysql_free_result(mysql_store_result(mysql)); + rpl_semi_sync_slave_status= 1; + return 0; +} + +int repl_semi_slave_read_event(Binlog_relay_IO_param *param, + const char *packet, unsigned long len, + const char **event_buf, unsigned long *event_len) +{ + if (rpl_semi_sync_slave_status) + return repl_semisync.slaveReadSyncHeader(packet, len, + &semi_sync_need_reply, + event_buf, event_len); + *event_buf= packet; + *event_len= len; + return 0; +} + +int repl_semi_slave_queue_event(Binlog_relay_IO_param *param, + const char *event_buf, + unsigned long event_len, + uint32 flags) +{ + if (rpl_semi_sync_slave_status && semi_sync_need_reply) + return repl_semisync.slaveReply(param->master_log_name, + param->master_log_pos); + return 0; +} + +int repl_semi_slave_io_start(Binlog_relay_IO_param *param) +{ + return repl_semisync.slaveStart(param); +} + +int repl_semi_slave_io_end(Binlog_relay_IO_param *param) +{ + return repl_semisync.slaveStop(param); +} + + +static void fix_rpl_semi_sync_slave_enabled(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val) +{ + *(char *)ptr= *(char *)val; + repl_semisync.setSlaveEnabled(rpl_semi_sync_slave_enabled != 0); + return; +} + +static void fix_rpl_semi_sync_trace_level(MYSQL_THD thd, + SYS_VAR *var, + void *ptr, + const void *val) +{ + *(unsigned long *)ptr= *(unsigned long *)val; + repl_semisync.setTraceLevel(rpl_semi_sync_slave_trace_level); + return; +} + +/* plugin system variables */ +static MYSQL_SYSVAR_BOOL(enabled, rpl_semi_sync_slave_enabled, + PLUGIN_VAR_OPCMDARG, + "Enable semi-synchronous replication slave (disabled by default). ", + NULL, // check + &fix_rpl_semi_sync_slave_enabled, // update + 0); + +static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_slave_trace_level, + PLUGIN_VAR_OPCMDARG, + "The tracing level for semi-sync replication.", + NULL, // check + &fix_rpl_semi_sync_trace_level, // update + 32, 0, ~0L, 1); + +static SYS_VAR* semi_sync_slave_system_vars[]= { + MYSQL_SYSVAR(enabled), + MYSQL_SYSVAR(trace_level), + NULL, +}; + + +/* plugin status variables */ +static SHOW_VAR semi_sync_slave_status_vars[]= { + {"Rpl_semi_sync_slave_status", + (char*) &rpl_semi_sync_slave_status, SHOW_BOOL}, + {NULL, NULL, SHOW_BOOL}, +}; + +Binlog_relay_IO_observer relay_io_observer = { + sizeof(Binlog_relay_IO_observer), // len + + repl_semi_slave_io_start, // start + repl_semi_slave_io_end, // stop + repl_semi_slave_request_dump, // request_transmit + repl_semi_slave_read_event, // after_read_event + repl_semi_slave_queue_event, // after_queue_event + repl_semi_reset_slave, // reset +}; + +static int semi_sync_slave_plugin_init(void *p) +{ + if (repl_semisync.initObject()) + return 1; + if (register_binlog_relay_io_observer(&relay_io_observer, p)) + return 1; + return 0; +} + +static int semi_sync_slave_plugin_deinit(void *p) +{ + if (unregister_binlog_relay_io_observer(&relay_io_observer, p)) + return 1; + return 0; +} + + +struct Mysql_replication semi_sync_slave_plugin= { + MYSQL_REPLICATION_INTERFACE_VERSION +}; + +/* + Plugin library descriptor +*/ +mysql_declare_plugin(semi_sync_slave) +{ + MYSQL_REPLICATION_PLUGIN, + &semi_sync_slave_plugin, + "rpl_semi_sync_slave", + "He Zhenxing", + "Semi-synchronous replication slave", + PLUGIN_LICENSE_GPL, + semi_sync_slave_plugin_init, /* Plugin Init */ + semi_sync_slave_plugin_deinit, /* Plugin Deinit */ + 0x0100 /* 1.0 */, + semi_sync_slave_status_vars, /* status variables */ + semi_sync_slave_system_vars, /* system variables */ + NULL /* config options */ +} +mysql_declare_plugin_end; diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 6f162f4d84d..18508468f60 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -75,6 +75,7 @@ SET (SQL_SOURCE rpl_rli.cc rpl_mi.cc sql_servers.cc sql_connect.cc scheduler.cc sql_profile.cc event_parse_data.cc + rpl_handler.cc ${PROJECT_SOURCE_DIR}/sql/sql_yacc.cc ${PROJECT_SOURCE_DIR}/sql/sql_yacc.h ${PROJECT_SOURCE_DIR}/include/mysqld_error.h diff --git a/sql/Makefile.am b/sql/Makefile.am index 2a12de2eaf6..afce7db59f2 100644 --- a/sql/Makefile.am +++ b/sql/Makefile.am @@ -76,7 +76,8 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ sql_plugin.h authors.h event_parse_data.h \ event_data_objects.h event_scheduler.h \ sql_partition.h partition_info.h partition_element.h \ - contributors.h sql_servers.h + contributors.h sql_servers.h \ + rpl_handler.h replication.h mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ item.cc item_sum.cc item_buff.cc item_func.cc \ @@ -120,7 +121,8 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \ event_queue.cc event_db_repository.cc events.cc \ sql_plugin.cc sql_binlog.cc \ sql_builtin.cc sql_tablespace.cc partition_info.cc \ - sql_servers.cc event_parse_data.cc + sql_servers.cc event_parse_data.cc \ + rpl_handler.cc nodist_mysqld_SOURCES = mini_client_errors.c pack.c client.c my_time.c my_user.c diff --git a/sql/handler.cc b/sql/handler.cc index e5c64452aaf..f17bb9f8036 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -24,6 +24,7 @@ #endif #include "mysql_priv.h" +#include "rpl_handler.h" #include "rpl_filter.h" #include #include @@ -221,6 +222,8 @@ handlerton *ha_checktype(THD *thd, enum legacy_db_type database_type, return NULL; } + RUN_HOOK(transaction, after_rollback, (thd, FALSE)); + switch (database_type) { #ifndef NO_HASH case DB_TYPE_HASH: @@ -1190,6 +1193,7 @@ int ha_commit_trans(THD *thd, bool all) if (cookie) tc_log->unlog(cookie, xid); DBUG_EXECUTE_IF("crash_commit_after", abort();); + RUN_HOOK(transaction, after_commit, (thd, FALSE)); end: if (rw_trans) start_waiting_global_read_lock(thd); @@ -1337,6 +1341,7 @@ int ha_rollback_trans(THD *thd, bool all) push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARNING_NOT_COMPLETE_ROLLBACK, ER(ER_WARNING_NOT_COMPLETE_ROLLBACK)); + RUN_HOOK(transaction, after_rollback, (thd, FALSE)); DBUG_RETURN(error); } @@ -1371,7 +1376,14 @@ int ha_autocommit_or_rollback(THD *thd, int error) thd->variables.tx_isolation=thd->session_tx_isolation; } + else #endif + { + if (!error) + RUN_HOOK(transaction, after_commit, (thd, FALSE)); + else + RUN_HOOK(transaction, after_rollback, (thd, FALSE)); + } DBUG_RETURN(error); } diff --git a/sql/log.cc b/sql/log.cc index 1af2f3a4ddc..042431fc008 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -38,6 +38,7 @@ #endif #include +#include "rpl_handler.h" /* max size of the log message */ #define MAX_LOG_BUFFER_SIZE 1024 @@ -3683,9 +3684,11 @@ err: } -bool MYSQL_BIN_LOG::flush_and_sync() +bool MYSQL_BIN_LOG::flush_and_sync(bool *synced) { int err=0, fd=log_file.file; + if (synced) + *synced= 0; safe_mutex_assert_owner(&LOCK_log); if (flush_io_cache(&log_file)) return 1; @@ -3693,6 +3696,8 @@ bool MYSQL_BIN_LOG::flush_and_sync() { sync_binlog_counter= 0; err=my_sync(fd, MYF(MY_WME)); + if (synced) + *synced= 1; } return err; } @@ -3983,7 +3988,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd, if (file == &log_file) { - error= flush_and_sync(); + error= flush_and_sync(0); if (!error) { signal_update(); @@ -4169,8 +4174,16 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) if (file == &log_file) // we are writing to the real log (disk) { - if (flush_and_sync()) + bool synced= 0; + if (flush_and_sync(&synced)) goto err; + + if (RUN_HOOK(binlog_storage, after_flush, + (thd, log_file_name, file->pos_in_file, synced))) { + sql_print_error("Failed to run 'after_flush' hooks"); + goto err; + } + signal_update(); rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED); } @@ -4425,7 +4438,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log) DBUG_ASSERT(carry == 0); if (sync_log) - flush_and_sync(); + flush_and_sync(0); return 0; // All OK } @@ -4472,7 +4485,7 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd, bool lock) ev.write(&log_file); if (lock) { - if (!error && !(error= flush_and_sync())) + if (!error && !(error= flush_and_sync(0))) { signal_update(); rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED); @@ -4560,7 +4573,8 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event, if (incident && write_incident(thd, FALSE)) goto err; - if (flush_and_sync()) + bool synced= 0; + if (flush_and_sync(&synced)) goto err; DBUG_EXECUTE_IF("half_binlogged_transaction", abort();); if (cache->error) // Error on read @@ -4569,6 +4583,15 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event, write_error=1; // Don't give more errors goto err; } + + if (RUN_HOOK(binlog_storage, after_flush, + (thd, log_file_name, log_file.pos_in_file, synced))) + { + sql_print_error("Failed to run 'after_flush' hooks"); + write_error=1; + goto err; + } + signal_update(); } diff --git a/sql/log.h b/sql/log.h index d306d6f7182..0550c921658 100644 --- a/sql/log.h +++ b/sql/log.h @@ -378,7 +378,21 @@ public: bool is_active(const char* log_file_name); int update_log_index(LOG_INFO* linfo, bool need_update_threads); void rotate_and_purge(uint flags); - bool flush_and_sync(); + + /** + Flush binlog cache and synchronize to disk. + + This function flushes events in binlog cache to binary log file, + it will do synchronizing according to the setting of system + variable 'sync_binlog'. If file is synchronized, @c synced will + be set to 1, otherwise 0. + + @param[out] synced if not NULL, set to 1 if file is synchronized, otherwise 0 + + @retval 0 Success + @retval other Failure + */ + bool flush_and_sync(bool *synced); int purge_logs(const char *to_log, bool included, bool need_mutex, bool need_update_threads, ulonglong *decrease_log_space); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7e9eb6e7291..2ae4ec9e9b6 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -31,6 +31,8 @@ #include "rpl_injector.h" +#include "rpl_handler.h" + #ifdef HAVE_SYS_PRCTL_H #include #endif @@ -1284,6 +1286,7 @@ void clean_up(bool print_message) ha_end(); if (tc_log) tc_log->close(); + delegates_destroy(); xid_cache_free(); delete_elements(&key_caches, (void (*)(const char*, uchar*)) free_key_cache); multi_keycache_free(); @@ -3760,6 +3763,13 @@ static int init_server_components() unireg_abort(1); } + /* initialize delegates for extension observers */ + if (delegates_init()) + { + sql_print_error("Initialize extension delegates failed"); + unireg_abort(1); + } + /* need to configure logging before initializing storage engines */ if (opt_update_log) { diff --git a/sql/replication.h b/sql/replication.h new file mode 100644 index 00000000000..6b7be58a5b1 --- /dev/null +++ b/sql/replication.h @@ -0,0 +1,490 @@ +/* Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef REPLICATION_H +#define REPLICATION_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + Transaction observer flags. +*/ +enum Trans_flags { + /** Transaction is a real transaction */ + TRANS_IS_REAL_TRANS = 1 +}; + +/** + Transaction observer parameter +*/ +typedef struct Trans_param { + uint32 server_id; + uint32 flags; + + /* + The latest binary log file name and position written by current + transaction, if binary log is disabled or no log event has been + written into binary log file by current transaction (events + written into transaction log cache are not counted), these two + member will be zero. + */ + const char *log_file; + my_off_t log_pos; +} Trans_param; + +/** + Observes and extends transaction execution +*/ +typedef struct Trans_observer { + uint32 len; + + /** + This callback is called after transaction commit + + This callback is called right after commit to storage engines for + transactional tables. + + For non-transactional tables, this is called at the end of the + statement, before sending statement status, if the statement + succeeded. + + @note The return value is currently ignored by the server. + + @param param The parameter for transaction observers + + @retval 0 Sucess + @retval 1 Failure + */ + int (*after_commit)(Trans_param *param); + + /** + This callback is called after transaction rollback + + This callback is called right after rollback to storage engines + for transactional tables. + + For non-transactional tables, this is called at the end of the + statement, before sending statement status, if the statement + failed. + + @note The return value is currently ignored by the server. + + @param param The parameter for transaction observers + + @retval 0 Sucess + @retval 1 Failure + */ + int (*after_rollback)(Trans_param *param); +} Trans_observer; + +/** + Binlog storage flags +*/ +enum Binlog_storage_flags { + /** Binary log was sync:ed */ + BINLOG_STORAGE_IS_SYNCED = 1 +}; + +/** + Binlog storage observer parameters + */ +typedef struct Binlog_storage_param { + uint32 server_id; +} Binlog_storage_param; + +/** + Observe binlog logging storage +*/ +typedef struct Binlog_storage_observer { + uint32 len; + + /** + This callback is called after binlog has been flushed + + This callback is called after cached events have been flushed to + binary log file. Whether the binary log file is synchronized to + disk is indicated by the bit BINLOG_STORAGE_IS_SYNCED in @a flags. + + @param param Observer common parameter + @param log_file Binlog file name been updated + @param log_pos Binlog position after update + @param flags flags for binlog storage + + @retval 0 Sucess + @retval 1 Failure + */ + int (*after_flush)(Binlog_storage_param *param, + const char *log_file, my_off_t log_pos, + uint32 flags); +} Binlog_storage_observer; + +/** + Replication binlog transmitter (binlog dump) observer parameter. +*/ +typedef struct Binlog_transmit_param { + uint32 server_id; + uint32 flags; +} Binlog_transmit_param; + +/** + Observe and extends the binlog dumping thread. +*/ +typedef struct Binlog_transmit_observer { + uint32 len; + + /** + This callback is called when binlog dumping starts + + + @param param Observer common parameter + @param log_file Binlog file name to transmit from + @param log_pos Binlog position to transmit from + + @retval 0 Sucess + @retval 1 Failure + */ + int (*transmit_start)(Binlog_transmit_param *param, + const char *log_file, my_off_t log_pos); + + /** + This callback is called when binlog dumping stops + + @param param Observer common parameter + + @retval 0 Sucess + @retval 1 Failure + */ + int (*transmit_stop)(Binlog_transmit_param *param); + + /** + This callback is called to reserve bytes in packet header for event transmission + + This callback is called when resetting transmit packet header to + reserve bytes for this observer in packet header. + + The @a header buffer is allocated by the server code, and @a size + is the size of the header buffer. Each observer can only reserve + a maximum size of @a size in the header. + + @param param Observer common parameter + @param header Pointer of the header buffer + @param size Size of the header buffer + @param len Header length reserved by this observer + + @retval 0 Sucess + @retval 1 Failure + */ + int (*reserve_header)(Binlog_transmit_param *param, + unsigned char *header, + unsigned long size, + unsigned long *len); + + /** + This callback is called before sending an event packet to slave + + @param param Observer common parameter + @param packet Binlog event packet to send + @param len Length of the event packet + @param log_file Binlog file name of the event packet to send + @param log_pos Binlog position of the event packet to send + + @retval 0 Sucess + @retval 1 Failure + */ + int (*before_send_event)(Binlog_transmit_param *param, + unsigned char *packet, unsigned long len, + const char *log_file, my_off_t log_pos ); + + /** + This callback is called after sending an event packet to slave + + @param param Observer common parameter + @param event_buf Binlog event packet buffer sent + @param len length of the event packet buffer + + @retval 0 Sucess + @retval 1 Failure + */ + int (*after_send_event)(Binlog_transmit_param *param, + const char *event_buf, unsigned long len); + + /** + This callback is called after resetting master status + + This is called when executing the command RESET MASTER, and is + used to reset status variables added by observers. + + @param param Observer common parameter + + @retval 0 Sucess + @retval 1 Failure + */ + int (*after_reset_master)(Binlog_transmit_param *param); +} Binlog_transmit_observer; + +/** + Binlog relay IO flags +*/ +enum Binlog_relay_IO_flags { + /** Binary relay log was sync:ed */ + BINLOG_RELAY_IS_SYNCED = 1 +}; + + +/** + Replication binlog relay IO observer parameter +*/ +typedef struct Binlog_relay_IO_param { + uint32 server_id; + + /* Master host, user and port */ + char *host; + char *user; + unsigned int port; + + char *master_log_name; + my_off_t master_log_pos; + + MYSQL *mysql; /* the connection to master */ +} Binlog_relay_IO_param; + +/** + Observes and extends the service of slave IO thread. +*/ +typedef struct Binlog_relay_IO_observer { + uint32 len; + + /** + This callback is called when slave IO thread starts + + @param param Observer common parameter + + @retval 0 Sucess + @retval 1 Failure + */ + int (*thread_start)(Binlog_relay_IO_param *param); + + /** + This callback is called when slave IO thread stops + + @param param Observer common parameter + + @retval 0 Sucess + @retval 1 Failure + */ + int (*thread_stop)(Binlog_relay_IO_param *param); + + /** + This callback is called before slave requesting binlog transmission from master + + This is called before slave issuing BINLOG_DUMP command to master + to request binlog. + + @param param Observer common parameter + @param flags binlog dump flags + + @retval 0 Sucess + @retval 1 Failure + */ + int (*before_request_transmit)(Binlog_relay_IO_param *param, uint32 flags); + + /** + This callback is called after read an event packet from master + + @param param Observer common parameter + @param packet The event packet read from master + @param len Length of the event packet read from master + @param event_buf The event packet return after process + @param event_len The length of event packet return after process + + @retval 0 Sucess + @retval 1 Failure + */ + int (*after_read_event)(Binlog_relay_IO_param *param, + const char *packet, unsigned long len, + const char **event_buf, unsigned long *event_len); + + /** + This callback is called after written an event packet to relay log + + @param param Observer common parameter + @param event_buf Event packet written to relay log + @param event_len Length of the event packet written to relay log + @param flags flags for relay log + + @retval 0 Sucess + @retval 1 Failure + */ + int (*after_queue_event)(Binlog_relay_IO_param *param, + const char *event_buf, unsigned long event_len, + uint32 flags); + + /** + This callback is called after reset slave relay log IO status + + @param param Observer common parameter + + @retval 0 Sucess + @retval 1 Failure + */ + int (*after_reset_slave)(Binlog_relay_IO_param *param); +} Binlog_relay_IO_observer; + + +/** + Register a transaction observer + + @param observer The transaction observer to register + @param p pointer to the internal plugin structure + + @retval 0 Sucess + @retval 1 Observer already exists +*/ +int register_trans_observer(Trans_observer *observer, void *p); + +/** + Unregister a transaction observer + + @param observer The transaction observer to unregister + @param p pointer to the internal plugin structure + + @retval 0 Sucess + @retval 1 Observer not exists +*/ +int unregister_trans_observer(Trans_observer *observer, void *p); + +/** + Register a binlog storage observer + + @param observer The binlog storage observer to register + @param p pointer to the internal plugin structure + + @retval 0 Sucess + @retval 1 Observer already exists +*/ +int register_binlog_storage_observer(Binlog_storage_observer *observer, void *p); + +/** + Unregister a binlog storage observer + + @param observer The binlog storage observer to unregister + @param p pointer to the internal plugin structure + + @retval 0 Sucess + @retval 1 Observer not exists +*/ +int unregister_binlog_storage_observer(Binlog_storage_observer *observer, void *p); + +/** + Register a binlog transmit observer + + @param observer The binlog transmit observer to register + @param p pointer to the internal plugin structure + + @retval 0 Sucess + @retval 1 Observer already exists +*/ +int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p); + +/** + Unregister a binlog transmit observer + + @param observer The binlog transmit observer to unregister + @param p pointer to the internal plugin structure + + @retval 0 Sucess + @retval 1 Observer not exists +*/ +int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p); + +/** + Register a binlog relay IO (slave IO thread) observer + + @param observer The binlog relay IO observer to register + @param p pointer to the internal plugin structure + + @retval 0 Sucess + @retval 1 Observer already exists +*/ +int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p); + +/** + Unregister a binlog relay IO (slave IO thread) observer + + @param observer The binlog relay IO observer to unregister + @param p pointer to the internal plugin structure + + @retval 0 Sucess + @retval 1 Observer not exists +*/ +int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p); + +/** + Connect to master + + This function can only used in the slave I/O thread context, and + will use the same master information to do the connection. + + @code + MYSQL *mysql = mysql_init(NULL); + if (rpl_connect_master(mysql)) + { + // do stuff with the connection + } + mysql_close(mysql); // close the connection + @endcode + + @param mysql address of MYSQL structure to use, pass NULL will + create a new one + + @return address of MYSQL structure on success, NULL on failure +*/ +MYSQL *rpl_connect_master(MYSQL *mysql); + +/** + Set thread entering a condition + + This function should be called before putting a thread to wait for + a condition. @a mutex should be held before calling this + function. After being waken up, @f thd_exit_cond should be called. + + @param thd The thread entering the condition, NULL means current thread + @param cond The condition the thread is going to wait for + @param mutex The mutex associated with the condition, this must be + held before call this function + @param msg The new process message for the thread +*/ +const char* thd_enter_cond(MYSQL_THD thd, pthread_cond_t *cond, + pthread_mutex_t *mutex, const char *msg); + +/** + Set thread leaving a condition + + This function should be called after a thread being waken up for a + condition. + + @param thd The thread entering the condition, NULL means current thread + @param old_msg The process message, ususally this should be the old process + message before calling @f thd_enter_cond +*/ +void thd_exit_cond(MYSQL_THD thd, const char *old_msg); + + +#ifdef __cplusplus +} +#endif +#endif /* REPLICATION_H */ diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc new file mode 100644 index 00000000000..aea838928b9 --- /dev/null +++ b/sql/rpl_handler.cc @@ -0,0 +1,493 @@ +/* Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#include "mysql_priv.h" + +#include "rpl_mi.h" +#include "sql_repl.h" +#include "log_event.h" +#include "rpl_filter.h" +#include +#include "rpl_handler.h" + +Trans_delegate *transaction_delegate; +Binlog_storage_delegate *binlog_storage_delegate; +#ifdef HAVE_REPLICATION +Binlog_transmit_delegate *binlog_transmit_delegate; +Binlog_relay_IO_delegate *binlog_relay_io_delegate; +#endif /* HAVE_REPLICATION */ + +/* + structure to save transaction log filename and position +*/ +typedef struct Trans_binlog_info { + my_off_t log_pos; + char log_file[FN_REFLEN]; +} Trans_binlog_info; + +static pthread_key(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO); + +int get_user_var_int(const char *name, + long long int *value, int *null_value) +{ + my_bool null_val; + user_var_entry *entry= + (user_var_entry*) hash_search(¤t_thd->user_vars, + (uchar*) name, strlen(name)); + if (!entry) + return 1; + *value= entry->val_int(&null_val); + if (null_value) + *null_value= null_val; + return 0; +} + +int get_user_var_real(const char *name, + double *value, int *null_value) +{ + my_bool null_val; + user_var_entry *entry= + (user_var_entry*) hash_search(¤t_thd->user_vars, + (uchar*) name, strlen(name)); + if (!entry) + return 1; + *value= entry->val_real(&null_val); + if (null_value) + *null_value= null_val; + return 0; +} + +int get_user_var_str(const char *name, char *value, + size_t len, unsigned int precision, int *null_value) +{ + String str; + my_bool null_val; + user_var_entry *entry= + (user_var_entry*) hash_search(¤t_thd->user_vars, + (uchar*) name, strlen(name)); + if (!entry) + return 1; + entry->val_str(&null_val, &str, precision); + strncpy(value, str.c_ptr(), len); + if (null_value) + *null_value= null_val; + return 0; +} + +int delegates_init() +{ + static unsigned char trans_mem[sizeof(Trans_delegate)]; + static unsigned char storage_mem[sizeof(Binlog_storage_delegate)]; +#ifdef HAVE_REPLICATION + static unsigned char transmit_mem[sizeof(Binlog_transmit_delegate)]; + static unsigned char relay_io_mem[sizeof(Binlog_relay_IO_delegate)]; +#endif + + if (!(transaction_delegate= new (trans_mem) Trans_delegate) + || (!transaction_delegate->is_inited()) + || !(binlog_storage_delegate= new (storage_mem) Binlog_storage_delegate) + || (!binlog_storage_delegate->is_inited()) +#ifdef HAVE_REPLICATION + || !(binlog_transmit_delegate= new (transmit_mem) Binlog_transmit_delegate) + || (!binlog_transmit_delegate->is_inited()) + || !(binlog_relay_io_delegate= new (relay_io_mem) Binlog_relay_IO_delegate) + || (!binlog_relay_io_delegate->is_inited()) +#endif /* HAVE_REPLICATION */ + ) + return 1; + + if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL)) + return 1; + return 0; +} + +void delegates_destroy() +{ + if (transaction_delegate) + transaction_delegate->~Trans_delegate(); + if (binlog_storage_delegate) + binlog_storage_delegate->~Binlog_storage_delegate(); +#ifdef HAVE_REPLICATION + if (binlog_transmit_delegate) + binlog_transmit_delegate->~Binlog_transmit_delegate(); + if (binlog_relay_io_delegate) + binlog_relay_io_delegate->~Binlog_relay_IO_delegate(); +#endif /* HAVE_REPLICATION */ +} + +/* + This macro is used by almost all the Delegate methods to iterate + over all the observers running given callback function of the + delegate . + + Add observer plugins to the thd->lex list, after each statement, all + plugins add to thd->lex will be automatically unlocked. + */ +#define FOREACH_OBSERVER(r, f, thd, args) \ + param.server_id= thd->server_id; \ + read_lock(); \ + Observer_info_iterator iter= observer_info_iter(); \ + Observer_info *info= iter++; \ + for (; info; info= iter++) \ + { \ + plugin_ref plugin= \ + my_plugin_lock(thd, &info->plugin); \ + if (!plugin) \ + { \ + r= 1; \ + break; \ + } \ + if (((Observer *)info->observer)->f \ + && ((Observer *)info->observer)->f args) \ + { \ + r= 1; \ + plugin_unlock(thd, plugin); \ + break; \ + } \ + plugin_unlock(thd, plugin); \ + } \ + unlock() + + +int Trans_delegate::after_commit(THD *thd, bool all) +{ + Trans_param param; + bool is_real_trans= (all || thd->transaction.all.ha_list == 0); + if (is_real_trans) + param.flags |= TRANS_IS_REAL_TRANS; + + Trans_binlog_info *log_info= + my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO); + + param.log_file= log_info ? log_info->log_file : 0; + param.log_pos= log_info ? log_info->log_pos : 0; + + int ret= 0; + FOREACH_OBSERVER(ret, after_commit, thd, (¶m)); + + /* + This is the end of a real transaction or autocommit statement, we + can free the memory allocated for binlog file and position. + */ + if (is_real_trans && log_info) + { + my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL); + my_free(log_info, MYF(0)); + } + return ret; +} + +int Trans_delegate::after_rollback(THD *thd, bool all) +{ + Trans_param param; + bool is_real_trans= (all || thd->transaction.all.ha_list == 0); + if (is_real_trans) + param.flags |= TRANS_IS_REAL_TRANS; + + Trans_binlog_info *log_info= + my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO); + + param.log_file= log_info ? log_info->log_file : 0; + param.log_pos= log_info ? log_info->log_pos : 0; + + int ret= 0; + FOREACH_OBSERVER(ret, after_commit, thd, (¶m)); + + /* + This is the end of a real transaction or autocommit statement, we + can free the memory allocated for binlog file and position. + */ + if (is_real_trans && log_info) + { + my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, NULL); + my_free(log_info, MYF(0)); + } + return ret; +} + +int Binlog_storage_delegate::after_flush(THD *thd, + const char *log_file, + my_off_t log_pos, + bool synced) +{ + Binlog_storage_param param; + uint32 flags=0; + if (synced) + flags |= BINLOG_STORAGE_IS_SYNCED; + + Trans_binlog_info *log_info= + my_pthread_getspecific_ptr(Trans_binlog_info*, RPL_TRANS_BINLOG_INFO); + + if (!log_info) + { + if(!(log_info= + (Trans_binlog_info *)my_malloc(sizeof(Trans_binlog_info), MYF(0)))) + return 1; + my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, log_info); + } + + strcpy(log_info->log_file, log_file+dirname_length(log_file)); + log_info->log_pos = log_pos; + + int ret= 0; + FOREACH_OBSERVER(ret, after_flush, thd, + (¶m, log_info->log_file, log_info->log_pos, flags)); + return ret; +} + +#ifdef HAVE_REPLICATION +int Binlog_transmit_delegate::transmit_start(THD *thd, ushort flags, + const char *log_file, + my_off_t log_pos) +{ + Binlog_transmit_param param; + param.flags= flags; + + int ret= 0; + FOREACH_OBSERVER(ret, transmit_start, thd, (¶m, log_file, log_pos)); + return ret; +} + +int Binlog_transmit_delegate::transmit_stop(THD *thd, ushort flags) +{ + Binlog_transmit_param param; + param.flags= flags; + + int ret= 0; + FOREACH_OBSERVER(ret, transmit_stop, thd, (¶m)); + return ret; +} + +int Binlog_transmit_delegate::reserve_header(THD *thd, ushort flags, + String *packet) +{ + /* NOTE2ME: Maximum extra header size for each observer, I hope 32 + bytes should be enough for each Observer to reserve their extra + header. If later found this is not enough, we can increase this + /HEZX + */ +#define RESERVE_HEADER_SIZE 32 + unsigned char header[RESERVE_HEADER_SIZE]; + ulong hlen; + Binlog_transmit_param param; + param.flags= flags; + param.server_id= thd->server_id; + + int ret= 0; + read_lock(); + Observer_info_iterator iter= observer_info_iter(); + Observer_info *info= iter++; + for (; info; info= iter++) + { + plugin_ref plugin= + my_plugin_lock(thd, &info->plugin); + if (!plugin) + { + ret= 1; + break; + } + hlen= 0; + if (((Observer *)info->observer)->reserve_header + && ((Observer *)info->observer)->reserve_header(¶m, + header, + RESERVE_HEADER_SIZE, + &hlen)) + { + ret= 1; + plugin_unlock(thd, plugin); + break; + } + plugin_unlock(thd, plugin); + if (hlen == 0) + continue; + if (hlen > RESERVE_HEADER_SIZE || packet->append((char *)header, hlen)) + { + ret= 1; + break; + } + } + unlock(); + return ret; +} + +int Binlog_transmit_delegate::before_send_event(THD *thd, ushort flags, + String *packet, + const char *log_file, + my_off_t log_pos) +{ + Binlog_transmit_param param; + param.flags= flags; + + int ret= 0; + FOREACH_OBSERVER(ret, before_send_event, thd, + (¶m, (uchar *)packet->c_ptr(), + packet->length(), + log_file+dirname_length(log_file), log_pos)); + return ret; +} + +int Binlog_transmit_delegate::after_send_event(THD *thd, ushort flags, + String *packet) +{ + Binlog_transmit_param param; + param.flags= flags; + + int ret= 0; + FOREACH_OBSERVER(ret, after_send_event, thd, + (¶m, packet->c_ptr(), packet->length())); + return ret; +} + +int Binlog_transmit_delegate::after_reset_master(THD *thd, ushort flags) + +{ + Binlog_transmit_param param; + param.flags= flags; + + int ret= 0; + FOREACH_OBSERVER(ret, after_reset_master, thd, (¶m)); + return ret; +} + +void Binlog_relay_IO_delegate::init_param(Binlog_relay_IO_param *param, + Master_info *mi) +{ + param->mysql= mi->mysql; + param->user= mi->user; + param->host= mi->host; + param->port= mi->port; + param->master_log_name= mi->master_log_name; + param->master_log_pos= mi->master_log_pos; +} + +int Binlog_relay_IO_delegate::thread_start(THD *thd, Master_info *mi) +{ + Binlog_relay_IO_param param; + init_param(¶m, mi); + + int ret= 0; + FOREACH_OBSERVER(ret, thread_start, thd, (¶m)); + return ret; +} + + +int Binlog_relay_IO_delegate::thread_stop(THD *thd, Master_info *mi) +{ + + Binlog_relay_IO_param param; + init_param(¶m, mi); + + int ret= 0; + FOREACH_OBSERVER(ret, thread_stop, thd, (¶m)); + return ret; +} + +int Binlog_relay_IO_delegate::before_request_transmit(THD *thd, + Master_info *mi, + ushort flags) +{ + Binlog_relay_IO_param param; + init_param(¶m, mi); + + int ret= 0; + FOREACH_OBSERVER(ret, before_request_transmit, thd, (¶m, (uint32)flags)); + return ret; +} + +int Binlog_relay_IO_delegate::after_read_event(THD *thd, Master_info *mi, + const char *packet, ulong len, + const char **event_buf, + ulong *event_len) +{ + Binlog_relay_IO_param param; + init_param(¶m, mi); + + int ret= 0; + FOREACH_OBSERVER(ret, after_read_event, thd, + (¶m, packet, len, event_buf, event_len)); + return ret; +} + +int Binlog_relay_IO_delegate::after_queue_event(THD *thd, Master_info *mi, + const char *event_buf, + ulong event_len, + bool synced) +{ + Binlog_relay_IO_param param; + init_param(¶m, mi); + + uint32 flags=0; + if (synced) + flags |= BINLOG_STORAGE_IS_SYNCED; + + int ret= 0; + FOREACH_OBSERVER(ret, after_queue_event, thd, + (¶m, event_buf, event_len, flags)); + return ret; +} + +int Binlog_relay_IO_delegate::after_reset_slave(THD *thd, Master_info *mi) + +{ + Binlog_relay_IO_param param; + init_param(¶m, mi); + + int ret= 0; + FOREACH_OBSERVER(ret, after_reset_slave, thd, (¶m)); + return ret; +} +#endif /* HAVE_REPLICATION */ + +int register_trans_observer(Trans_observer *observer, void *p) +{ + return transaction_delegate->add_observer(observer, (st_plugin_int *)p); +} + +int unregister_trans_observer(Trans_observer *observer, void *p) +{ + return transaction_delegate->remove_observer(observer, (st_plugin_int *)p); +} + +int register_binlog_storage_observer(Binlog_storage_observer *observer, void *p) +{ + return binlog_storage_delegate->add_observer(observer, (st_plugin_int *)p); +} + +int unregister_binlog_storage_observer(Binlog_storage_observer *observer, void *p) +{ + return binlog_storage_delegate->remove_observer(observer, (st_plugin_int *)p); +} + +#ifdef HAVE_REPLICATION +int register_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p) +{ + return binlog_transmit_delegate->add_observer(observer, (st_plugin_int *)p); +} + +int unregister_binlog_transmit_observer(Binlog_transmit_observer *observer, void *p) +{ + return binlog_transmit_delegate->remove_observer(observer, (st_plugin_int *)p); +} + +int register_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p) +{ + return binlog_relay_io_delegate->add_observer(observer, (st_plugin_int *)p); +} + +int unregister_binlog_relay_io_observer(Binlog_relay_IO_observer *observer, void *p) +{ + return binlog_relay_io_delegate->remove_observer(observer, (st_plugin_int *)p); +} +#endif /* HAVE_REPLICATION */ diff --git a/sql/rpl_handler.h b/sql/rpl_handler.h new file mode 100644 index 00000000000..4fb7b4e035b --- /dev/null +++ b/sql/rpl_handler.h @@ -0,0 +1,213 @@ +/* Copyright (C) 2008 MySQL AB + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +#ifndef RPL_HANDLER_H +#define RPL_HANDLER_H + +#include "mysql_priv.h" +#include "rpl_mi.h" +#include "rpl_rli.h" +#include "sql_plugin.h" +#include "replication.h" + +class Observer_info { +public: + void *observer; + st_plugin_int *plugin_int; + plugin_ref plugin; + + Observer_info(void *ob, st_plugin_int *p) + :observer(ob), plugin_int(p) + { + plugin= plugin_int_to_ref(plugin_int); + } +}; + +class Delegate { +public: + typedef List Observer_info_list; + typedef List_iterator Observer_info_iterator; + + int add_observer(void *observer, st_plugin_int *plugin) + { + int ret= FALSE; + if (!inited) + return TRUE; + write_lock(); + Observer_info_iterator iter(observer_info_list); + Observer_info *info= iter++; + while (info && info->observer != observer) + info= iter++; + if (!info) + { + info= new Observer_info(observer, plugin); + if (!info || observer_info_list.push_back(info, &memroot)) + ret= TRUE; + } + else + ret= TRUE; + unlock(); + return ret; + } + + int remove_observer(void *observer, st_plugin_int *plugin) + { + int ret= FALSE; + if (!inited) + return TRUE; + write_lock(); + Observer_info_iterator iter(observer_info_list); + Observer_info *info= iter++; + while (info && info->observer != observer) + info= iter++; + if (info) + iter.remove(); + else + ret= TRUE; + unlock(); + return ret; + } + + inline Observer_info_iterator observer_info_iter() + { + return Observer_info_iterator(observer_info_list); + } + + inline bool is_empty() + { + return observer_info_list.is_empty(); + } + + inline int read_lock() + { + if (!inited) + return TRUE; + return rw_rdlock(&lock); + } + + inline int write_lock() + { + if (!inited) + return TRUE; + return rw_wrlock(&lock); + } + + inline int unlock() + { + if (!inited) + return TRUE; + return rw_unlock(&lock); + } + + inline bool is_inited() + { + return inited; + } + + Delegate() + { + inited= FALSE; + if (my_rwlock_init(&lock, NULL)) + return; + init_sql_alloc(&memroot, 1024, 0); + inited= TRUE; + } + ~Delegate() + { + inited= FALSE; + rwlock_destroy(&lock); + free_root(&memroot, MYF(0)); + } + +private: + Observer_info_list observer_info_list; + rw_lock_t lock; + MEM_ROOT memroot; + bool inited; +}; + +class Trans_delegate + :public Delegate { +public: + typedef Trans_observer Observer; + int before_commit(THD *thd, bool all); + int before_rollback(THD *thd, bool all); + int after_commit(THD *thd, bool all); + int after_rollback(THD *thd, bool all); +}; + +class Binlog_storage_delegate + :public Delegate { +public: + typedef Binlog_storage_observer Observer; + int after_flush(THD *thd, const char *log_file, + my_off_t log_pos, bool synced); +}; + +#ifdef HAVE_REPLICATION +class Binlog_transmit_delegate + :public Delegate { +public: + typedef Binlog_transmit_observer Observer; + int transmit_start(THD *thd, ushort flags, + const char *log_file, my_off_t log_pos); + int transmit_stop(THD *thd, ushort flags); + int reserve_header(THD *thd, ushort flags, String *packet); + int before_send_event(THD *thd, ushort flags, + String *packet, const + char *log_file, my_off_t log_pos ); + int after_send_event(THD *thd, ushort flags, + String *packet); + int after_reset_master(THD *thd, ushort flags); +}; + +class Binlog_relay_IO_delegate + :public Delegate { +public: + typedef Binlog_relay_IO_observer Observer; + int thread_start(THD *thd, Master_info *mi); + int thread_stop(THD *thd, Master_info *mi); + int before_request_transmit(THD *thd, Master_info *mi, ushort flags); + int after_read_event(THD *thd, Master_info *mi, + const char *packet, ulong len, + const char **event_buf, ulong *event_len); + int after_queue_event(THD *thd, Master_info *mi, + const char *event_buf, ulong event_len, + bool synced); + int after_reset_slave(THD *thd, Master_info *mi); +private: + void init_param(Binlog_relay_IO_param *param, Master_info *mi); +}; +#endif /* HAVE_REPLICATION */ + +int delegates_init(); +void delegates_destroy(); + +extern Trans_delegate *transaction_delegate; +extern Binlog_storage_delegate *binlog_storage_delegate; +#ifdef HAVE_REPLICATION +extern Binlog_transmit_delegate *binlog_transmit_delegate; +extern Binlog_relay_IO_delegate *binlog_relay_io_delegate; +#endif /* HAVE_REPLICATION */ + +/* + if there is no observers in the delegate, we can return 0 + immediately. +*/ +#define RUN_HOOK(group, hook, args) \ + (group ##_delegate->is_empty() ? \ + 0 : group ##_delegate->hook args) + +#endif /* RPL_HANDLER_H */ diff --git a/sql/slave.cc b/sql/slave.cc index fac9ee214c5..4988886dce4 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -40,6 +40,7 @@ #include #include #include +#include "rpl_handler.h" #ifdef HAVE_REPLICATION @@ -69,6 +70,8 @@ ulonglong relay_log_space_limit = 0; int disconnect_slave_event_count = 0, abort_slave_event_count = 0; int events_till_abort = -1; +static pthread_key(Master_info*, RPL_MASTER_INFO); + enum enum_slave_reconnect_actions { SLAVE_RECON_ACT_REG= 0, @@ -231,6 +234,10 @@ int init_slave() TODO: re-write this to interate through the list of files for multi-master */ + + if (pthread_key_create(&RPL_MASTER_INFO, NULL)) + goto err; + active_mi= new Master_info; /* @@ -1868,17 +1875,22 @@ static int safe_sleep(THD* thd, int sec, CHECK_KILLED_FUNC thread_killed, } -static int request_dump(MYSQL* mysql, Master_info* mi, - bool *suppress_warnings) +static int request_dump(THD *thd, MYSQL* mysql, Master_info* mi, + bool *suppress_warnings) { uchar buf[FN_REFLEN + 10]; int len; - int binlog_flags = 0; // for now + ushort binlog_flags = 0; // for now char* logname = mi->master_log_name; DBUG_ENTER("request_dump"); *suppress_warnings= FALSE; + if (RUN_HOOK(binlog_relay_io, + before_request_transmit, + (thd, mi, binlog_flags))) + DBUG_RETURN(1); + // TODO if big log files: Change next to int8store() int4store(buf, (ulong) mi->master_log_pos); int2store(buf + 4, binlog_flags); @@ -2532,6 +2544,16 @@ pthread_handler_t handle_slave_io(void *arg) mi->master_log_name, llstr(mi->master_log_pos,llbuff))); + /* This must be called before run any binlog_relay_io hooks */ + my_pthread_setspecific_ptr(RPL_MASTER_INFO, mi); + + if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi))) + { + mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, + ER(ER_SLAVE_FATAL_ERROR), "Failed to run 'thread_start' hook"); + goto err; + } + if (!(mi->mysql = mysql = mysql_init(NULL))) { mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, @@ -2621,7 +2643,7 @@ connected: while (!io_slave_killed(thd,mi)) { thd_proc_info(thd, "Requesting binlog dump"); - if (request_dump(mysql, mi, &suppress_warnings)) + if (request_dump(thd, mysql, mi, &suppress_warnings)) { sql_print_error("Failed on request_dump()"); if (check_io_slave_killed(thd, mi, "Slave I/O thread killed while \ @@ -2641,6 +2663,7 @@ requesting master dump") || goto err; goto connected; }); + const char *event_buf; DBUG_ASSERT(mi->last_error().number == 0); while (!io_slave_killed(thd,mi)) @@ -2697,14 +2720,37 @@ Stopping slave I/O thread due to out-of-memory error from master"); retry_count=0; // ok event, reset retry counter thd_proc_info(thd, "Queueing master event to the relay log"); - if (queue_event(mi,(const char*)mysql->net.read_pos + 1, - event_len)) + event_buf= (const char*)mysql->net.read_pos + 1; + if (RUN_HOOK(binlog_relay_io, after_read_event, + (thd, mi,(const char*)mysql->net.read_pos + 1, + event_len, &event_buf, &event_len))) + { + mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, + ER(ER_SLAVE_FATAL_ERROR), + "Failed to run 'after_read_event' hook"); + goto err; + } + + /* XXX: 'synced' should be updated by queue_event to indicate + whether event has been synced to disk */ + bool synced= 0; + if (queue_event(mi, event_buf, event_len)) { mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE), "could not queue event from master"); goto err; } + + if (RUN_HOOK(binlog_relay_io, after_queue_event, + (thd, mi, event_buf, event_len, synced))) + { + mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, + ER(ER_SLAVE_FATAL_ERROR), + "Failed to run 'after_queue_event' hook"); + goto err; + } + if (flush_master_info(mi, 1)) { sql_print_error("Failed to flush master info file"); @@ -2750,6 +2796,7 @@ err: // print the current replication position sql_print_information("Slave I/O thread exiting, read up to log '%s', position %s", IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff)); + RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi)); thd->set_query(NULL, 0); thd->reset_db(NULL, 0); if (mysql) @@ -3906,6 +3953,71 @@ static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi, } +MYSQL *rpl_connect_master(MYSQL *mysql) +{ + THD *thd= current_thd; + Master_info *mi= my_pthread_getspecific_ptr(Master_info*, RPL_MASTER_INFO); + if (!mi) + { + sql_print_error("'rpl_connect_master' must be called in slave I/O thread context."); + return NULL; + } + + bool allocated= false; + + if (!mysql) + { + if(!(mysql= mysql_init(NULL))) + { + sql_print_error("rpl_connect_master: failed in mysql_init()"); + return NULL; + } + allocated= true; + } + + /* + XXX: copied from connect_to_master, this function should not + change the slave status, so we cannot use connect_to_master + directly + + TODO: make this part a seperate function to eliminate duplication + */ + mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout); + mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout); + +#ifdef HAVE_OPENSSL + if (mi->ssl) + { + mysql_ssl_set(mysql, + mi->ssl_key[0]?mi->ssl_key:0, + mi->ssl_cert[0]?mi->ssl_cert:0, + mi->ssl_ca[0]?mi->ssl_ca:0, + mi->ssl_capath[0]?mi->ssl_capath:0, + mi->ssl_cipher[0]?mi->ssl_cipher:0); + mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, + &mi->ssl_verify_server_cert); + } +#endif + + mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname); + /* This one is not strictly needed but we have it here for completeness */ + mysql_options(mysql, MYSQL_SET_CHARSET_DIR, (char *) charsets_dir); + + if (io_slave_killed(thd, mi) + || !mysql_real_connect(mysql, mi->host, mi->user, mi->password, 0, + mi->port, 0, 0)) + { + if (!io_slave_killed(thd, mi)) + sql_print_error("rpl_connect_master: error connecting to master: %s (server_error: %d)", + mysql_error(mysql), mysql_errno(mysql)); + + if (allocated) + mysql_close(mysql); // this will free the object + return NULL; + } + return mysql; +} + /* Store the file and position where the execute-slave thread are in the relay log. diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 3f568566c89..755e60b4fc2 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -277,6 +277,42 @@ const char *set_thd_proc_info(THD *thd, const char *info, return old_info; } +extern "C" +const char* thd_enter_cond(MYSQL_THD thd, pthread_cond_t *cond, + pthread_mutex_t *mutex, const char *msg) +{ + if (!thd) + thd= current_thd; + + const char* old_msg = thd->proc_info; + safe_mutex_assert_owner(mutex); + thd->mysys_var->current_mutex = mutex; + thd->mysys_var->current_cond = cond; + thd->proc_info = msg; + return old_msg; +} + +extern "C" +void thd_exit_cond(MYSQL_THD thd, const char *old_msg) +{ + if (!thd) + thd= current_thd; + + /* + Putting the mutex unlock in thd_exit_cond() ensures that + mysys_var->current_mutex is always unlocked _before_ mysys_var->mutex is + locked (if that would not be the case, you'll get a deadlock if someone + does a THD::awake() on you). + */ + pthread_mutex_unlock(thd->mysys_var->current_mutex); + pthread_mutex_lock(&thd->mysys_var->mutex); + thd->mysys_var->current_mutex = 0; + thd->mysys_var->current_cond = 0; + thd->proc_info = old_msg; + pthread_mutex_unlock(&thd->mysys_var->mutex); + return; +} + extern "C" void **thd_ha_data(const THD *thd, const struct handlerton *hton) { diff --git a/sql/sql_class.h b/sql/sql_class.h index f52d5fae76f..3d7ff0ca0a1 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -22,6 +22,7 @@ #include "log.h" #include "rpl_tblmap.h" +#include "replication.h" /** An interface that is used to take an action when @@ -1940,27 +1941,11 @@ public: inline const char* enter_cond(pthread_cond_t *cond, pthread_mutex_t* mutex, const char* msg) { - const char* old_msg = proc_info; - safe_mutex_assert_owner(mutex); - mysys_var->current_mutex = mutex; - mysys_var->current_cond = cond; - proc_info = msg; - return old_msg; + return thd_enter_cond(this, cond, mutex, msg); } inline void exit_cond(const char* old_msg) { - /* - Putting the mutex unlock in exit_cond() ensures that - mysys_var->current_mutex is always unlocked _before_ mysys_var->mutex is - locked (if that would not be the case, you'll get a deadlock if someone - does a THD::awake() on you). - */ - pthread_mutex_unlock(mysys_var->current_mutex); - pthread_mutex_lock(&mysys_var->mutex); - mysys_var->current_mutex = 0; - mysys_var->current_cond = 0; - proc_info = old_msg; - pthread_mutex_unlock(&mysys_var->mutex); + thd_exit_cond(this, old_msg); } inline time_t query_start() { query_start_used=1; return start_time; } inline void set_time() diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ca27d476213..6019c385fb8 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -21,6 +21,7 @@ #include #include #include +#include "rpl_handler.h" #include "sp_head.h" #include "sp.h" diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index da168d36429..8cf8c4cb81f 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -19,14 +19,6 @@ #define REPORT_TO_LOG 1 #define REPORT_TO_USER 2 -#ifdef DBUG_OFF -#define plugin_ref_to_int(A) A -#define plugin_int_to_ref(A) A -#else -#define plugin_ref_to_int(A) (A ? A[0] : NULL) -#define plugin_int_to_ref(A) &(A) -#endif - extern struct st_mysql_plugin *mysqld_builtins[]; /** @@ -54,7 +46,8 @@ const LEX_STRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]= { C_STRING_WITH_LEN("STORAGE ENGINE") }, { C_STRING_WITH_LEN("FTPARSER") }, { C_STRING_WITH_LEN("DAEMON") }, - { C_STRING_WITH_LEN("INFORMATION SCHEMA") } + { C_STRING_WITH_LEN("INFORMATION SCHEMA") }, + { C_STRING_WITH_LEN("REPLICATION") }, }; extern int initialize_schema_table(st_plugin_int *plugin); @@ -93,7 +86,8 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]= MYSQL_HANDLERTON_INTERFACE_VERSION, MYSQL_FTPARSER_INTERFACE_VERSION, MYSQL_DAEMON_INTERFACE_VERSION, - MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION + MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION, + MYSQL_REPLICATION_INTERFACE_VERSION, }; static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]= { @@ -101,7 +95,8 @@ static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]= MYSQL_HANDLERTON_INTERFACE_VERSION, MYSQL_FTPARSER_INTERFACE_VERSION, MYSQL_DAEMON_INTERFACE_VERSION, - MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION + MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION, + MYSQL_REPLICATION_INTERFACE_VERSION, }; static bool initialized= 0; diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index 004d0d5abb7..c6ad846943c 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -18,6 +18,14 @@ class sys_var; +#ifdef DBUG_OFF +#define plugin_ref_to_int(A) A +#define plugin_int_to_ref(A) A +#else +#define plugin_ref_to_int(A) (A ? A[0] : NULL) +#define plugin_int_to_ref(A) &(A) +#endif + /* the following flags are valid for plugin_init() */ diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 0ec8d91214c..671f6785640 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -21,6 +21,7 @@ #include "log_event.h" #include "rpl_filter.h" #include +#include "rpl_handler.h" int max_binlog_dump_events = 0; // unlimited my_bool opt_sporadic_binlog_dump_fail = 0; @@ -80,6 +81,32 @@ static int fake_rotate_event(NET* net, String* packet, char* log_file_name, DBUG_RETURN(0); } +/* + Reset thread transmit packet buffer for event sending + + This function allocates header bytes for event transmission, and + should be called before store the event data to the packet buffer. +*/ +static int reset_transmit_packet(THD *thd, ushort flags, + ulong *ev_offset, const char **errmsg) +{ + int ret= 0; + String *packet= &thd->packet; + + /* reserve and set default header */ + packet->length(0); + packet->set("\0", 1, &my_charset_bin); + + if (RUN_HOOK(binlog_transmit, reserve_header, (thd, flags, packet))) + { + *errmsg= "Failed to run hook 'reserve_header'"; + my_errno= ER_UNKNOWN_ERROR; + ret= 1; + } + *ev_offset= packet->length(); + return ret; +} + static int send_file(THD *thd) { NET* net = &thd->net; @@ -346,6 +373,9 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, LOG_INFO linfo; char *log_file_name = linfo.log_file_name; char search_file_name[FN_REFLEN], *name; + + ulong ev_offset; + IO_CACHE log; File file = -1; String* packet = &thd->packet; @@ -361,6 +391,14 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos)); bzero((char*) &log,sizeof(log)); + sql_print_information("Start binlog_dump to slave_server(%d), pos(%s, %lu)", + thd->server_id, log_ident, (ulong)pos); + if (RUN_HOOK(binlog_transmit, transmit_start, (thd, flags, log_ident, pos))) + { + errmsg= "Failed to run hook 'transmit_start'"; + my_errno= ER_UNKNOWN_ERROR; + goto err; + } #ifndef DBUG_OFF if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2)) @@ -416,11 +454,9 @@ impossible position"; goto err; } - /* - We need to start a packet with something other than 255 - to distinguish it from error - */ - packet->set("\0", 1, &my_charset_bin); /* This is the start of a new packet */ + /* reset transmit packet for the fake rotate event below */ + if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + goto err; /* Tell the client about the log name with a fake Rotate event; @@ -460,7 +496,7 @@ impossible position"; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; goto err; } - packet->set("\0", 1, &my_charset_bin); + /* Adding MAX_LOG_EVENT_HEADER_LEN, since a binlog event can become this larger than the corresponding packet (query) sent @@ -476,6 +512,11 @@ impossible position"; log_lock = mysql_bin_log.get_log_lock(); if (pos > BIN_LOG_HEADER_SIZE) { + /* reset transmit packet for the event read from binary log + file */ + if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + goto err; + /* Try to find a Format_description_log_event at the beginning of the binlog @@ -483,29 +524,30 @@ impossible position"; if (!(error = Log_event::read_log_event(&log, packet, log_lock))) { /* - The packet has offsets equal to the normal offsets in a binlog - event +1 (the first character is \0). + The packet has offsets equal to the normal offsets in a + binlog event + ev_offset (the first ev_offset characters are + the header (default \0)). */ DBUG_PRINT("info", ("Looked for a Format_description_log_event, found event type %d", - (*packet)[EVENT_TYPE_OFFSET+1])); - if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT) + (*packet)[EVENT_TYPE_OFFSET+ev_offset])); + if ((*packet)[EVENT_TYPE_OFFSET+ev_offset] == FORMAT_DESCRIPTION_EVENT) { - binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] & + binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+ev_offset] & LOG_EVENT_BINLOG_IN_USE_F); - (*packet)[FLAGS_OFFSET+1] &= ~LOG_EVENT_BINLOG_IN_USE_F; + (*packet)[FLAGS_OFFSET+ev_offset] &= ~LOG_EVENT_BINLOG_IN_USE_F; /* mark that this event with "log_pos=0", so the slave should not increment master's binlog position (rli->group_master_log_pos) */ - int4store((char*) packet->ptr()+LOG_POS_OFFSET+1, 0); + int4store((char*) packet->ptr()+LOG_POS_OFFSET+ev_offset, 0); /* if reconnect master sends FD event with `created' as 0 to avoid destroying temp tables. */ int4store((char*) packet->ptr()+LOG_EVENT_MINIMAL_HEADER_LEN+ - ST_CREATED_OFFSET+1, (ulong) 0); + ST_CREATED_OFFSET+ev_offset, (ulong) 0); /* send it */ if (my_net_write(net, (uchar*) packet->ptr(), packet->length())) { @@ -531,8 +573,6 @@ impossible position"; Format_description_log_event will be found naturally if it is written. */ } - /* reset the packet as we wrote to it in any case */ - packet->set("\0", 1, &my_charset_bin); } /* end of if (pos > BIN_LOG_HEADER_SIZE); */ else { @@ -544,6 +584,12 @@ impossible position"; while (!net->error && net->vio != 0 && !thd->killed) { + Log_event_type event_type= UNKNOWN_EVENT; + + /* reset the transmit packet for the event read from binary log + file */ + if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + goto err; while (!(error = Log_event::read_log_event(&log, packet, log_lock))) { #ifndef DBUG_OFF @@ -556,15 +602,25 @@ impossible position"; } #endif - if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT) + event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]); + if (event_type == FORMAT_DESCRIPTION_EVENT) { - binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+1] & + binlog_can_be_corrupted= test((*packet)[FLAGS_OFFSET+ev_offset] & LOG_EVENT_BINLOG_IN_USE_F); - (*packet)[FLAGS_OFFSET+1] &= ~LOG_EVENT_BINLOG_IN_USE_F; + (*packet)[FLAGS_OFFSET+ev_offset] &= ~LOG_EVENT_BINLOG_IN_USE_F; } - else if ((*packet)[EVENT_TYPE_OFFSET+1] == STOP_EVENT) + else if (event_type == STOP_EVENT) binlog_can_be_corrupted= FALSE; + pos = my_b_tell(&log); + if (RUN_HOOK(binlog_transmit, before_send_event, + (thd, flags, packet, log_file_name, pos))) + { + my_errno= ER_UNKNOWN_ERROR; + errmsg= "run 'before_send_event' hook failed"; + goto err; + } + if (my_net_write(net, (uchar*) packet->ptr(), packet->length())) { errmsg = "Failed on my_net_write()"; @@ -572,9 +628,8 @@ impossible position"; goto err; } - DBUG_PRINT("info", ("log event code %d", - (*packet)[LOG_EVENT_OFFSET+1] )); - if ((*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT) + DBUG_PRINT("info", ("log event code %d", event_type)); + if (event_type == LOAD_EVENT) { if (send_file(thd)) { @@ -583,7 +638,17 @@ impossible position"; goto err; } } - packet->set("\0", 1, &my_charset_bin); + + if (RUN_HOOK(binlog_transmit, after_send_event, (thd, flags, packet))) + { + errmsg= "Failed to run hook 'after_send_event'"; + my_errno= ER_UNKNOWN_ERROR; + goto err; + } + + /* reset transmit packet for next loop */ + if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + goto err; } /* @@ -634,6 +699,11 @@ impossible position"; } #endif + /* reset the transmit packet for the event read from binary log + file */ + if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + goto err; + /* No one will update the log while we are reading now, but we'll be quick and just read one record @@ -650,6 +720,7 @@ impossible position"; /* we read successfully, so we'll need to send it to the slave */ pthread_mutex_unlock(log_lock); read_packet = 1; + event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]); break; case LOG_READ_EOF: @@ -676,8 +747,17 @@ impossible position"; } if (read_packet) - { - thd_proc_info(thd, "Sending binlog event to slave"); + { + thd_proc_info(thd, "Sending binlog event to slave"); + pos = my_b_tell(&log); + if (RUN_HOOK(binlog_transmit, before_send_event, + (thd, flags, packet, log_file_name, pos))) + { + my_errno= ER_UNKNOWN_ERROR; + errmsg= "run 'before_send_event' hook failed"; + goto err; + } + if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) ) { errmsg = "Failed on my_net_write()"; @@ -685,7 +765,7 @@ impossible position"; goto err; } - if ((*packet)[LOG_EVENT_OFFSET+1] == LOAD_EVENT) + if (event_type == LOAD_EVENT) { if (send_file(thd)) { @@ -694,11 +774,13 @@ impossible position"; goto err; } } - packet->set("\0", 1, &my_charset_bin); - /* - No need to net_flush because we will get to flush later when - we hit EOF pretty quick - */ + + if (RUN_HOOK(binlog_transmit, after_send_event, (thd, flags, packet))) + { + my_errno= ER_UNKNOWN_ERROR; + errmsg= "Failed to run hook 'after_send_event'"; + goto err; + } } if (fatal_error) @@ -734,6 +816,10 @@ impossible position"; end_io_cache(&log); (void) my_close(file, MYF(MY_WME)); + /* reset transmit packet for the possible fake rotate event */ + if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + goto err; + /* Call fake_rotate_event() in case the previous log (the one which we have just finished reading) did not contain a Rotate event @@ -750,9 +836,6 @@ impossible position"; my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG; goto err; } - - packet->length(0); - packet->append('\0'); } } @@ -760,6 +843,7 @@ end: end_io_cache(&log); (void)my_close(file, MYF(MY_WME)); + RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags)); my_eof(thd); thd_proc_info(thd, "Waiting to finalize termination"); pthread_mutex_lock(&LOCK_thread_count); @@ -770,6 +854,7 @@ end: err: thd_proc_info(thd, "Waiting to finalize termination"); end_io_cache(&log); + RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags)); /* Exclude iteration through thread list this is needed for purge_logs() - it will iterate through @@ -1064,6 +1149,7 @@ int reset_slave(THD *thd, Master_info* mi) goto err; } + RUN_HOOK(binlog_relay_io, after_reset_slave, (thd, mi)); err: unlock_slave_threads(mi); if (error) @@ -1363,7 +1449,11 @@ int reset_master(THD* thd) ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG)); return 1; } - return mysql_bin_log.reset_logs(thd); + + if (mysql_bin_log.reset_logs(thd)) + return 1; + RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */)); + return 0; } int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, @@ -1836,5 +1926,3 @@ int init_replication_sys_vars() } #endif /* HAVE_REPLICATION */ - - From acd1d7c2f5330184bc2f65f4137ed2ebcd359ac9 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Mon, 28 Sep 2009 13:44:45 +0200 Subject: [PATCH 37/88] Disabling tests that are not relevant after BUG#40116, these will be enabled when WL#2867 or associated fixes for 5.1 is added to solve the problem. --- .../rpl_ndb/r/rpl_ndb_mixed_tables.result | 40 ------------------- .../suite/rpl_ndb/t/rpl_ndb_mixed_tables.test | 24 +++++++++++ 2 files changed, 24 insertions(+), 40 deletions(-) diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result index 92fda774da5..43efc10c2e1 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_mixed_tables.result @@ -111,22 +111,10 @@ INSERT INTO innodb_ndb VALUES (12); COMMIT; ---- ROLLBACK ---- BEGIN; -INSERT INTO myisam_innodb VALUES (13); -INSERT INTO myisam_innodb VALUES (14); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -BEGIN; INSERT INTO innodb_myisam VALUES (15); INSERT INTO innodb_myisam VALUES (16); ROLLBACK; BEGIN; -INSERT INTO myisam_ndb VALUES (17); -INSERT INTO myisam_ndb VALUES (18); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -BEGIN; INSERT INTO ndb_myisam VALUES (19); INSERT INTO ndb_myisam VALUES (20); ROLLBACK; @@ -167,22 +155,10 @@ INSERT INTO innodb_ndb VALUES (36); COMMIT; ---- ROLLBACK ---- BEGIN; -INSERT INTO myisam_innodb VALUES (37); -INSERT INTO myisam_innodb VALUES (38); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -BEGIN; INSERT INTO innodb_myisam VALUES (39); INSERT INTO innodb_myisam VALUES (40); ROLLBACK; BEGIN; -INSERT INTO myisam_ndb VALUES (41); -INSERT INTO myisam_ndb VALUES (42); -ROLLBACK; -Warnings: -Warning 1196 Some non-transactional changed tables couldn't be rolled back -BEGIN; INSERT INTO ndb_myisam VALUES (43); INSERT INTO ndb_myisam VALUES (44); ROLLBACK; @@ -209,25 +185,15 @@ INSERT INTO innodb_ndb VALUES (59); INSERT INTO innodb_ndb VALUES (60); ==== AUTOCOMMIT=0, single statements, myisam on master ==== SET AUTOCOMMIT = 0; -INSERT INTO myisam_innodb VALUES (61); -INSERT INTO myisam_innodb VALUES (62); -INSERT INTO myisam_ndb VALUES (63); -INSERT INTO myisam_ndb VALUES (64); ==== Show results ==== SELECT * FROM myisam_innodb ORDER BY a; a 1 2 -13 -14 25 26 -37 -38 49 50 -61 -62 SELECT * FROM innodb_myisam ORDER BY a; a 3 @@ -240,16 +206,10 @@ SELECT * FROM myisam_ndb ORDER BY a; a 5 6 -17 -18 29 30 -41 -42 53 54 -63 -64 SELECT * FROM ndb_myisam ORDER BY a; a 7 diff --git a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test index 7d7cd5770cf..a20e42f1b24 100644 --- a/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test +++ b/mysql-test/suite/rpl_ndb/t/rpl_ndb_mixed_tables.test @@ -134,11 +134,15 @@ connection master; --echo ---- ROLLBACK ---- +# This test does not work in ROW mode after the changes introduced in +# BUG#40116. After WL#2687 is pushed, Tests should be added again. +--disable_parsing BEGIN; INSERT INTO myisam_innodb VALUES (13); INSERT INTO myisam_innodb VALUES (14); ROLLBACK; sync_slave_with_master; +--enable_parsing connection master; BEGIN; INSERT INTO innodb_myisam VALUES (15); @@ -147,12 +151,17 @@ ROLLBACK; sync_slave_with_master; connection master; +# This test does not work in ROW mode after the changes introduced in +# BUG#40116. After WL#2687 is pushed, these tests should be enabled +# again. +--disable_parsing BEGIN; INSERT INTO myisam_ndb VALUES (17); INSERT INTO myisam_ndb VALUES (18); ROLLBACK; sync_slave_with_master; connection master; +--enable_parsing BEGIN; INSERT INTO ndb_myisam VALUES (19); INSERT INTO ndb_myisam VALUES (20); @@ -221,12 +230,17 @@ connection master; --echo ---- ROLLBACK ---- +# This test does not work in ROW mode after the changes introduced in +# BUG#40116. After WL#2687 is pushed, these tests should be enabled +# again. +--disable_parsing BEGIN; INSERT INTO myisam_innodb VALUES (37); INSERT INTO myisam_innodb VALUES (38); ROLLBACK; sync_slave_with_master; connection master; +--enable_parsing BEGIN; INSERT INTO innodb_myisam VALUES (39); INSERT INTO innodb_myisam VALUES (40); @@ -234,12 +248,17 @@ ROLLBACK; sync_slave_with_master; connection master; +# This test does not work in ROW mode after the changes introduced in +# BUG#40116. After WL#2687 is pushed, these tests should be enabled +# again. +--disable_parsing BEGIN; INSERT INTO myisam_ndb VALUES (41); INSERT INTO myisam_ndb VALUES (42); ROLLBACK; sync_slave_with_master; connection master; +--enable_parsing BEGIN; INSERT INTO ndb_myisam VALUES (43); INSERT INTO ndb_myisam VALUES (44); @@ -295,6 +314,10 @@ connection master; SET AUTOCOMMIT = 0; +# These tests do not work in ROW mode after the changes introduced in +# BUG#40116. After WL#2687 is pushed, these tests should be enabled +# again. +--disable_parsing # This tests BUG#29288. INSERT INTO myisam_innodb VALUES (61); INSERT INTO myisam_innodb VALUES (62); @@ -305,6 +328,7 @@ INSERT INTO myisam_ndb VALUES (63); INSERT INTO myisam_ndb VALUES (64); sync_slave_with_master; connection master; +--enable_parsing --echo ==== Show results ==== From d28ef002d7c9bd8febf8965134cac802222ba279 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 29 Sep 2009 00:04:20 +0100 Subject: [PATCH 38/88] BUG#28777, WL#4293: SHOW BINLOG EVENTS does not work on relay log files NOTE: this is the backport to next-mr. SHOW BINLOG EVENTS does not work with relay log files. If issuing "SHOW BINLOG EVENTS IN 'relay-log.000001'" in a non-empty relay log file (relay-log.000001), mysql reports empty set. This patch addresses this issue by extending the SHOW command with RELAYLOG. Events in relay log files can now be inspected by issuing SHOW RELAYLOG EVENTS [IN 'log_name'] [FROM pos] [LIMIT [offset,] row_count]. --- .../rpl_tests/rpl_show_relaylog_events.inc | 121 ++++++++ mysql-test/include/show_binlog_events.inc | 27 +- mysql-test/include/show_relaylog_events.inc | 35 +++ .../rpl/r/rpl_row_show_relaylog_events.result | 274 ++++++++++++++++++ .../r/rpl_stm_mix_show_relaylog_events.result | 148 ++++++++++ .../rpl/t/rpl_row_show_relaylog_events.test | 18 ++ .../t/rpl_stm_mix_show_relaylog_events.test | 18 ++ sql/lex.h | 1 + sql/mysqld.cc | 1 + sql/sp_head.cc | 1 + sql/sql_lex.h | 2 +- sql/sql_parse.cc | 1 + sql/sql_repl.cc | 37 ++- sql/sql_yacc.yy | 7 + 14 files changed, 679 insertions(+), 12 deletions(-) create mode 100644 mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc create mode 100644 mysql-test/include/show_relaylog_events.inc create mode 100644 mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result create mode 100644 mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result create mode 100644 mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test create mode 100644 mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test diff --git a/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc new file mode 100644 index 00000000000..50036e564a7 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc @@ -0,0 +1,121 @@ +-- connection master + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +INSERT INTO t1 VALUES (6); + +-- echo [MASTER] ********* SOW BINLOG EVENTS IN ... ********* +let $binary_log_file= master-bin.000001; +-- source include/show_binlog_events.inc + +-- echo [MASTER] ********* SOW BINLOG EVENTS ********* +let $binary_log_file= ; +-- source include/show_binlog_events.inc + +-- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +let $binary_log_file= ; +let $binary_log_limit_row= 3; +-- source include/show_binlog_events.inc + +-- echo [MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +let $binary_log_file= ; +let $binary_log_limit_row= 3; +let $binary_log_limit_offset= 1; +-- source include/show_binlog_events.inc + +# clear show_binlog_event/show_relaylog_events parameters +let $binary_log_file= ; +let $binary_log_limit_row= ; +let $binary_log_limit_offset= ; + +-- sync_slave_with_master + +-- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +let $binary_log_file= slave-bin.000001; +-- source include/show_binlog_events.inc + +-- echo [SLAVE] ********* SOW BINLOG EVENTS ********* +let $binary_log_file= ; +-- source include/show_binlog_events.inc + +-- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +let $binary_log_file= ; +let $binary_log_limit_row= 3; +-- source include/show_binlog_events.inc + +-- echo [SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +let $binary_log_file= ; +let $binary_log_limit_row= 3; +let $binary_log_limit_offset= 1; +-- source include/show_binlog_events.inc + +# clear show_binlog_event/show_relaylog_events parameters +let $binary_log_file= ; +let $binary_log_limit_row= ; +let $binary_log_limit_offset= ; + +-- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +let $binary_log_file= slave-relay-bin.000003; +-- source include/show_relaylog_events.inc + +-- echo [SLAVE] ********* SOW RELAYLOG EVENTS ********* +let $binary_log_file= ; +-- source include/show_relaylog_events.inc + +-- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows ********* +let $binary_log_file= slave-relay-bin.000003; +let $binary_log_limit_row= 3; +let $binary_log_limit_offset= ; +-- source include/show_relaylog_events.inc + +-- echo [MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows ********* +let $binary_log_file= slave-relay-bin.000003; +let $binary_log_limit_offset= 1; +let $binary_log_limit_row= 3; +-- source include/show_relaylog_events.inc + +FLUSH LOGS; + +-- connection master +FLUSH LOGS; +DROP TABLE t1; + +# clear show_binlog_event/show_relaylog_events parameters +let $binary_log_file= ; +let $binary_log_limit_row= ; +let $binary_log_limit_offset= ; + +-- echo [MASTER] ********* SOW BINLOG EVENTS IN ... ********* +let $binary_log_file= master-bin.000002; +-- source include/show_binlog_events.inc + +-- echo [MASTER] ********* SOW BINLOG EVENTS ********* +let $binary_log_file= ; +-- source include/show_binlog_events.inc + +-- sync_slave_with_master + +-- echo [SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +let $binary_log_file= slave-bin.000002; +-- source include/show_binlog_events.inc + +-- echo [SLAVE] ********* SOW BINLOG EVENTS ********* +let $binary_log_file= ; +-- source include/show_binlog_events.inc + +-- echo [SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +let $binary_log_file= slave-relay-bin.000005; +-- source include/show_relaylog_events.inc + +-- echo [SLAVE] ********* SOW RELAYLOG EVENTS ********* +let $binary_log_file= ; +-- source include/show_relaylog_events.inc + +# clear show_binlog_event/show_relaylog_events parameters +let $binary_log_name= ; +let $binary_log_limit_row= ; +let $binary_log_limit_offset= ; diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index 68f913a16a3..353ee0e3ce9 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -1,10 +1,35 @@ # $binlog_start can be set by caller or take a default value +# $binary_log_file the name of the log file show +# $binary_log_limit_row - sets the number of binlog rows to be returned +# $binary_log_limit_offset - sets the offset where to start returning events + +let $show_binlog_events= show binlog events; if (!$binlog_start) { + # defaults to chop the first event in the binary log let $binlog_start=106; } + +if (!`SELECT '$binary_log_file' = ''`) +{ + let $show_binlog_events= $show_binlog_events in '$binary_log_file'; +} +let $show_binlog_events= $show_binlog_events from $binlog_start; + +if ($binary_log_limit_row) +{ + let $limit= limit; + if ($binary_log_limit_offset) + { + let $limit= $limit $binary_log_limit_offset, ; + } + + let $limit= $limit $binary_log_limit_row; + let $show_binlog_events= $show_binlog_events $limit; +} + --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start --replace_column 2 # 4 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ ---eval show binlog events from $binlog_start +--eval $show_binlog_events diff --git a/mysql-test/include/show_relaylog_events.inc b/mysql-test/include/show_relaylog_events.inc new file mode 100644 index 00000000000..6f63b055d58 --- /dev/null +++ b/mysql-test/include/show_relaylog_events.inc @@ -0,0 +1,35 @@ +# $binlog_start can be set by caller or take a default value +# $binary_log_file the name of the log file show +# $binary_log_limit_row - sets the number of binlog rows to be returned +# $binary_log_limit_offset - sets the offset where to start returning events + +let $show_binlog_events= show relaylog events; + +if (!$binlog_start) +{ + # defaults to chop the first event in the binary log + let $binlog_start=106; +} + +if (!`SELECT '$binary_log_file' = ''`) +{ + let $show_binlog_events= $show_binlog_events in '$binary_log_file'; +} +let $show_binlog_events= $show_binlog_events from $binlog_start; + +if ($binary_log_limit_row) +{ + let $limit= limit; + if ($binary_log_limit_offset) + { + let $limit= $limit $binary_log_limit_offset, ; + } + + let $limit= $limit $binary_log_limit_row; + let $show_binlog_events= $show_binlog_events $limit; +} + +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start +--replace_column 2 # 4 # 5 # +--replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/ +--eval $show_binlog_events diff --git a/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result new file mode 100644 index 00000000000..461ab14a93a --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result @@ -0,0 +1,274 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +INSERT INTO t1 VALUES (6); +[MASTER] ********* SOW BINLOG EVENTS IN ... ********* +show binlog events in 'master-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +[MASTER] ********* SOW BINLOG EVENTS ********* +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +[MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +show binlog events from limit 3; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +show binlog events from limit 1, 3; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +[SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +show binlog events in 'slave-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +[SLAVE] ********* SOW BINLOG EVENTS ********* +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +show binlog events from limit 3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +show binlog events from limit 1, 3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +[SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +show relaylog events in 'slave-relay-bin.000003' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +slave-relay-bin.000003 # Query # # BEGIN +slave-relay-bin.000003 # Table_map # # table_id: # (test.t1) +slave-relay-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F +slave-relay-bin.000003 # Query # # COMMIT +[SLAVE] ********* SOW RELAYLOG EVENTS ********* +show relaylog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 +[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows ********* +show relaylog events in 'slave-relay-bin.000003' from limit 3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows ********* +show relaylog events in 'slave-relay-bin.000003' from limit 1, 3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-relay-bin.000003 # Query # # BEGIN +FLUSH LOGS; +FLUSH LOGS; +DROP TABLE t1; +[MASTER] ********* SOW BINLOG EVENTS IN ... ********* +show binlog events in 'master-bin.000002' from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Query # # use `test`; DROP TABLE t1 +[MASTER] ********* SOW BINLOG EVENTS ********* +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Rotate # # master-bin.000002;pos=4 +[SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +show binlog events in 'slave-bin.000002' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000002 # Query # # use `test`; DROP TABLE t1 +[SLAVE] ********* SOW BINLOG EVENTS ********* +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Query # # BEGIN +slave-bin.000001 # Table_map # # table_id: # (test.t1) +slave-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +slave-bin.000001 # Query # # COMMIT +slave-bin.000001 # Rotate # # slave-bin.000002;pos=4 +[SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +show relaylog events in 'slave-relay-bin.000005' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 +slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4 +[SLAVE] ********* SOW RELAYLOG EVENTS ********* +show relaylog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 +slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4 diff --git a/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result new file mode 100644 index 00000000000..512a72c3040 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result @@ -0,0 +1,148 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +INSERT INTO t1 VALUES (4); +INSERT INTO t1 VALUES (5); +INSERT INTO t1 VALUES (6); +[MASTER] ********* SOW BINLOG EVENTS IN ... ********* +show binlog events in 'master-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +[MASTER] ********* SOW BINLOG EVENTS ********* +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +[MASTER] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +show binlog events from limit 3; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +[MASTER] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +show binlog events from limit 1, 3; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +[SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +show binlog events in 'slave-bin.000001' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +[SLAVE] ********* SOW BINLOG EVENTS ********* +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT rows ********* +show binlog events from limit 3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +[SLAVE] ********* SOW BINLOG EVENTS ... LIMIT offset,rows ********* +show binlog events from limit 1, 3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +[SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +show relaylog events in 'slave-relay-bin.000003' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (1) +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (2) +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (3) +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (4) +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (5) +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (6) +[SLAVE] ********* SOW RELAYLOG EVENTS ********* +show relaylog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000002 # Rotate # # slave-relay-bin.000003;pos=4 +[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT rows ********* +show relaylog events in 'slave-relay-bin.000003' from limit 3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4 +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +[MASTER] ********* SOW RELAYLOG EVENTS ... LIMIT offset,rows ********* +show relaylog events in 'slave-relay-bin.000003' from limit 1, 3; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION +slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (1) +FLUSH LOGS; +FLUSH LOGS; +DROP TABLE t1; +[MASTER] ********* SOW BINLOG EVENTS IN ... ********* +show binlog events in 'master-bin.000002' from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000002 # Query # # use `test`; DROP TABLE t1 +[MASTER] ********* SOW BINLOG EVENTS ********* +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +master-bin.000001 # Rotate # # master-bin.000002;pos=4 +[SLAVE] ********* SOW BINLOG EVENTS IN ... ********* +show binlog events in 'slave-bin.000002' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000002 # Query # # use `test`; DROP TABLE t1 +[SLAVE] ********* SOW BINLOG EVENTS ********* +show binlog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (1) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (2) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (3) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (4) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (5) +slave-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES (6) +slave-bin.000001 # Rotate # # slave-bin.000002;pos=4 +[SLAVE] ********* SOW RELAYLOG EVENTS IN ... ********* +show relaylog events in 'slave-relay-bin.000005' from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 +slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4 +[SLAVE] ********* SOW RELAYLOG EVENTS ********* +show relaylog events from ; +Log_name Pos Event_type Server_id End_log_pos Info +slave-relay-bin.000005 # Rotate # # master-bin.000002;pos=4 +slave-relay-bin.000005 # Rotate # # slave-relay-bin.000006;pos=4 diff --git a/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test new file mode 100644 index 00000000000..6a426efc7ea --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test @@ -0,0 +1,18 @@ +# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files +# +# GOAL +# ==== +# +# Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works after +# the patch, both on master and slave. +# +# HOW +# === +# +# This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after +# some statements have been issued. + +-- source include/master-slave.inc +-- source include/have_binlog_format_row.inc + +-- source extra/rpl_tests/rpl_show_relaylog_events.inc diff --git a/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test b/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test new file mode 100644 index 00000000000..523e883d9fa --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test @@ -0,0 +1,18 @@ +# BUG#28777 SHOW BINLOG EVENTS does not work on relay log files +# +# GOAL +# ==== +# +# Test that SHOW BINLOG EVENTS and the new SHOW RELAYLOG EVENTS works after +# the patch, both on master and slave. +# +# HOW +# === +# +# This test issues SHOW [BINLOG|RELAYLOG] EVENTS both on master and slave after +# some statements have been issued. + +-- source include/master-slave.inc +-- source include/have_binlog_format_mixed_or_statement.inc + +-- source extra/rpl_tests/rpl_show_relaylog_events.inc diff --git a/sql/lex.h b/sql/lex.h index b199a79350b..dd37d837045 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -429,6 +429,7 @@ static SYMBOL symbols[] = { { "REDUNDANT", SYM(REDUNDANT_SYM)}, { "REFERENCES", SYM(REFERENCES)}, { "REGEXP", SYM(REGEXP)}, + { "RELAYLOG", SYM(RELAYLOG_SYM)}, { "RELAY_LOG_FILE", SYM(RELAY_LOG_FILE_SYM)}, { "RELAY_LOG_POS", SYM(RELAY_LOG_POS_SYM)}, { "RELAY_THREAD", SYM(RELAY_THREAD)}, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7e9eb6e7291..9b70096eb73 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3135,6 +3135,7 @@ SHOW_VAR com_status_vars[]= { {"show_processlist", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROCESSLIST]), SHOW_LONG_STATUS}, {"show_profile", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROFILE]), SHOW_LONG_STATUS}, {"show_profiles", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_PROFILES]), SHOW_LONG_STATUS}, + {"show_relaylog_events", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_RELAYLOG_EVENTS]), SHOW_LONG_STATUS}, {"show_slave_hosts", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_HOSTS]), SHOW_LONG_STATUS}, {"show_slave_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_SLAVE_STAT]), SHOW_LONG_STATUS}, {"show_status", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_SHOW_STATUS]), SHOW_LONG_STATUS}, diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 0736e5fc2a8..9fed5db6e3a 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -174,6 +174,7 @@ sp_get_flags_for_command(LEX *lex) case SQLCOM_SHOW_AUTHORS: case SQLCOM_SHOW_BINLOGS: case SQLCOM_SHOW_BINLOG_EVENTS: + case SQLCOM_SHOW_RELAYLOG_EVENTS: case SQLCOM_SHOW_CHARSETS: case SQLCOM_SHOW_COLLATIONS: case SQLCOM_SHOW_COLUMN_TYPES: diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 6f9f667a75a..7db239cf9e3 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -121,7 +121,7 @@ enum enum_sql_command { SQLCOM_SHOW_CREATE_TRIGGER, SQLCOM_ALTER_DB_UPGRADE, SQLCOM_SHOW_PROFILE, SQLCOM_SHOW_PROFILES, - + SQLCOM_SHOW_RELAYLOG_EVENTS, /* When a command is added here, be sure it's also added in mysqld.cc in "struct show_var_st status_vars[]= {" ... diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ca27d476213..513b9230c37 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2319,6 +2319,7 @@ mysql_execute_command(THD *thd) res = show_slave_hosts(thd); break; } + case SQLCOM_SHOW_RELAYLOG_EVENTS: /* fall through */ case SQLCOM_SHOW_BINLOG_EVENTS: { if (check_global_access(thd, REPL_SLAVE_ACL)) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 0ec8d91214c..4d9b7410b88 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1401,6 +1401,7 @@ bool mysql_show_binlog_events(THD* thd) bool ret = TRUE; IO_CACHE log; File file = -1; + MYSQL_BIN_LOG *binary_log= NULL; DBUG_ENTER("mysql_show_binlog_events"); Log_event::init_show_field_list(&field_list); @@ -1411,14 +1412,30 @@ bool mysql_show_binlog_events(THD* thd) Format_description_log_event *description_event= new Format_description_log_event(3); /* MySQL 4.0 by default */ - /* - Wait for handlers to insert any pending information - into the binlog. For e.g. ndb which updates the binlog asynchronously - this is needed so that the uses sees all its own commands in the binlog - */ - ha_binlog_wait(thd); + DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS || + thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS); - if (mysql_bin_log.is_open()) + /* select wich binary log to use: binlog or relay */ + if ( thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ) + { + /* + Wait for handlers to insert any pending information + into the binlog. For e.g. ndb which updates the binlog asynchronously + this is needed so that the uses sees all its own commands in the binlog + */ + ha_binlog_wait(thd); + + binary_log= &mysql_bin_log; + } + else /* showing relay log contents */ + { + if (!active_mi) + DBUG_RETURN(TRUE); + + binary_log= &(active_mi->rli.relay_log); + } + + if (binary_log->is_open()) { LEX_MASTER_INFO *lex_mi= &thd->lex->mi; SELECT_LEX_UNIT *unit= &thd->lex->unit; @@ -1426,7 +1443,7 @@ bool mysql_show_binlog_events(THD* thd) my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly char search_file_name[FN_REFLEN], *name; const char *log_file_name = lex_mi->log_file_name; - pthread_mutex_t *log_lock = mysql_bin_log.get_log_lock(); + pthread_mutex_t *log_lock = binary_log->get_log_lock(); LOG_INFO linfo; Log_event* ev; @@ -1436,13 +1453,13 @@ bool mysql_show_binlog_events(THD* thd) name= search_file_name; if (log_file_name) - mysql_bin_log.make_log_name(search_file_name, log_file_name); + binary_log->make_log_name(search_file_name, log_file_name); else name=0; // Find first log linfo.index_file_offset = 0; - if (mysql_bin_log.find_log_pos(&linfo, name, 1)) + if (binary_log->find_log_pos(&linfo, name, 1)) { errmsg = "Could not find target log"; goto err; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a18f57bf9cf..1b415fea52d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -930,6 +930,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token REDUNDANT_SYM %token REFERENCES /* SQL-2003-R */ %token REGEXP +%token RELAYLOG_SYM %token RELAY_LOG_FILE_SYM %token RELAY_LOG_POS_SYM %token RELAY_THREAD @@ -9947,6 +9948,11 @@ show_param: LEX *lex= Lex; lex->sql_command= SQLCOM_SHOW_BINLOG_EVENTS; } opt_limit_clause_init + | RELAYLOG_SYM EVENTS_SYM binlog_in binlog_from + { + LEX *lex= Lex; + lex->sql_command= SQLCOM_SHOW_RELAYLOG_EVENTS; + } opt_limit_clause_init | keys_or_index from_or_in table_ident opt_db where_clause { LEX *lex= Lex; @@ -11588,6 +11594,7 @@ keyword_sp: | REDO_BUFFER_SIZE_SYM {} | REDOFILE_SYM {} | REDUNDANT_SYM {} + | RELAYLOG_SYM {} | RELAY_LOG_FILE_SYM {} | RELAY_LOG_POS_SYM {} | RELAY_THREAD {} From 3f41ba790e0d14ecafd9b59c9f26f92068c0594b Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 29 Sep 2009 00:13:56 +0100 Subject: [PATCH 39/88] Fixed tree_name: mysql-5.1 --> mysql-5.1-rep+2 --- .bzr-mysql/default.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzr-mysql/default.conf b/.bzr-mysql/default.conf index f044f8e62da..4e9e581f800 100644 --- a/.bzr-mysql/default.conf +++ b/.bzr-mysql/default.conf @@ -1,4 +1,4 @@ [MYSQL] post_commit_to = "commits@lists.mysql.com" post_push_to = "commits@lists.mysql.com" -tree_name = "mysql-5.1" +tree_name = "mysql-5.1-rep+2" From c03549bf05270b645c118e3bd74b07f386ef6a1b Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Tue, 29 Sep 2009 14:16:23 +0300 Subject: [PATCH 40/88] WL#342 heartbeat backporting from 6.0 code base to 5.1. --- mysql-test/extra/binlog_tests/binlog.test | 4 +- .../mix_innodb_myisam_binlog.test | 4 +- mysql-test/extra/rpl_tests/rpl_loaddata.test | 6 +- mysql-test/extra/rpl_tests/rpl_log.test | 6 +- mysql-test/include/show_binlog_events.inc | 2 +- mysql-test/include/show_binlog_events2.inc | 2 +- mysql-test/r/sp_trans_log.result | 12 +- .../suite/binlog/r/binlog_innodb.result | 10 +- .../suite/binlog/r/binlog_row_binlog.result | 1617 +++++++++-------- .../suite/binlog/r/binlog_stm_binlog.result | 8 +- mysql-test/suite/binlog/t/binlog_innodb.test | 6 +- mysql-test/suite/binlog/t/binlog_killed.test | 2 +- .../binlog/t/binlog_killed_simulate.test | 4 +- .../suite/rpl/r/rpl_binlog_grant.result | 42 +- .../suite/rpl/r/rpl_deadlock_innodb.result | 2 +- .../suite/rpl/r/rpl_extraCol_innodb.result | 4 +- .../suite/rpl/r/rpl_extraCol_myisam.result | 4 +- .../rpl/r/rpl_known_bugs_detection.result | 4 +- mysql-test/suite/rpl/r/rpl_loaddata.result | 126 +- .../suite/rpl/r/rpl_loaddata_fatal.result | 8 +- mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result | 4 +- .../suite/rpl/r/rpl_row_basic_11bugs.result | 12 +- .../suite/rpl/r/rpl_row_conflicts.result | 4 +- .../suite/rpl/r/rpl_row_create_table.result | 138 +- mysql-test/suite/rpl/r/rpl_row_drop.result | 8 +- .../suite/rpl/r/rpl_row_flsh_tbls.result | 4 +- mysql-test/suite/rpl/r/rpl_row_log.result | 10 +- .../suite/rpl/r/rpl_row_log_innodb.result | 10 +- mysql-test/suite/rpl/r/rpl_slave_skip.result | 8 +- mysql-test/suite/rpl/r/rpl_sp.result | 178 +- .../suite/rpl/r/rpl_stm_flsh_tbls.result | 4 +- mysql-test/suite/rpl/r/rpl_stm_log.result | 10 +- mysql-test/suite/rpl/t/rpl_binlog_grant.test | 8 +- .../suite/rpl/t/rpl_row_create_table.test | 16 +- mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test | 2 +- .../suite/rpl/t/rpl_row_mysqlbinlog.test | 8 +- mysql-test/suite/rpl/t/rpl_sp.test | 4 +- mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test | 2 +- mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result | 10 +- .../suite/rpl_ndb/r/rpl_truncate_7ndb.result | 68 +- mysql-test/t/ctype_cp932_binlog_stm.test | 4 +- mysql-test/t/mysqlbinlog.test | 6 +- mysql-test/t/mysqlbinlog2.test | 20 +- mysql-test/t/sp_trans_log.test | 3 +- sql/lex.h | 1 + sql/log.cc | 53 +- sql/log.h | 5 +- sql/log_event.cc | 14 + sql/log_event.h | 57 + sql/mysqld.cc | 36 + sql/rpl_mi.cc | 39 +- sql/rpl_mi.h | 2 + sql/slave.cc | 141 +- sql/slave.h | 12 +- sql/sql_lex.h | 5 +- sql/sql_repl.cc | 190 +- sql/sql_yacc.yy | 49 +- 57 files changed, 1809 insertions(+), 1209 deletions(-) diff --git a/mysql-test/extra/binlog_tests/binlog.test b/mysql-test/extra/binlog_tests/binlog.test index 5d898d41a54..08510d661e2 100644 --- a/mysql-test/extra/binlog_tests/binlog.test +++ b/mysql-test/extra/binlog_tests/binlog.test @@ -43,10 +43,10 @@ commit; drop table t1; --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events in 'master-bin.000001' from 106; +show binlog events in 'master-bin.000001' from 107; --replace_column 2 # 5 # --replace_regex /table_id: [0-9]+/table_id: #/ /\/\* xid=.* \*\//\/* xid= *\// -show binlog events in 'master-bin.000002' from 106; +show binlog events in 'master-bin.000002' from 107; # diff --git a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test index 5db79e4f848..da0b77fbc23 100644 --- a/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test +++ b/mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test @@ -323,12 +323,12 @@ let $MYSQLD_DATADIR= `select @@datadir`; # and does not make slave to stop) if (`select @@binlog_format = 'ROW'`) { - --exec $MYSQL_BINLOG --start-position=524 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output + --exec $MYSQL_BINLOG --start-position=525 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output } if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) { - --exec $MYSQL_BINLOG --start-position=555 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output + --exec $MYSQL_BINLOG --start-position=556 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output } --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR diff --git a/mysql-test/extra/rpl_tests/rpl_loaddata.test b/mysql-test/extra/rpl_tests/rpl_loaddata.test index 26916642cae..129a39ac509 100644 --- a/mysql-test/extra/rpl_tests/rpl_loaddata.test +++ b/mysql-test/extra/rpl_tests/rpl_loaddata.test @@ -72,7 +72,7 @@ start slave; sync_with_master; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 16 # 23 # 33 # -show slave status; +--query_vertical show slave status; # Trigger error again to test CHANGE MASTER @@ -94,7 +94,7 @@ change master to master_user='test'; change master to master_user='root'; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 16 # 23 # 33 # -show slave status; +--query_vertical show slave status; # Trigger error again to test RESET SLAVE @@ -116,7 +116,7 @@ stop slave; reset slave; --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 16 # 23 # 33 # -show slave status; +--query_vertical show slave status; # Finally, see if logging is done ok on master for a failing LOAD DATA INFILE diff --git a/mysql-test/extra/rpl_tests/rpl_log.test b/mysql-test/extra/rpl_tests/rpl_log.test index e4ebfd68761..0517fea1be3 100644 --- a/mysql-test/extra/rpl_tests/rpl_log.test +++ b/mysql-test/extra/rpl_tests/rpl_log.test @@ -37,13 +37,13 @@ select count(*) from t1; show binlog events; --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 106 limit 1; +show binlog events from 107 limit 1; --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 106 limit 2; +show binlog events from 107 limit 2; --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -show binlog events from 106 limit 2,1; +show binlog events from 107 limit 2,1; flush logs; # We need an extra update before doing save_master_pos. diff --git a/mysql-test/include/show_binlog_events.inc b/mysql-test/include/show_binlog_events.inc index 68f913a16a3..93014d9f1a3 100644 --- a/mysql-test/include/show_binlog_events.inc +++ b/mysql-test/include/show_binlog_events.inc @@ -2,7 +2,7 @@ if (!$binlog_start) { - let $binlog_start=106; + let $binlog_start=107; } --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start --replace_column 2 # 4 # 5 # diff --git a/mysql-test/include/show_binlog_events2.inc b/mysql-test/include/show_binlog_events2.inc index 5dd272c562d..0e1a889bacc 100644 --- a/mysql-test/include/show_binlog_events2.inc +++ b/mysql-test/include/show_binlog_events2.inc @@ -1,4 +1,4 @@ ---let $binlog_start=106 +--let $binlog_start=107 --replace_result $binlog_start --replace_column 2 # 5 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result index 7a6173b89e2..3eec6f70063 100644 --- a/mysql-test/r/sp_trans_log.result +++ b/mysql-test/r/sp_trans_log.result @@ -14,13 +14,13 @@ end| reset master| insert into t2 values (bug23333(),1)| ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -show binlog events from 106 /* with fixes for #23333 will show there is the query */| +show binlog events from | Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # # -master-bin.000001 # Table_map 1 # # -master-bin.000001 # Table_map 1 # # -master-bin.000001 # Write_rows 1 # # -master-bin.000001 # Query 1 # # +master-bin.000001 # Query # # use `test`; BEGIN +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # use `test`; ROLLBACK select count(*),@a from t1 /* must be 1,1 */| count(*) @a 1 1 diff --git a/mysql-test/suite/binlog/r/binlog_innodb.result b/mysql-test/suite/binlog/r/binlog_innodb.result index 1922897f631..424f7d60829 100644 --- a/mysql-test/suite/binlog/r/binlog_innodb.result +++ b/mysql-test/suite/binlog/r/binlog_innodb.result @@ -156,9 +156,10 @@ select * from t2 /* must be (3,1), (4,4) */; a b 1 1 4 4 -show master status /* there must no UPDATE in binlog */; +there must no UPDATE in binlog +show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 106 +master-bin.000001 # delete from t1; delete from t2; insert into t1 values (1,2),(3,4),(4,4); @@ -166,8 +167,9 @@ insert into t2 values (1,2),(3,4),(4,4); reset master; UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; ERROR 23000: Duplicate entry '4' for key 'PRIMARY' -show master status /* there must be no UPDATE query event */; +there must no UPDATE in binlog +show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 106 +master-bin.000001 # drop table t1, t2; End of tests diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index f6b5392dbc8..d2d702b12a0 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -26,7 +26,7 @@ create table t1 (n int) engine=innodb; begin; commit; drop table t1; -show binlog events in 'master-bin.000001' from 106; +show binlog events in 'master-bin.000001' from 107; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb master-bin.000001 # Query 1 # BEGIN @@ -232,7 +232,7 @@ master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* xid= */ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 -show binlog events in 'master-bin.000002' from 106; +show binlog events in 'master-bin.000002' from 107; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query 1 # use `test`; drop table t1 set @ac = @@autocommit; @@ -273,802 +273,819 @@ master-bin.000001 349 Table_map 1 390 table_id: # (test.t1) master-bin.000001 390 Write_rows 1 424 table_id: # flags: STMT_END_F master-bin.000001 424 Table_map 1 465 table_id: # (test.t1) master-bin.000001 465 Write_rows 1 499 table_id: # flags: STMT_END_F -master-bin.000001 499 Table_map 1 540 table_id: # (test.t1) -master-bin.000001 540 Write_rows 1 574 table_id: # flags: STMT_END_F -master-bin.000001 574 Table_map 1 615 table_id: # (test.t1) -master-bin.000001 615 Write_rows 1 649 table_id: # flags: STMT_END_F -master-bin.000001 649 Table_map 1 690 table_id: # (test.t1) -master-bin.000001 690 Write_rows 1 724 table_id: # flags: STMT_END_F -master-bin.000001 724 Table_map 1 765 table_id: # (test.t1) -master-bin.000001 765 Write_rows 1 799 table_id: # flags: STMT_END_F -master-bin.000001 799 Table_map 1 840 table_id: # (test.t1) -master-bin.000001 840 Write_rows 1 874 table_id: # flags: STMT_END_F -master-bin.000001 874 Table_map 1 915 table_id: # (test.t1) -master-bin.000001 915 Write_rows 1 949 table_id: # flags: STMT_END_F -master-bin.000001 949 Table_map 1 990 table_id: # (test.t1) -master-bin.000001 990 Write_rows 1 1024 table_id: # flags: STMT_END_F -master-bin.000001 1024 Table_map 1 1065 table_id: # (test.t1) -master-bin.000001 1065 Write_rows 1 1099 table_id: # flags: STMT_END_F -master-bin.000001 1099 Table_map 1 1140 table_id: # (test.t1) -master-bin.000001 1140 Write_rows 1 1174 table_id: # flags: STMT_END_F -master-bin.000001 1174 Table_map 1 1215 table_id: # (test.t1) -master-bin.000001 1215 Write_rows 1 1249 table_id: # flags: STMT_END_F -master-bin.000001 1249 Table_map 1 1290 table_id: # (test.t1) -master-bin.000001 1290 Write_rows 1 1324 table_id: # flags: STMT_END_F -master-bin.000001 1324 Table_map 1 1365 table_id: # (test.t1) -master-bin.000001 1365 Write_rows 1 1399 table_id: # flags: STMT_END_F -master-bin.000001 1399 Table_map 1 1440 table_id: # (test.t1) -master-bin.000001 1440 Write_rows 1 1474 table_id: # flags: STMT_END_F -master-bin.000001 1474 Table_map 1 1515 table_id: # (test.t1) -master-bin.000001 1515 Write_rows 1 1549 table_id: # flags: STMT_END_F -master-bin.000001 1549 Table_map 1 1590 table_id: # (test.t1) -master-bin.000001 1590 Write_rows 1 1624 table_id: # flags: STMT_END_F -master-bin.000001 1624 Table_map 1 1665 table_id: # (test.t1) -master-bin.000001 1665 Write_rows 1 1699 table_id: # flags: STMT_END_F -master-bin.000001 1699 Table_map 1 1740 table_id: # (test.t1) -master-bin.000001 1740 Write_rows 1 1774 table_id: # flags: STMT_END_F -master-bin.000001 1774 Table_map 1 1815 table_id: # (test.t1) -master-bin.000001 1815 Write_rows 1 1849 table_id: # flags: STMT_END_F -master-bin.000001 1849 Table_map 1 1890 table_id: # (test.t1) -master-bin.000001 1890 Write_rows 1 1924 table_id: # flags: STMT_END_F -master-bin.000001 1924 Table_map 1 1965 table_id: # (test.t1) -master-bin.000001 1965 Write_rows 1 1999 table_id: # flags: STMT_END_F -master-bin.000001 1999 Table_map 1 2040 table_id: # (test.t1) -master-bin.000001 2040 Write_rows 1 2074 table_id: # flags: STMT_END_F -master-bin.000001 2074 Table_map 1 2115 table_id: # (test.t1) -master-bin.000001 2115 Write_rows 1 2149 table_id: # flags: STMT_END_F -master-bin.000001 2149 Table_map 1 2190 table_id: # (test.t1) -master-bin.000001 2190 Write_rows 1 2224 table_id: # flags: STMT_END_F -master-bin.000001 2224 Table_map 1 2265 table_id: # (test.t1) -master-bin.000001 2265 Write_rows 1 2299 table_id: # flags: STMT_END_F -master-bin.000001 2299 Table_map 1 2340 table_id: # (test.t1) -master-bin.000001 2340 Write_rows 1 2374 table_id: # flags: STMT_END_F -master-bin.000001 2374 Table_map 1 2415 table_id: # (test.t1) -master-bin.000001 2415 Write_rows 1 2449 table_id: # flags: STMT_END_F -master-bin.000001 2449 Table_map 1 2490 table_id: # (test.t1) -master-bin.000001 2490 Write_rows 1 2524 table_id: # flags: STMT_END_F -master-bin.000001 2524 Table_map 1 2565 table_id: # (test.t1) -master-bin.000001 2565 Write_rows 1 2599 table_id: # flags: STMT_END_F -master-bin.000001 2599 Table_map 1 2640 table_id: # (test.t1) -master-bin.000001 2640 Write_rows 1 2674 table_id: # flags: STMT_END_F -master-bin.000001 2674 Table_map 1 2715 table_id: # (test.t1) -master-bin.000001 2715 Write_rows 1 2749 table_id: # flags: STMT_END_F -master-bin.000001 2749 Table_map 1 2790 table_id: # (test.t1) -master-bin.000001 2790 Write_rows 1 2824 table_id: # flags: STMT_END_F -master-bin.000001 2824 Table_map 1 2865 table_id: # (test.t1) -master-bin.000001 2865 Write_rows 1 2899 table_id: # flags: STMT_END_F -master-bin.000001 2899 Table_map 1 2940 table_id: # (test.t1) -master-bin.000001 2940 Write_rows 1 2974 table_id: # flags: STMT_END_F -master-bin.000001 2974 Table_map 1 3015 table_id: # (test.t1) -master-bin.000001 3015 Write_rows 1 3049 table_id: # flags: STMT_END_F -master-bin.000001 3049 Table_map 1 3090 table_id: # (test.t1) -master-bin.000001 3090 Write_rows 1 3124 table_id: # flags: STMT_END_F -master-bin.000001 3124 Table_map 1 3165 table_id: # (test.t1) -master-bin.000001 3165 Write_rows 1 3199 table_id: # flags: STMT_END_F -master-bin.000001 3199 Table_map 1 3240 table_id: # (test.t1) -master-bin.000001 3240 Write_rows 1 3274 table_id: # flags: STMT_END_F -master-bin.000001 3274 Table_map 1 3315 table_id: # (test.t1) -master-bin.000001 3315 Write_rows 1 3349 table_id: # flags: STMT_END_F -master-bin.000001 3349 Table_map 1 3390 table_id: # (test.t1) -master-bin.000001 3390 Write_rows 1 3424 table_id: # flags: STMT_END_F -master-bin.000001 3424 Table_map 1 3465 table_id: # (test.t1) -master-bin.000001 3465 Write_rows 1 3499 table_id: # flags: STMT_END_F -master-bin.000001 3499 Table_map 1 3540 table_id: # (test.t1) -master-bin.000001 3540 Write_rows 1 3574 table_id: # flags: STMT_END_F -master-bin.000001 3574 Table_map 1 3615 table_id: # (test.t1) -master-bin.000001 3615 Write_rows 1 3649 table_id: # flags: STMT_END_F -master-bin.000001 3649 Table_map 1 3690 table_id: # (test.t1) -master-bin.000001 3690 Write_rows 1 3724 table_id: # flags: STMT_END_F -master-bin.000001 3724 Table_map 1 3765 table_id: # (test.t1) -master-bin.000001 3765 Write_rows 1 3799 table_id: # flags: STMT_END_F -master-bin.000001 3799 Table_map 1 3840 table_id: # (test.t1) -master-bin.000001 3840 Write_rows 1 3874 table_id: # flags: STMT_END_F -master-bin.000001 3874 Table_map 1 3915 table_id: # (test.t1) -master-bin.000001 3915 Write_rows 1 3949 table_id: # flags: STMT_END_F -master-bin.000001 3949 Table_map 1 3990 table_id: # (test.t1) -master-bin.000001 3990 Write_rows 1 4024 table_id: # flags: STMT_END_F -master-bin.000001 4024 Table_map 1 4065 table_id: # (test.t1) -master-bin.000001 4065 Write_rows 1 4099 table_id: # flags: STMT_END_F -master-bin.000001 4099 Table_map 1 4140 table_id: # (test.t1) -master-bin.000001 4140 Write_rows 1 4174 table_id: # flags: STMT_END_F -master-bin.000001 4174 Table_map 1 4215 table_id: # (test.t1) -master-bin.000001 4215 Write_rows 1 4249 table_id: # flags: STMT_END_F -master-bin.000001 4249 Table_map 1 4290 table_id: # (test.t1) -master-bin.000001 4290 Write_rows 1 4324 table_id: # flags: STMT_END_F -master-bin.000001 4324 Table_map 1 4365 table_id: # (test.t1) -master-bin.000001 4365 Write_rows 1 4399 table_id: # flags: STMT_END_F -master-bin.000001 4399 Table_map 1 4440 table_id: # (test.t1) -master-bin.000001 4440 Write_rows 1 4474 table_id: # flags: STMT_END_F -master-bin.000001 4474 Table_map 1 4515 table_id: # (test.t1) -master-bin.000001 4515 Write_rows 1 4549 table_id: # flags: STMT_END_F -master-bin.000001 4549 Table_map 1 4590 table_id: # (test.t1) -master-bin.000001 4590 Write_rows 1 4624 table_id: # flags: STMT_END_F -master-bin.000001 4624 Table_map 1 4665 table_id: # (test.t1) -master-bin.000001 4665 Write_rows 1 4699 table_id: # flags: STMT_END_F -master-bin.000001 4699 Table_map 1 4740 table_id: # (test.t1) -master-bin.000001 4740 Write_rows 1 4774 table_id: # flags: STMT_END_F -master-bin.000001 4774 Table_map 1 4815 table_id: # (test.t1) -master-bin.000001 4815 Write_rows 1 4849 table_id: # flags: STMT_END_F -master-bin.000001 4849 Table_map 1 4890 table_id: # (test.t1) -master-bin.000001 4890 Write_rows 1 4924 table_id: # flags: STMT_END_F -master-bin.000001 4924 Table_map 1 4965 table_id: # (test.t1) -master-bin.000001 4965 Write_rows 1 4999 table_id: # flags: STMT_END_F -master-bin.000001 4999 Table_map 1 5040 table_id: # (test.t1) -master-bin.000001 5040 Write_rows 1 5074 table_id: # flags: STMT_END_F -master-bin.000001 5074 Table_map 1 5115 table_id: # (test.t1) -master-bin.000001 5115 Write_rows 1 5149 table_id: # flags: STMT_END_F -master-bin.000001 5149 Table_map 1 5190 table_id: # (test.t1) -master-bin.000001 5190 Write_rows 1 5224 table_id: # flags: STMT_END_F -master-bin.000001 5224 Table_map 1 5265 table_id: # (test.t1) -master-bin.000001 5265 Write_rows 1 5299 table_id: # flags: STMT_END_F -master-bin.000001 5299 Table_map 1 5340 table_id: # (test.t1) -master-bin.000001 5340 Write_rows 1 5374 table_id: # flags: STMT_END_F -master-bin.000001 5374 Table_map 1 5415 table_id: # (test.t1) -master-bin.000001 5415 Write_rows 1 5449 table_id: # flags: STMT_END_F -master-bin.000001 5449 Table_map 1 5490 table_id: # (test.t1) -master-bin.000001 5490 Write_rows 1 5524 table_id: # flags: STMT_END_F -master-bin.000001 5524 Table_map 1 5565 table_id: # (test.t1) -master-bin.000001 5565 Write_rows 1 5599 table_id: # flags: STMT_END_F -master-bin.000001 5599 Table_map 1 5640 table_id: # (test.t1) -master-bin.000001 5640 Write_rows 1 5674 table_id: # flags: STMT_END_F -master-bin.000001 5674 Table_map 1 5715 table_id: # (test.t1) -master-bin.000001 5715 Write_rows 1 5749 table_id: # flags: STMT_END_F -master-bin.000001 5749 Table_map 1 5790 table_id: # (test.t1) -master-bin.000001 5790 Write_rows 1 5824 table_id: # flags: STMT_END_F -master-bin.000001 5824 Table_map 1 5865 table_id: # (test.t1) -master-bin.000001 5865 Write_rows 1 5899 table_id: # flags: STMT_END_F -master-bin.000001 5899 Table_map 1 5940 table_id: # (test.t1) -master-bin.000001 5940 Write_rows 1 5974 table_id: # flags: STMT_END_F -master-bin.000001 5974 Table_map 1 6015 table_id: # (test.t1) -master-bin.000001 6015 Write_rows 1 6049 table_id: # flags: STMT_END_F -master-bin.000001 6049 Table_map 1 6090 table_id: # (test.t1) -master-bin.000001 6090 Write_rows 1 6124 table_id: # flags: STMT_END_F -master-bin.000001 6124 Table_map 1 6165 table_id: # (test.t1) -master-bin.000001 6165 Write_rows 1 6199 table_id: # flags: STMT_END_F -master-bin.000001 6199 Table_map 1 6240 table_id: # (test.t1) -master-bin.000001 6240 Write_rows 1 6274 table_id: # flags: STMT_END_F -master-bin.000001 6274 Table_map 1 6315 table_id: # (test.t1) -master-bin.000001 6315 Write_rows 1 6349 table_id: # flags: STMT_END_F -master-bin.000001 6349 Table_map 1 6390 table_id: # (test.t1) -master-bin.000001 6390 Write_rows 1 6424 table_id: # flags: STMT_END_F -master-bin.000001 6424 Table_map 1 6465 table_id: # (test.t1) -master-bin.000001 6465 Write_rows 1 6499 table_id: # flags: STMT_END_F -master-bin.000001 6499 Table_map 1 6540 table_id: # (test.t1) -master-bin.000001 6540 Write_rows 1 6574 table_id: # flags: STMT_END_F -master-bin.000001 6574 Table_map 1 6615 table_id: # (test.t1) -master-bin.000001 6615 Write_rows 1 6649 table_id: # flags: STMT_END_F -master-bin.000001 6649 Table_map 1 6690 table_id: # (test.t1) -master-bin.000001 6690 Write_rows 1 6724 table_id: # flags: STMT_END_F -master-bin.000001 6724 Table_map 1 6765 table_id: # (test.t1) -master-bin.000001 6765 Write_rows 1 6799 table_id: # flags: STMT_END_F -master-bin.000001 6799 Table_map 1 6840 table_id: # (test.t1) -master-bin.000001 6840 Write_rows 1 6874 table_id: # flags: STMT_END_F -master-bin.000001 6874 Table_map 1 6915 table_id: # (test.t1) -master-bin.000001 6915 Write_rows 1 6949 table_id: # flags: STMT_END_F -master-bin.000001 6949 Table_map 1 6990 table_id: # (test.t1) -master-bin.000001 6990 Write_rows 1 7024 table_id: # flags: STMT_END_F -master-bin.000001 7024 Table_map 1 7065 table_id: # (test.t1) -master-bin.000001 7065 Write_rows 1 7099 table_id: # flags: STMT_END_F -master-bin.000001 7099 Table_map 1 7140 table_id: # (test.t1) -master-bin.000001 7140 Write_rows 1 7174 table_id: # flags: STMT_END_F -master-bin.000001 7174 Table_map 1 7215 table_id: # (test.t1) -master-bin.000001 7215 Write_rows 1 7249 table_id: # flags: STMT_END_F -master-bin.000001 7249 Table_map 1 7290 table_id: # (test.t1) -master-bin.000001 7290 Write_rows 1 7324 table_id: # flags: STMT_END_F -master-bin.000001 7324 Table_map 1 7365 table_id: # (test.t1) -master-bin.000001 7365 Write_rows 1 7399 table_id: # flags: STMT_END_F -master-bin.000001 7399 Table_map 1 7440 table_id: # (test.t1) -master-bin.000001 7440 Write_rows 1 7474 table_id: # flags: STMT_END_F -master-bin.000001 7474 Table_map 1 7515 table_id: # (test.t1) -master-bin.000001 7515 Write_rows 1 7549 table_id: # flags: STMT_END_F -master-bin.000001 7549 Table_map 1 7590 table_id: # (test.t1) -master-bin.000001 7590 Write_rows 1 7624 table_id: # flags: STMT_END_F -master-bin.000001 7624 Table_map 1 7665 table_id: # (test.t1) -master-bin.000001 7665 Write_rows 1 7699 table_id: # flags: STMT_END_F -master-bin.000001 7699 Table_map 1 7740 table_id: # (test.t1) -master-bin.000001 7740 Write_rows 1 7774 table_id: # flags: STMT_END_F -master-bin.000001 7774 Table_map 1 7815 table_id: # (test.t1) -master-bin.000001 7815 Write_rows 1 7849 table_id: # flags: STMT_END_F -master-bin.000001 7849 Table_map 1 7890 table_id: # (test.t1) -master-bin.000001 7890 Write_rows 1 7924 table_id: # flags: STMT_END_F -master-bin.000001 7924 Table_map 1 7965 table_id: # (test.t1) -master-bin.000001 7965 Write_rows 1 7999 table_id: # flags: STMT_END_F -master-bin.000001 7999 Table_map 1 8040 table_id: # (test.t1) -master-bin.000001 8040 Write_rows 1 8074 table_id: # flags: STMT_END_F -master-bin.000001 8074 Table_map 1 8115 table_id: # (test.t1) -master-bin.000001 8115 Write_rows 1 8149 table_id: # flags: STMT_END_F -master-bin.000001 8149 Table_map 1 8190 table_id: # (test.t1) -master-bin.000001 8190 Write_rows 1 8224 table_id: # flags: STMT_END_F -master-bin.000001 8224 Table_map 1 8265 table_id: # (test.t1) -master-bin.000001 8265 Write_rows 1 8299 table_id: # flags: STMT_END_F -master-bin.000001 8299 Table_map 1 8340 table_id: # (test.t1) -master-bin.000001 8340 Write_rows 1 8374 table_id: # flags: STMT_END_F -master-bin.000001 8374 Table_map 1 8415 table_id: # (test.t1) -master-bin.000001 8415 Write_rows 1 8449 table_id: # flags: STMT_END_F -master-bin.000001 8449 Table_map 1 8490 table_id: # (test.t1) -master-bin.000001 8490 Write_rows 1 8524 table_id: # flags: STMT_END_F -master-bin.000001 8524 Table_map 1 8565 table_id: # (test.t1) -master-bin.000001 8565 Write_rows 1 8599 table_id: # flags: STMT_END_F -master-bin.000001 8599 Table_map 1 8640 table_id: # (test.t1) -master-bin.000001 8640 Write_rows 1 8674 table_id: # flags: STMT_END_F -master-bin.000001 8674 Table_map 1 8715 table_id: # (test.t1) -master-bin.000001 8715 Write_rows 1 8749 table_id: # flags: STMT_END_F -master-bin.000001 8749 Table_map 1 8790 table_id: # (test.t1) -master-bin.000001 8790 Write_rows 1 8824 table_id: # flags: STMT_END_F -master-bin.000001 8824 Table_map 1 8865 table_id: # (test.t1) -master-bin.000001 8865 Write_rows 1 8899 table_id: # flags: STMT_END_F -master-bin.000001 8899 Table_map 1 8940 table_id: # (test.t1) -master-bin.000001 8940 Write_rows 1 8974 table_id: # flags: STMT_END_F -master-bin.000001 8974 Table_map 1 9015 table_id: # (test.t1) -master-bin.000001 9015 Write_rows 1 9049 table_id: # flags: STMT_END_F -master-bin.000001 9049 Table_map 1 9090 table_id: # (test.t1) -master-bin.000001 9090 Write_rows 1 9124 table_id: # flags: STMT_END_F -master-bin.000001 9124 Table_map 1 9165 table_id: # (test.t1) -master-bin.000001 9165 Write_rows 1 9199 table_id: # flags: STMT_END_F -master-bin.000001 9199 Table_map 1 9240 table_id: # (test.t1) -master-bin.000001 9240 Write_rows 1 9274 table_id: # flags: STMT_END_F -master-bin.000001 9274 Table_map 1 9315 table_id: # (test.t1) -master-bin.000001 9315 Write_rows 1 9349 table_id: # flags: STMT_END_F -master-bin.000001 9349 Table_map 1 9390 table_id: # (test.t1) -master-bin.000001 9390 Write_rows 1 9424 table_id: # flags: STMT_END_F -master-bin.000001 9424 Table_map 1 9465 table_id: # (test.t1) -master-bin.000001 9465 Write_rows 1 9499 table_id: # flags: STMT_END_F -master-bin.000001 9499 Table_map 1 9540 table_id: # (test.t1) -master-bin.000001 9540 Write_rows 1 9574 table_id: # flags: STMT_END_F -master-bin.000001 9574 Table_map 1 9615 table_id: # (test.t1) -master-bin.000001 9615 Write_rows 1 9649 table_id: # flags: STMT_END_F -master-bin.000001 9649 Table_map 1 9690 table_id: # (test.t1) -master-bin.000001 9690 Write_rows 1 9724 table_id: # flags: STMT_END_F -master-bin.000001 9724 Table_map 1 9765 table_id: # (test.t1) -master-bin.000001 9765 Write_rows 1 9799 table_id: # flags: STMT_END_F -master-bin.000001 9799 Table_map 1 9840 table_id: # (test.t1) -master-bin.000001 9840 Write_rows 1 9874 table_id: # flags: STMT_END_F -master-bin.000001 9874 Table_map 1 9915 table_id: # (test.t1) -master-bin.000001 9915 Write_rows 1 9949 table_id: # flags: STMT_END_F -master-bin.000001 9949 Table_map 1 9990 table_id: # (test.t1) -master-bin.000001 9990 Write_rows 1 10024 table_id: # flags: STMT_END_F -master-bin.000001 10024 Table_map 1 10065 table_id: # (test.t1) -master-bin.000001 10065 Write_rows 1 10099 table_id: # flags: STMT_END_F -master-bin.000001 10099 Table_map 1 10140 table_id: # (test.t1) -master-bin.000001 10140 Write_rows 1 10174 table_id: # flags: STMT_END_F -master-bin.000001 10174 Table_map 1 10215 table_id: # (test.t1) -master-bin.000001 10215 Write_rows 1 10249 table_id: # flags: STMT_END_F -master-bin.000001 10249 Table_map 1 10290 table_id: # (test.t1) -master-bin.000001 10290 Write_rows 1 10324 table_id: # flags: STMT_END_F -master-bin.000001 10324 Table_map 1 10365 table_id: # (test.t1) -master-bin.000001 10365 Write_rows 1 10399 table_id: # flags: STMT_END_F -master-bin.000001 10399 Table_map 1 10440 table_id: # (test.t1) -master-bin.000001 10440 Write_rows 1 10474 table_id: # flags: STMT_END_F -master-bin.000001 10474 Table_map 1 10515 table_id: # (test.t1) -master-bin.000001 10515 Write_rows 1 10549 table_id: # flags: STMT_END_F -master-bin.000001 10549 Table_map 1 10590 table_id: # (test.t1) -master-bin.000001 10590 Write_rows 1 10624 table_id: # flags: STMT_END_F -master-bin.000001 10624 Table_map 1 10665 table_id: # (test.t1) -master-bin.000001 10665 Write_rows 1 10699 table_id: # flags: STMT_END_F -master-bin.000001 10699 Table_map 1 10740 table_id: # (test.t1) -master-bin.000001 10740 Write_rows 1 10774 table_id: # flags: STMT_END_F -master-bin.000001 10774 Table_map 1 10815 table_id: # (test.t1) -master-bin.000001 10815 Write_rows 1 10849 table_id: # flags: STMT_END_F -master-bin.000001 10849 Table_map 1 10890 table_id: # (test.t1) -master-bin.000001 10890 Write_rows 1 10924 table_id: # flags: STMT_END_F -master-bin.000001 10924 Table_map 1 10965 table_id: # (test.t1) -master-bin.000001 10965 Write_rows 1 10999 table_id: # flags: STMT_END_F -master-bin.000001 10999 Table_map 1 11040 table_id: # (test.t1) -master-bin.000001 11040 Write_rows 1 11074 table_id: # flags: STMT_END_F -master-bin.000001 11074 Table_map 1 11115 table_id: # (test.t1) -master-bin.000001 11115 Write_rows 1 11149 table_id: # flags: STMT_END_F -master-bin.000001 11149 Table_map 1 11190 table_id: # (test.t1) -master-bin.000001 11190 Write_rows 1 11224 table_id: # flags: STMT_END_F -master-bin.000001 11224 Table_map 1 11265 table_id: # (test.t1) -master-bin.000001 11265 Write_rows 1 11299 table_id: # flags: STMT_END_F -master-bin.000001 11299 Table_map 1 11340 table_id: # (test.t1) -master-bin.000001 11340 Write_rows 1 11374 table_id: # flags: STMT_END_F -master-bin.000001 11374 Table_map 1 11415 table_id: # (test.t1) -master-bin.000001 11415 Write_rows 1 11449 table_id: # flags: STMT_END_F -master-bin.000001 11449 Table_map 1 11490 table_id: # (test.t1) -master-bin.000001 11490 Write_rows 1 11524 table_id: # flags: STMT_END_F -master-bin.000001 11524 Table_map 1 11565 table_id: # (test.t1) -master-bin.000001 11565 Write_rows 1 11599 table_id: # flags: STMT_END_F -master-bin.000001 11599 Table_map 1 11640 table_id: # (test.t1) -master-bin.000001 11640 Write_rows 1 11674 table_id: # flags: STMT_END_F -master-bin.000001 11674 Table_map 1 11715 table_id: # (test.t1) -master-bin.000001 11715 Write_rows 1 11749 table_id: # flags: STMT_END_F -master-bin.000001 11749 Table_map 1 11790 table_id: # (test.t1) -master-bin.000001 11790 Write_rows 1 11824 table_id: # flags: STMT_END_F -master-bin.000001 11824 Table_map 1 11865 table_id: # (test.t1) -master-bin.000001 11865 Write_rows 1 11899 table_id: # flags: STMT_END_F -master-bin.000001 11899 Table_map 1 11940 table_id: # (test.t1) -master-bin.000001 11940 Write_rows 1 11974 table_id: # flags: STMT_END_F -master-bin.000001 11974 Table_map 1 12015 table_id: # (test.t1) -master-bin.000001 12015 Write_rows 1 12049 table_id: # flags: STMT_END_F -master-bin.000001 12049 Table_map 1 12090 table_id: # (test.t1) -master-bin.000001 12090 Write_rows 1 12124 table_id: # flags: STMT_END_F -master-bin.000001 12124 Table_map 1 12165 table_id: # (test.t1) -master-bin.000001 12165 Write_rows 1 12199 table_id: # flags: STMT_END_F -master-bin.000001 12199 Table_map 1 12240 table_id: # (test.t1) -master-bin.000001 12240 Write_rows 1 12274 table_id: # flags: STMT_END_F -master-bin.000001 12274 Table_map 1 12315 table_id: # (test.t1) -master-bin.000001 12315 Write_rows 1 12349 table_id: # flags: STMT_END_F -master-bin.000001 12349 Table_map 1 12390 table_id: # (test.t1) -master-bin.000001 12390 Write_rows 1 12424 table_id: # flags: STMT_END_F -master-bin.000001 12424 Table_map 1 12465 table_id: # (test.t1) -master-bin.000001 12465 Write_rows 1 12499 table_id: # flags: STMT_END_F -master-bin.000001 12499 Table_map 1 12540 table_id: # (test.t1) -master-bin.000001 12540 Write_rows 1 12574 table_id: # flags: STMT_END_F -master-bin.000001 12574 Table_map 1 12615 table_id: # (test.t1) -master-bin.000001 12615 Write_rows 1 12649 table_id: # flags: STMT_END_F -master-bin.000001 12649 Table_map 1 12690 table_id: # (test.t1) -master-bin.000001 12690 Write_rows 1 12724 table_id: # flags: STMT_END_F -master-bin.000001 12724 Table_map 1 12765 table_id: # (test.t1) -master-bin.000001 12765 Write_rows 1 12799 table_id: # flags: STMT_END_F -master-bin.000001 12799 Table_map 1 12840 table_id: # (test.t1) -master-bin.000001 12840 Write_rows 1 12874 table_id: # flags: STMT_END_F -master-bin.000001 12874 Table_map 1 12915 table_id: # (test.t1) -master-bin.000001 12915 Write_rows 1 12949 table_id: # flags: STMT_END_F -master-bin.000001 12949 Table_map 1 12990 table_id: # (test.t1) -master-bin.000001 12990 Write_rows 1 13024 table_id: # flags: STMT_END_F -master-bin.000001 13024 Table_map 1 13065 table_id: # (test.t1) -master-bin.000001 13065 Write_rows 1 13099 table_id: # flags: STMT_END_F -master-bin.000001 13099 Table_map 1 13140 table_id: # (test.t1) -master-bin.000001 13140 Write_rows 1 13174 table_id: # flags: STMT_END_F -master-bin.000001 13174 Table_map 1 13215 table_id: # (test.t1) -master-bin.000001 13215 Write_rows 1 13249 table_id: # flags: STMT_END_F -master-bin.000001 13249 Table_map 1 13290 table_id: # (test.t1) -master-bin.000001 13290 Write_rows 1 13324 table_id: # flags: STMT_END_F -master-bin.000001 13324 Table_map 1 13365 table_id: # (test.t1) -master-bin.000001 13365 Write_rows 1 13399 table_id: # flags: STMT_END_F -master-bin.000001 13399 Table_map 1 13440 table_id: # (test.t1) -master-bin.000001 13440 Write_rows 1 13474 table_id: # flags: STMT_END_F -master-bin.000001 13474 Table_map 1 13515 table_id: # (test.t1) -master-bin.000001 13515 Write_rows 1 13549 table_id: # flags: STMT_END_F -master-bin.000001 13549 Table_map 1 13590 table_id: # (test.t1) -master-bin.000001 13590 Write_rows 1 13624 table_id: # flags: STMT_END_F -master-bin.000001 13624 Table_map 1 13665 table_id: # (test.t1) -master-bin.000001 13665 Write_rows 1 13699 table_id: # flags: STMT_END_F -master-bin.000001 13699 Table_map 1 13740 table_id: # (test.t1) -master-bin.000001 13740 Write_rows 1 13774 table_id: # flags: STMT_END_F -master-bin.000001 13774 Table_map 1 13815 table_id: # (test.t1) -master-bin.000001 13815 Write_rows 1 13849 table_id: # flags: STMT_END_F -master-bin.000001 13849 Table_map 1 13890 table_id: # (test.t1) -master-bin.000001 13890 Write_rows 1 13924 table_id: # flags: STMT_END_F -master-bin.000001 13924 Table_map 1 13965 table_id: # (test.t1) -master-bin.000001 13965 Write_rows 1 13999 table_id: # flags: STMT_END_F -master-bin.000001 13999 Table_map 1 14040 table_id: # (test.t1) -master-bin.000001 14040 Write_rows 1 14074 table_id: # flags: STMT_END_F -master-bin.000001 14074 Table_map 1 14115 table_id: # (test.t1) -master-bin.000001 14115 Write_rows 1 14149 table_id: # flags: STMT_END_F -master-bin.000001 14149 Table_map 1 14190 table_id: # (test.t1) -master-bin.000001 14190 Write_rows 1 14224 table_id: # flags: STMT_END_F -master-bin.000001 14224 Table_map 1 14265 table_id: # (test.t1) -master-bin.000001 14265 Write_rows 1 14299 table_id: # flags: STMT_END_F -master-bin.000001 14299 Table_map 1 14340 table_id: # (test.t1) -master-bin.000001 14340 Write_rows 1 14374 table_id: # flags: STMT_END_F -master-bin.000001 14374 Table_map 1 14415 table_id: # (test.t1) -master-bin.000001 14415 Write_rows 1 14449 table_id: # flags: STMT_END_F -master-bin.000001 14449 Table_map 1 14490 table_id: # (test.t1) -master-bin.000001 14490 Write_rows 1 14524 table_id: # flags: STMT_END_F -master-bin.000001 14524 Table_map 1 14565 table_id: # (test.t1) -master-bin.000001 14565 Write_rows 1 14599 table_id: # flags: STMT_END_F -master-bin.000001 14599 Table_map 1 14640 table_id: # (test.t1) -master-bin.000001 14640 Write_rows 1 14674 table_id: # flags: STMT_END_F -master-bin.000001 14674 Table_map 1 14715 table_id: # (test.t1) -master-bin.000001 14715 Write_rows 1 14749 table_id: # flags: STMT_END_F -master-bin.000001 14749 Table_map 1 14790 table_id: # (test.t1) -master-bin.000001 14790 Write_rows 1 14824 table_id: # flags: STMT_END_F -master-bin.000001 14824 Table_map 1 14865 table_id: # (test.t1) -master-bin.000001 14865 Write_rows 1 14899 table_id: # flags: STMT_END_F -master-bin.000001 14899 Table_map 1 14940 table_id: # (test.t1) -master-bin.000001 14940 Write_rows 1 14974 table_id: # flags: STMT_END_F -master-bin.000001 14974 Table_map 1 15015 table_id: # (test.t1) -master-bin.000001 15015 Write_rows 1 15049 table_id: # flags: STMT_END_F -master-bin.000001 15049 Table_map 1 15090 table_id: # (test.t1) -master-bin.000001 15090 Write_rows 1 15124 table_id: # flags: STMT_END_F -master-bin.000001 15124 Table_map 1 15165 table_id: # (test.t1) -master-bin.000001 15165 Write_rows 1 15199 table_id: # flags: STMT_END_F -master-bin.000001 15199 Table_map 1 15240 table_id: # (test.t1) -master-bin.000001 15240 Write_rows 1 15274 table_id: # flags: STMT_END_F -master-bin.000001 15274 Table_map 1 15315 table_id: # (test.t1) -master-bin.000001 15315 Write_rows 1 15349 table_id: # flags: STMT_END_F -master-bin.000001 15349 Table_map 1 15390 table_id: # (test.t1) -master-bin.000001 15390 Write_rows 1 15424 table_id: # flags: STMT_END_F -master-bin.000001 15424 Table_map 1 15465 table_id: # (test.t1) -master-bin.000001 15465 Write_rows 1 15499 table_id: # flags: STMT_END_F -master-bin.000001 15499 Table_map 1 15540 table_id: # (test.t1) -master-bin.000001 15540 Write_rows 1 15574 table_id: # flags: STMT_END_F -master-bin.000001 15574 Table_map 1 15615 table_id: # (test.t1) -master-bin.000001 15615 Write_rows 1 15649 table_id: # flags: STMT_END_F -master-bin.000001 15649 Table_map 1 15690 table_id: # (test.t1) -master-bin.000001 15690 Write_rows 1 15724 table_id: # flags: STMT_END_F -master-bin.000001 15724 Table_map 1 15765 table_id: # (test.t1) -master-bin.000001 15765 Write_rows 1 15799 table_id: # flags: STMT_END_F -master-bin.000001 15799 Table_map 1 15840 table_id: # (test.t1) -master-bin.000001 15840 Write_rows 1 15874 table_id: # flags: STMT_END_F -master-bin.000001 15874 Table_map 1 15915 table_id: # (test.t1) -master-bin.000001 15915 Write_rows 1 15949 table_id: # flags: STMT_END_F -master-bin.000001 15949 Table_map 1 15990 table_id: # (test.t1) -master-bin.000001 15990 Write_rows 1 16024 table_id: # flags: STMT_END_F -master-bin.000001 16024 Table_map 1 16065 table_id: # (test.t1) -master-bin.000001 16065 Write_rows 1 16099 table_id: # flags: STMT_END_F -master-bin.000001 16099 Table_map 1 16140 table_id: # (test.t1) -master-bin.000001 16140 Write_rows 1 16174 table_id: # flags: STMT_END_F -master-bin.000001 16174 Table_map 1 16215 table_id: # (test.t1) -master-bin.000001 16215 Write_rows 1 16249 table_id: # flags: STMT_END_F -master-bin.000001 16249 Table_map 1 16290 table_id: # (test.t1) -master-bin.000001 16290 Write_rows 1 16324 table_id: # flags: STMT_END_F -master-bin.000001 16324 Table_map 1 16365 table_id: # (test.t1) -master-bin.000001 16365 Write_rows 1 16399 table_id: # flags: STMT_END_F -master-bin.000001 16399 Table_map 1 16440 table_id: # (test.t1) -master-bin.000001 16440 Write_rows 1 16474 table_id: # flags: STMT_END_F -master-bin.000001 16474 Table_map 1 16515 table_id: # (test.t1) -master-bin.000001 16515 Write_rows 1 16549 table_id: # flags: STMT_END_F -master-bin.000001 16549 Table_map 1 16590 table_id: # (test.t1) -master-bin.000001 16590 Write_rows 1 16624 table_id: # flags: STMT_END_F -master-bin.000001 16624 Table_map 1 16665 table_id: # (test.t1) -master-bin.000001 16665 Write_rows 1 16699 table_id: # flags: STMT_END_F -master-bin.000001 16699 Table_map 1 16740 table_id: # (test.t1) -master-bin.000001 16740 Write_rows 1 16774 table_id: # flags: STMT_END_F -master-bin.000001 16774 Table_map 1 16815 table_id: # (test.t1) -master-bin.000001 16815 Write_rows 1 16849 table_id: # flags: STMT_END_F -master-bin.000001 16849 Table_map 1 16890 table_id: # (test.t1) -master-bin.000001 16890 Write_rows 1 16924 table_id: # flags: STMT_END_F -master-bin.000001 16924 Table_map 1 16965 table_id: # (test.t1) -master-bin.000001 16965 Write_rows 1 16999 table_id: # flags: STMT_END_F -master-bin.000001 16999 Table_map 1 17040 table_id: # (test.t1) -master-bin.000001 17040 Write_rows 1 17074 table_id: # flags: STMT_END_F -master-bin.000001 17074 Table_map 1 17115 table_id: # (test.t1) -master-bin.000001 17115 Write_rows 1 17149 table_id: # flags: STMT_END_F -master-bin.000001 17149 Table_map 1 17190 table_id: # (test.t1) -master-bin.000001 17190 Write_rows 1 17224 table_id: # flags: STMT_END_F -master-bin.000001 17224 Table_map 1 17265 table_id: # (test.t1) -master-bin.000001 17265 Write_rows 1 17299 table_id: # flags: STMT_END_F -master-bin.000001 17299 Table_map 1 17340 table_id: # (test.t1) -master-bin.000001 17340 Write_rows 1 17374 table_id: # flags: STMT_END_F -master-bin.000001 17374 Table_map 1 17415 table_id: # (test.t1) -master-bin.000001 17415 Write_rows 1 17449 table_id: # flags: STMT_END_F -master-bin.000001 17449 Table_map 1 17490 table_id: # (test.t1) -master-bin.000001 17490 Write_rows 1 17524 table_id: # flags: STMT_END_F -master-bin.000001 17524 Table_map 1 17565 table_id: # (test.t1) -master-bin.000001 17565 Write_rows 1 17599 table_id: # flags: STMT_END_F -master-bin.000001 17599 Table_map 1 17640 table_id: # (test.t1) -master-bin.000001 17640 Write_rows 1 17674 table_id: # flags: STMT_END_F -master-bin.000001 17674 Table_map 1 17715 table_id: # (test.t1) -master-bin.000001 17715 Write_rows 1 17749 table_id: # flags: STMT_END_F -master-bin.000001 17749 Table_map 1 17790 table_id: # (test.t1) -master-bin.000001 17790 Write_rows 1 17824 table_id: # flags: STMT_END_F -master-bin.000001 17824 Table_map 1 17865 table_id: # (test.t1) -master-bin.000001 17865 Write_rows 1 17899 table_id: # flags: STMT_END_F -master-bin.000001 17899 Table_map 1 17940 table_id: # (test.t1) -master-bin.000001 17940 Write_rows 1 17974 table_id: # flags: STMT_END_F -master-bin.000001 17974 Table_map 1 18015 table_id: # (test.t1) -master-bin.000001 18015 Write_rows 1 18049 table_id: # flags: STMT_END_F -master-bin.000001 18049 Table_map 1 18090 table_id: # (test.t1) -master-bin.000001 18090 Write_rows 1 18124 table_id: # flags: STMT_END_F -master-bin.000001 18124 Table_map 1 18165 table_id: # (test.t1) -master-bin.000001 18165 Write_rows 1 18199 table_id: # flags: STMT_END_F -master-bin.000001 18199 Table_map 1 18240 table_id: # (test.t1) -master-bin.000001 18240 Write_rows 1 18274 table_id: # flags: STMT_END_F -master-bin.000001 18274 Table_map 1 18315 table_id: # (test.t1) -master-bin.000001 18315 Write_rows 1 18349 table_id: # flags: STMT_END_F -master-bin.000001 18349 Table_map 1 18390 table_id: # (test.t1) -master-bin.000001 18390 Write_rows 1 18424 table_id: # flags: STMT_END_F -master-bin.000001 18424 Table_map 1 18465 table_id: # (test.t1) -master-bin.000001 18465 Write_rows 1 18499 table_id: # flags: STMT_END_F -master-bin.000001 18499 Table_map 1 18540 table_id: # (test.t1) -master-bin.000001 18540 Write_rows 1 18574 table_id: # flags: STMT_END_F -master-bin.000001 18574 Table_map 1 18615 table_id: # (test.t1) -master-bin.000001 18615 Write_rows 1 18649 table_id: # flags: STMT_END_F -master-bin.000001 18649 Table_map 1 18690 table_id: # (test.t1) -master-bin.000001 18690 Write_rows 1 18724 table_id: # flags: STMT_END_F -master-bin.000001 18724 Table_map 1 18765 table_id: # (test.t1) -master-bin.000001 18765 Write_rows 1 18799 table_id: # flags: STMT_END_F -master-bin.000001 18799 Table_map 1 18840 table_id: # (test.t1) -master-bin.000001 18840 Write_rows 1 18874 table_id: # flags: STMT_END_F -master-bin.000001 18874 Table_map 1 18915 table_id: # (test.t1) -master-bin.000001 18915 Write_rows 1 18949 table_id: # flags: STMT_END_F -master-bin.000001 18949 Table_map 1 18990 table_id: # (test.t1) -master-bin.000001 18990 Write_rows 1 19024 table_id: # flags: STMT_END_F -master-bin.000001 19024 Table_map 1 19065 table_id: # (test.t1) -master-bin.000001 19065 Write_rows 1 19099 table_id: # flags: STMT_END_F -master-bin.000001 19099 Table_map 1 19140 table_id: # (test.t1) -master-bin.000001 19140 Write_rows 1 19174 table_id: # flags: STMT_END_F -master-bin.000001 19174 Table_map 1 19215 table_id: # (test.t1) -master-bin.000001 19215 Write_rows 1 19249 table_id: # flags: STMT_END_F -master-bin.000001 19249 Table_map 1 19290 table_id: # (test.t1) -master-bin.000001 19290 Write_rows 1 19324 table_id: # flags: STMT_END_F -master-bin.000001 19324 Table_map 1 19365 table_id: # (test.t1) -master-bin.000001 19365 Write_rows 1 19399 table_id: # flags: STMT_END_F -master-bin.000001 19399 Table_map 1 19440 table_id: # (test.t1) -master-bin.000001 19440 Write_rows 1 19474 table_id: # flags: STMT_END_F -master-bin.000001 19474 Table_map 1 19515 table_id: # (test.t1) -master-bin.000001 19515 Write_rows 1 19549 table_id: # flags: STMT_END_F -master-bin.000001 19549 Table_map 1 19590 table_id: # (test.t1) -master-bin.000001 19590 Write_rows 1 19624 table_id: # flags: STMT_END_F -master-bin.000001 19624 Table_map 1 19665 table_id: # (test.t1) -master-bin.000001 19665 Write_rows 1 19699 table_id: # flags: STMT_END_F -master-bin.000001 19699 Table_map 1 19740 table_id: # (test.t1) -master-bin.000001 19740 Write_rows 1 19774 table_id: # flags: STMT_END_F -master-bin.000001 19774 Table_map 1 19815 table_id: # (test.t1) -master-bin.000001 19815 Write_rows 1 19849 table_id: # flags: STMT_END_F -master-bin.000001 19849 Table_map 1 19890 table_id: # (test.t1) -master-bin.000001 19890 Write_rows 1 19924 table_id: # flags: STMT_END_F -master-bin.000001 19924 Table_map 1 19965 table_id: # (test.t1) -master-bin.000001 19965 Write_rows 1 19999 table_id: # flags: STMT_END_F -master-bin.000001 19999 Table_map 1 20040 table_id: # (test.t1) -master-bin.000001 20040 Write_rows 1 20074 table_id: # flags: STMT_END_F -master-bin.000001 20074 Table_map 1 20115 table_id: # (test.t1) -master-bin.000001 20115 Write_rows 1 20149 table_id: # flags: STMT_END_F -master-bin.000001 20149 Table_map 1 20190 table_id: # (test.t1) -master-bin.000001 20190 Write_rows 1 20224 table_id: # flags: STMT_END_F -master-bin.000001 20224 Table_map 1 20265 table_id: # (test.t1) -master-bin.000001 20265 Write_rows 1 20299 table_id: # flags: STMT_END_F -master-bin.000001 20299 Table_map 1 20340 table_id: # (test.t1) -master-bin.000001 20340 Write_rows 1 20374 table_id: # flags: STMT_END_F -master-bin.000001 20374 Table_map 1 20415 table_id: # (test.t1) -master-bin.000001 20415 Write_rows 1 20449 table_id: # flags: STMT_END_F -master-bin.000001 20449 Table_map 1 20490 table_id: # (test.t1) -master-bin.000001 20490 Write_rows 1 20524 table_id: # flags: STMT_END_F -master-bin.000001 20524 Table_map 1 20565 table_id: # (test.t1) -master-bin.000001 20565 Write_rows 1 20599 table_id: # flags: STMT_END_F -master-bin.000001 20599 Table_map 1 20640 table_id: # (test.t1) -master-bin.000001 20640 Write_rows 1 20674 table_id: # flags: STMT_END_F -master-bin.000001 20674 Table_map 1 20715 table_id: # (test.t1) -master-bin.000001 20715 Write_rows 1 20749 table_id: # flags: STMT_END_F -master-bin.000001 20749 Table_map 1 20790 table_id: # (test.t1) -master-bin.000001 20790 Write_rows 1 20824 table_id: # flags: STMT_END_F -master-bin.000001 20824 Table_map 1 20865 table_id: # (test.t1) -master-bin.000001 20865 Write_rows 1 20899 table_id: # flags: STMT_END_F -master-bin.000001 20899 Table_map 1 20940 table_id: # (test.t1) -master-bin.000001 20940 Write_rows 1 20974 table_id: # flags: STMT_END_F -master-bin.000001 20974 Table_map 1 21015 table_id: # (test.t1) -master-bin.000001 21015 Write_rows 1 21049 table_id: # flags: STMT_END_F -master-bin.000001 21049 Table_map 1 21090 table_id: # (test.t1) -master-bin.000001 21090 Write_rows 1 21124 table_id: # flags: STMT_END_F -master-bin.000001 21124 Table_map 1 21165 table_id: # (test.t1) -master-bin.000001 21165 Write_rows 1 21199 table_id: # flags: STMT_END_F -master-bin.000001 21199 Table_map 1 21240 table_id: # (test.t1) -master-bin.000001 21240 Write_rows 1 21274 table_id: # flags: STMT_END_F -master-bin.000001 21274 Table_map 1 21315 table_id: # (test.t1) -master-bin.000001 21315 Write_rows 1 21349 table_id: # flags: STMT_END_F -master-bin.000001 21349 Table_map 1 21390 table_id: # (test.t1) -master-bin.000001 21390 Write_rows 1 21424 table_id: # flags: STMT_END_F -master-bin.000001 21424 Table_map 1 21465 table_id: # (test.t1) -master-bin.000001 21465 Write_rows 1 21499 table_id: # flags: STMT_END_F -master-bin.000001 21499 Table_map 1 21540 table_id: # (test.t1) -master-bin.000001 21540 Write_rows 1 21574 table_id: # flags: STMT_END_F -master-bin.000001 21574 Table_map 1 21615 table_id: # (test.t1) -master-bin.000001 21615 Write_rows 1 21649 table_id: # flags: STMT_END_F -master-bin.000001 21649 Table_map 1 21690 table_id: # (test.t1) -master-bin.000001 21690 Write_rows 1 21724 table_id: # flags: STMT_END_F -master-bin.000001 21724 Table_map 1 21765 table_id: # (test.t1) -master-bin.000001 21765 Write_rows 1 21799 table_id: # flags: STMT_END_F -master-bin.000001 21799 Table_map 1 21840 table_id: # (test.t1) -master-bin.000001 21840 Write_rows 1 21874 table_id: # flags: STMT_END_F -master-bin.000001 21874 Table_map 1 21915 table_id: # (test.t1) -master-bin.000001 21915 Write_rows 1 21949 table_id: # flags: STMT_END_F -master-bin.000001 21949 Table_map 1 21990 table_id: # (test.t1) -master-bin.000001 21990 Write_rows 1 22024 table_id: # flags: STMT_END_F -master-bin.000001 22024 Table_map 1 22065 table_id: # (test.t1) -master-bin.000001 22065 Write_rows 1 22099 table_id: # flags: STMT_END_F -master-bin.000001 22099 Table_map 1 22140 table_id: # (test.t1) -master-bin.000001 22140 Write_rows 1 22174 table_id: # flags: STMT_END_F -master-bin.000001 22174 Table_map 1 22215 table_id: # (test.t1) -master-bin.000001 22215 Write_rows 1 22249 table_id: # flags: STMT_END_F -master-bin.000001 22249 Table_map 1 22290 table_id: # (test.t1) -master-bin.000001 22290 Write_rows 1 22324 table_id: # flags: STMT_END_F -master-bin.000001 22324 Table_map 1 22365 table_id: # (test.t1) -master-bin.000001 22365 Write_rows 1 22399 table_id: # flags: STMT_END_F -master-bin.000001 22399 Table_map 1 22440 table_id: # (test.t1) -master-bin.000001 22440 Write_rows 1 22474 table_id: # flags: STMT_END_F -master-bin.000001 22474 Table_map 1 22515 table_id: # (test.t1) -master-bin.000001 22515 Write_rows 1 22549 table_id: # flags: STMT_END_F -master-bin.000001 22549 Table_map 1 22590 table_id: # (test.t1) -master-bin.000001 22590 Write_rows 1 22624 table_id: # flags: STMT_END_F -master-bin.000001 22624 Table_map 1 22665 table_id: # (test.t1) -master-bin.000001 22665 Write_rows 1 22699 table_id: # flags: STMT_END_F -master-bin.000001 22699 Table_map 1 22740 table_id: # (test.t1) -master-bin.000001 22740 Write_rows 1 22774 table_id: # flags: STMT_END_F -master-bin.000001 22774 Table_map 1 22815 table_id: # (test.t1) -master-bin.000001 22815 Write_rows 1 22849 table_id: # flags: STMT_END_F -master-bin.000001 22849 Table_map 1 22890 table_id: # (test.t1) -master-bin.000001 22890 Write_rows 1 22924 table_id: # flags: STMT_END_F -master-bin.000001 22924 Table_map 1 22965 table_id: # (test.t1) -master-bin.000001 22965 Write_rows 1 22999 table_id: # flags: STMT_END_F -master-bin.000001 22999 Table_map 1 23040 table_id: # (test.t1) -master-bin.000001 23040 Write_rows 1 23074 table_id: # flags: STMT_END_F -master-bin.000001 23074 Table_map 1 23115 table_id: # (test.t1) -master-bin.000001 23115 Write_rows 1 23149 table_id: # flags: STMT_END_F -master-bin.000001 23149 Table_map 1 23190 table_id: # (test.t1) -master-bin.000001 23190 Write_rows 1 23224 table_id: # flags: STMT_END_F -master-bin.000001 23224 Table_map 1 23265 table_id: # (test.t1) -master-bin.000001 23265 Write_rows 1 23299 table_id: # flags: STMT_END_F -master-bin.000001 23299 Table_map 1 23340 table_id: # (test.t1) -master-bin.000001 23340 Write_rows 1 23374 table_id: # flags: STMT_END_F -master-bin.000001 23374 Table_map 1 23415 table_id: # (test.t1) -master-bin.000001 23415 Write_rows 1 23449 table_id: # flags: STMT_END_F -master-bin.000001 23449 Table_map 1 23490 table_id: # (test.t1) -master-bin.000001 23490 Write_rows 1 23524 table_id: # flags: STMT_END_F -master-bin.000001 23524 Table_map 1 23565 table_id: # (test.t1) -master-bin.000001 23565 Write_rows 1 23599 table_id: # flags: STMT_END_F -master-bin.000001 23599 Table_map 1 23640 table_id: # (test.t1) -master-bin.000001 23640 Write_rows 1 23674 table_id: # flags: STMT_END_F -master-bin.000001 23674 Table_map 1 23715 table_id: # (test.t1) -master-bin.000001 23715 Write_rows 1 23749 table_id: # flags: STMT_END_F -master-bin.000001 23749 Table_map 1 23790 table_id: # (test.t1) -master-bin.000001 23790 Write_rows 1 23824 table_id: # flags: STMT_END_F -master-bin.000001 23824 Table_map 1 23865 table_id: # (test.t1) -master-bin.000001 23865 Write_rows 1 23899 table_id: # flags: STMT_END_F -master-bin.000001 23899 Table_map 1 23940 table_id: # (test.t1) -master-bin.000001 23940 Write_rows 1 23974 table_id: # flags: STMT_END_F -master-bin.000001 23974 Table_map 1 24015 table_id: # (test.t1) -master-bin.000001 24015 Write_rows 1 24049 table_id: # flags: STMT_END_F -master-bin.000001 24049 Table_map 1 24090 table_id: # (test.t1) -master-bin.000001 24090 Write_rows 1 24124 table_id: # flags: STMT_END_F -master-bin.000001 24124 Table_map 1 24165 table_id: # (test.t1) -master-bin.000001 24165 Write_rows 1 24199 table_id: # flags: STMT_END_F -master-bin.000001 24199 Table_map 1 24240 table_id: # (test.t1) -master-bin.000001 24240 Write_rows 1 24274 table_id: # flags: STMT_END_F -master-bin.000001 24274 Table_map 1 24315 table_id: # (test.t1) -master-bin.000001 24315 Write_rows 1 24349 table_id: # flags: STMT_END_F -master-bin.000001 24349 Table_map 1 24390 table_id: # (test.t1) -master-bin.000001 24390 Write_rows 1 24424 table_id: # flags: STMT_END_F -master-bin.000001 24424 Table_map 1 24465 table_id: # (test.t1) -master-bin.000001 24465 Write_rows 1 24499 table_id: # flags: STMT_END_F -master-bin.000001 24499 Table_map 1 24540 table_id: # (test.t1) -master-bin.000001 24540 Write_rows 1 24574 table_id: # flags: STMT_END_F -master-bin.000001 24574 Table_map 1 24615 table_id: # (test.t1) -master-bin.000001 24615 Write_rows 1 24649 table_id: # flags: STMT_END_F -master-bin.000001 24649 Table_map 1 24690 table_id: # (test.t1) -master-bin.000001 24690 Write_rows 1 24724 table_id: # flags: STMT_END_F -master-bin.000001 24724 Table_map 1 24765 table_id: # (test.t1) -master-bin.000001 24765 Write_rows 1 24799 table_id: # flags: STMT_END_F -master-bin.000001 24799 Table_map 1 24840 table_id: # (test.t1) -master-bin.000001 24840 Write_rows 1 24874 table_id: # flags: STMT_END_F -master-bin.000001 24874 Table_map 1 24915 table_id: # (test.t1) -master-bin.000001 24915 Write_rows 1 24949 table_id: # flags: STMT_END_F -master-bin.000001 24949 Table_map 1 24990 table_id: # (test.t1) -master-bin.000001 24990 Write_rows 1 25024 table_id: # flags: STMT_END_F -master-bin.000001 25024 Table_map 1 25065 table_id: # (test.t1) -master-bin.000001 25065 Write_rows 1 25099 table_id: # flags: STMT_END_F -master-bin.000001 25099 Table_map 1 25140 table_id: # (test.t1) -master-bin.000001 25140 Write_rows 1 25174 table_id: # flags: STMT_END_F -master-bin.000001 25174 Table_map 1 25215 table_id: # (test.t1) -master-bin.000001 25215 Write_rows 1 25249 table_id: # flags: STMT_END_F -master-bin.000001 25249 Table_map 1 25290 table_id: # (test.t1) -master-bin.000001 25290 Write_rows 1 25324 table_id: # flags: STMT_END_F -master-bin.000001 25324 Table_map 1 25365 table_id: # (test.t1) -master-bin.000001 25365 Write_rows 1 25399 table_id: # flags: STMT_END_F -master-bin.000001 25399 Table_map 1 25440 table_id: # (test.t1) -master-bin.000001 25440 Write_rows 1 25474 table_id: # flags: STMT_END_F -master-bin.000001 25474 Table_map 1 25515 table_id: # (test.t1) -master-bin.000001 25515 Write_rows 1 25549 table_id: # flags: STMT_END_F -master-bin.000001 25549 Table_map 1 25590 table_id: # (test.t1) -master-bin.000001 25590 Write_rows 1 25624 table_id: # flags: STMT_END_F -master-bin.000001 25624 Table_map 1 25665 table_id: # (test.t1) -master-bin.000001 25665 Write_rows 1 25699 table_id: # flags: STMT_END_F -master-bin.000001 25699 Table_map 1 25740 table_id: # (test.t1) -master-bin.000001 25740 Write_rows 1 25774 table_id: # flags: STMT_END_F -master-bin.000001 25774 Table_map 1 25815 table_id: # (test.t1) -master-bin.000001 25815 Write_rows 1 25849 table_id: # flags: STMT_END_F -master-bin.000001 25849 Table_map 1 25890 table_id: # (test.t1) -master-bin.000001 25890 Write_rows 1 25924 table_id: # flags: STMT_END_F -master-bin.000001 25924 Table_map 1 25965 table_id: # (test.t1) -master-bin.000001 25965 Write_rows 1 25999 table_id: # flags: STMT_END_F -master-bin.000001 25999 Table_map 1 26040 table_id: # (test.t1) -master-bin.000001 26040 Write_rows 1 26074 table_id: # flags: STMT_END_F -master-bin.000001 26074 Table_map 1 26115 table_id: # (test.t1) -master-bin.000001 26115 Write_rows 1 26149 table_id: # flags: STMT_END_F -master-bin.000001 26149 Table_map 1 26190 table_id: # (test.t1) -master-bin.000001 26190 Write_rows 1 26224 table_id: # flags: STMT_END_F -master-bin.000001 26224 Table_map 1 26265 table_id: # (test.t1) -master-bin.000001 26265 Write_rows 1 26299 table_id: # flags: STMT_END_F -master-bin.000001 26299 Table_map 1 26340 table_id: # (test.t1) -master-bin.000001 26340 Write_rows 1 26374 table_id: # flags: STMT_END_F -master-bin.000001 26374 Table_map 1 26415 table_id: # (test.t1) -master-bin.000001 26415 Write_rows 1 26449 table_id: # flags: STMT_END_F -master-bin.000001 26449 Table_map 1 26490 table_id: # (test.t1) -master-bin.000001 26490 Write_rows 1 26524 table_id: # flags: STMT_END_F -master-bin.000001 26524 Table_map 1 26565 table_id: # (test.t1) -master-bin.000001 26565 Write_rows 1 26599 table_id: # flags: STMT_END_F -master-bin.000001 26599 Table_map 1 26640 table_id: # (test.t1) -master-bin.000001 26640 Write_rows 1 26674 table_id: # flags: STMT_END_F -master-bin.000001 26674 Table_map 1 26715 table_id: # (test.t1) -master-bin.000001 26715 Write_rows 1 26749 table_id: # flags: STMT_END_F -master-bin.000001 26749 Table_map 1 26790 table_id: # (test.t1) -master-bin.000001 26790 Write_rows 1 26824 table_id: # flags: STMT_END_F -master-bin.000001 26824 Table_map 1 26865 table_id: # (test.t1) -master-bin.000001 26865 Write_rows 1 26899 table_id: # flags: STMT_END_F -master-bin.000001 26899 Table_map 1 26940 table_id: # (test.t1) -master-bin.000001 26940 Write_rows 1 26974 table_id: # flags: STMT_END_F -master-bin.000001 26974 Table_map 1 27015 table_id: # (test.t1) -master-bin.000001 27015 Write_rows 1 27049 table_id: # flags: STMT_END_F -master-bin.000001 27049 Table_map 1 27090 table_id: # (test.t1) -master-bin.000001 27090 Write_rows 1 27124 table_id: # flags: STMT_END_F -master-bin.000001 27124 Table_map 1 27165 table_id: # (test.t1) -master-bin.000001 27165 Write_rows 1 27199 table_id: # flags: STMT_END_F -master-bin.000001 27199 Table_map 1 27240 table_id: # (test.t1) -master-bin.000001 27240 Write_rows 1 27274 table_id: # flags: STMT_END_F -master-bin.000001 27274 Table_map 1 27315 table_id: # (test.t1) -master-bin.000001 27315 Write_rows 1 27349 table_id: # flags: STMT_END_F -master-bin.000001 27349 Table_map 1 27390 table_id: # (test.t1) -master-bin.000001 27390 Write_rows 1 27424 table_id: # flags: STMT_END_F -master-bin.000001 27424 Table_map 1 27465 table_id: # (test.t1) -master-bin.000001 27465 Write_rows 1 27499 table_id: # flags: STMT_END_F -master-bin.000001 27499 Table_map 1 27540 table_id: # (test.t1) -master-bin.000001 27540 Write_rows 1 27574 table_id: # flags: STMT_END_F -master-bin.000001 27574 Table_map 1 27615 table_id: # (test.t1) -master-bin.000001 27615 Write_rows 1 27649 table_id: # flags: STMT_END_F -master-bin.000001 27649 Table_map 1 27690 table_id: # (test.t1) -master-bin.000001 27690 Write_rows 1 27724 table_id: # flags: STMT_END_F -master-bin.000001 27724 Table_map 1 27765 table_id: # (test.t1) -master-bin.000001 27765 Write_rows 1 27799 table_id: # flags: STMT_END_F -master-bin.000001 27799 Table_map 1 27840 table_id: # (test.t1) -master-bin.000001 27840 Write_rows 1 27874 table_id: # flags: STMT_END_F -master-bin.000001 27874 Table_map 1 27915 table_id: # (test.t1) -master-bin.000001 27915 Write_rows 1 27949 table_id: # flags: STMT_END_F -master-bin.000001 27949 Table_map 1 27990 table_id: # (test.t1) -master-bin.000001 27990 Write_rows 1 28024 table_id: # flags: STMT_END_F -master-bin.000001 28024 Table_map 1 28065 table_id: # (test.t1) -master-bin.000001 28065 Write_rows 1 28099 table_id: # flags: STMT_END_F -master-bin.000001 28099 Table_map 1 28140 table_id: # (test.t1) -master-bin.000001 28140 Write_rows 1 28174 table_id: # flags: STMT_END_F -master-bin.000001 28174 Table_map 1 28215 table_id: # (test.t1) -master-bin.000001 28215 Write_rows 1 28249 table_id: # flags: STMT_END_F -master-bin.000001 28249 Table_map 1 28290 table_id: # (test.t1) -master-bin.000001 28290 Write_rows 1 28324 table_id: # flags: STMT_END_F -master-bin.000001 28324 Table_map 1 28365 table_id: # (test.t1) -master-bin.000001 28365 Write_rows 1 28399 table_id: # flags: STMT_END_F -master-bin.000001 28399 Table_map 1 28440 table_id: # (test.t1) -master-bin.000001 28440 Write_rows 1 28474 table_id: # flags: STMT_END_F -master-bin.000001 28474 Table_map 1 28515 table_id: # (test.t1) -master-bin.000001 28515 Write_rows 1 28549 table_id: # flags: STMT_END_F -master-bin.000001 28549 Table_map 1 28590 table_id: # (test.t1) -master-bin.000001 28590 Write_rows 1 28624 table_id: # flags: STMT_END_F -master-bin.000001 28624 Table_map 1 28665 table_id: # (test.t1) -master-bin.000001 28665 Write_rows 1 28699 table_id: # flags: STMT_END_F -master-bin.000001 28699 Table_map 1 28740 table_id: # (test.t1) -master-bin.000001 28740 Write_rows 1 28774 table_id: # flags: STMT_END_F -master-bin.000001 28774 Table_map 1 28815 table_id: # (test.t1) -master-bin.000001 28815 Write_rows 1 28849 table_id: # flags: STMT_END_F -master-bin.000001 28849 Table_map 1 28890 table_id: # (test.t1) -master-bin.000001 28890 Write_rows 1 28924 table_id: # flags: STMT_END_F -master-bin.000001 28924 Table_map 1 28965 table_id: # (test.t1) -master-bin.000001 28965 Write_rows 1 28999 table_id: # flags: STMT_END_F -master-bin.000001 28999 Table_map 1 29040 table_id: # (test.t1) -master-bin.000001 29040 Write_rows 1 29074 table_id: # flags: STMT_END_F -master-bin.000001 29074 Table_map 1 29115 table_id: # (test.t1) -master-bin.000001 29115 Write_rows 1 29149 table_id: # flags: STMT_END_F -master-bin.000001 29149 Table_map 1 29190 table_id: # (test.t1) -master-bin.000001 29190 Write_rows 1 29224 table_id: # flags: STMT_END_F -master-bin.000001 29224 Table_map 1 29265 table_id: # (test.t1) -master-bin.000001 29265 Write_rows 1 29299 table_id: # flags: STMT_END_F -master-bin.000001 29299 Table_map 1 29340 table_id: # (test.t1) -master-bin.000001 29340 Write_rows 1 29374 table_id: # flags: STMT_END_F -master-bin.000001 29374 Table_map 1 29415 table_id: # (test.t1) -master-bin.000001 29415 Write_rows 1 29449 table_id: # flags: STMT_END_F -master-bin.000001 29449 Table_map 1 29490 table_id: # (test.t1) -master-bin.000001 29490 Write_rows 1 29524 table_id: # flags: STMT_END_F -master-bin.000001 29524 Table_map 1 29565 table_id: # (test.t1) -master-bin.000001 29565 Write_rows 1 29599 table_id: # flags: STMT_END_F -master-bin.000001 29599 Table_map 1 29640 table_id: # (test.t1) -master-bin.000001 29640 Write_rows 1 29674 table_id: # flags: STMT_END_F -master-bin.000001 29674 Table_map 1 29715 table_id: # (test.t1) -master-bin.000001 29715 Write_rows 1 29749 table_id: # flags: STMT_END_F -master-bin.000001 29749 Table_map 1 29790 table_id: # (test.t1) -master-bin.000001 29790 Write_rows 1 29824 table_id: # flags: STMT_END_F -master-bin.000001 29824 Table_map 1 29865 table_id: # (test.t1) -master-bin.000001 29865 Write_rows 1 29899 table_id: # flags: STMT_END_F -master-bin.000001 29899 Table_map 1 29940 table_id: # (test.t1) -master-bin.000001 29940 Write_rows 1 29974 table_id: # flags: STMT_END_F -master-bin.000001 29974 Table_map 1 30015 table_id: # (test.t1) -master-bin.000001 30015 Write_rows 1 30049 table_id: # flags: STMT_END_F -master-bin.000001 30049 Table_map 1 30090 table_id: # (test.t1) -master-bin.000001 30090 Write_rows 1 30124 table_id: # flags: STMT_END_F -master-bin.000001 30124 Table_map 1 30165 table_id: # (test.t1) -master-bin.000001 30165 Write_rows 1 30199 table_id: # flags: STMT_END_F -master-bin.000001 30199 Table_map 1 30240 table_id: # (test.t1) -master-bin.000001 30240 Write_rows 1 30274 table_id: # flags: STMT_END_F -master-bin.000001 30274 Xid 1 30301 COMMIT /* XID */ -master-bin.000001 30301 Rotate 1 30345 master-bin.000002;pos=4 +master-bin.000001 499 Xid 1 526 COMMIT /* XID */ +master-bin.000001 526 Query 1 602 use `test`; drop table t1 +set @bcs = @@binlog_cache_size; +set global binlog_cache_size=4096; +reset master; +create table t1 (a int) engine=innodb; +show binlog events from 0; +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4 +master-bin.000001 107 Query 1 207 use `test`; create table t1 (a int) engine=innodb +master-bin.000001 207 Query 1 275 use `test`; BEGIN +master-bin.000001 275 Table_map 1 316 table_id: # (test.t1) +master-bin.000001 316 Write_rows 1 350 table_id: # flags: STMT_END_F +master-bin.000001 350 Table_map 1 391 table_id: # (test.t1) +master-bin.000001 391 Write_rows 1 425 table_id: # flags: STMT_END_F +master-bin.000001 425 Table_map 1 466 table_id: # (test.t1) +master-bin.000001 466 Write_rows 1 500 table_id: # flags: STMT_END_F +master-bin.000001 500 Table_map 1 541 table_id: # (test.t1) +master-bin.000001 541 Write_rows 1 575 table_id: # flags: STMT_END_F +master-bin.000001 575 Table_map 1 616 table_id: # (test.t1) +master-bin.000001 616 Write_rows 1 650 table_id: # flags: STMT_END_F +master-bin.000001 650 Table_map 1 691 table_id: # (test.t1) +master-bin.000001 691 Write_rows 1 725 table_id: # flags: STMT_END_F +master-bin.000001 725 Table_map 1 766 table_id: # (test.t1) +master-bin.000001 766 Write_rows 1 800 table_id: # flags: STMT_END_F +master-bin.000001 800 Table_map 1 841 table_id: # (test.t1) +master-bin.000001 841 Write_rows 1 875 table_id: # flags: STMT_END_F +master-bin.000001 875 Table_map 1 916 table_id: # (test.t1) +master-bin.000001 916 Write_rows 1 950 table_id: # flags: STMT_END_F +master-bin.000001 950 Table_map 1 991 table_id: # (test.t1) +master-bin.000001 991 Write_rows 1 1025 table_id: # flags: STMT_END_F +master-bin.000001 1025 Table_map 1 1066 table_id: # (test.t1) +master-bin.000001 1066 Write_rows 1 1100 table_id: # flags: STMT_END_F +master-bin.000001 1100 Table_map 1 1141 table_id: # (test.t1) +master-bin.000001 1141 Write_rows 1 1175 table_id: # flags: STMT_END_F +master-bin.000001 1175 Table_map 1 1216 table_id: # (test.t1) +master-bin.000001 1216 Write_rows 1 1250 table_id: # flags: STMT_END_F +master-bin.000001 1250 Table_map 1 1291 table_id: # (test.t1) +master-bin.000001 1291 Write_rows 1 1325 table_id: # flags: STMT_END_F +master-bin.000001 1325 Table_map 1 1366 table_id: # (test.t1) +master-bin.000001 1366 Write_rows 1 1400 table_id: # flags: STMT_END_F +master-bin.000001 1400 Table_map 1 1441 table_id: # (test.t1) +master-bin.000001 1441 Write_rows 1 1475 table_id: # flags: STMT_END_F +master-bin.000001 1475 Table_map 1 1516 table_id: # (test.t1) +master-bin.000001 1516 Write_rows 1 1550 table_id: # flags: STMT_END_F +master-bin.000001 1550 Table_map 1 1591 table_id: # (test.t1) +master-bin.000001 1591 Write_rows 1 1625 table_id: # flags: STMT_END_F +master-bin.000001 1625 Table_map 1 1666 table_id: # (test.t1) +master-bin.000001 1666 Write_rows 1 1700 table_id: # flags: STMT_END_F +master-bin.000001 1700 Table_map 1 1741 table_id: # (test.t1) +master-bin.000001 1741 Write_rows 1 1775 table_id: # flags: STMT_END_F +master-bin.000001 1775 Table_map 1 1816 table_id: # (test.t1) +master-bin.000001 1816 Write_rows 1 1850 table_id: # flags: STMT_END_F +master-bin.000001 1850 Table_map 1 1891 table_id: # (test.t1) +master-bin.000001 1891 Write_rows 1 1925 table_id: # flags: STMT_END_F +master-bin.000001 1925 Table_map 1 1966 table_id: # (test.t1) +master-bin.000001 1966 Write_rows 1 2000 table_id: # flags: STMT_END_F +master-bin.000001 2000 Table_map 1 2041 table_id: # (test.t1) +master-bin.000001 2041 Write_rows 1 2075 table_id: # flags: STMT_END_F +master-bin.000001 2075 Table_map 1 2116 table_id: # (test.t1) +master-bin.000001 2116 Write_rows 1 2150 table_id: # flags: STMT_END_F +master-bin.000001 2150 Table_map 1 2191 table_id: # (test.t1) +master-bin.000001 2191 Write_rows 1 2225 table_id: # flags: STMT_END_F +master-bin.000001 2225 Table_map 1 2266 table_id: # (test.t1) +master-bin.000001 2266 Write_rows 1 2300 table_id: # flags: STMT_END_F +master-bin.000001 2300 Table_map 1 2341 table_id: # (test.t1) +master-bin.000001 2341 Write_rows 1 2375 table_id: # flags: STMT_END_F +master-bin.000001 2375 Table_map 1 2416 table_id: # (test.t1) +master-bin.000001 2416 Write_rows 1 2450 table_id: # flags: STMT_END_F +master-bin.000001 2450 Table_map 1 2491 table_id: # (test.t1) +master-bin.000001 2491 Write_rows 1 2525 table_id: # flags: STMT_END_F +master-bin.000001 2525 Table_map 1 2566 table_id: # (test.t1) +master-bin.000001 2566 Write_rows 1 2600 table_id: # flags: STMT_END_F +master-bin.000001 2600 Table_map 1 2641 table_id: # (test.t1) +master-bin.000001 2641 Write_rows 1 2675 table_id: # flags: STMT_END_F +master-bin.000001 2675 Table_map 1 2716 table_id: # (test.t1) +master-bin.000001 2716 Write_rows 1 2750 table_id: # flags: STMT_END_F +master-bin.000001 2750 Table_map 1 2791 table_id: # (test.t1) +master-bin.000001 2791 Write_rows 1 2825 table_id: # flags: STMT_END_F +master-bin.000001 2825 Table_map 1 2866 table_id: # (test.t1) +master-bin.000001 2866 Write_rows 1 2900 table_id: # flags: STMT_END_F +master-bin.000001 2900 Table_map 1 2941 table_id: # (test.t1) +master-bin.000001 2941 Write_rows 1 2975 table_id: # flags: STMT_END_F +master-bin.000001 2975 Table_map 1 3016 table_id: # (test.t1) +master-bin.000001 3016 Write_rows 1 3050 table_id: # flags: STMT_END_F +master-bin.000001 3050 Table_map 1 3091 table_id: # (test.t1) +master-bin.000001 3091 Write_rows 1 3125 table_id: # flags: STMT_END_F +master-bin.000001 3125 Table_map 1 3166 table_id: # (test.t1) +master-bin.000001 3166 Write_rows 1 3200 table_id: # flags: STMT_END_F +master-bin.000001 3200 Table_map 1 3241 table_id: # (test.t1) +master-bin.000001 3241 Write_rows 1 3275 table_id: # flags: STMT_END_F +master-bin.000001 3275 Table_map 1 3316 table_id: # (test.t1) +master-bin.000001 3316 Write_rows 1 3350 table_id: # flags: STMT_END_F +master-bin.000001 3350 Table_map 1 3391 table_id: # (test.t1) +master-bin.000001 3391 Write_rows 1 3425 table_id: # flags: STMT_END_F +master-bin.000001 3425 Table_map 1 3466 table_id: # (test.t1) +master-bin.000001 3466 Write_rows 1 3500 table_id: # flags: STMT_END_F +master-bin.000001 3500 Table_map 1 3541 table_id: # (test.t1) +master-bin.000001 3541 Write_rows 1 3575 table_id: # flags: STMT_END_F +master-bin.000001 3575 Table_map 1 3616 table_id: # (test.t1) +master-bin.000001 3616 Write_rows 1 3650 table_id: # flags: STMT_END_F +master-bin.000001 3650 Table_map 1 3691 table_id: # (test.t1) +master-bin.000001 3691 Write_rows 1 3725 table_id: # flags: STMT_END_F +master-bin.000001 3725 Table_map 1 3766 table_id: # (test.t1) +master-bin.000001 3766 Write_rows 1 3800 table_id: # flags: STMT_END_F +master-bin.000001 3800 Table_map 1 3841 table_id: # (test.t1) +master-bin.000001 3841 Write_rows 1 3875 table_id: # flags: STMT_END_F +master-bin.000001 3875 Table_map 1 3916 table_id: # (test.t1) +master-bin.000001 3916 Write_rows 1 3950 table_id: # flags: STMT_END_F +master-bin.000001 3950 Table_map 1 3991 table_id: # (test.t1) +master-bin.000001 3991 Write_rows 1 4025 table_id: # flags: STMT_END_F +master-bin.000001 4025 Table_map 1 4066 table_id: # (test.t1) +master-bin.000001 4066 Write_rows 1 4100 table_id: # flags: STMT_END_F +master-bin.000001 4100 Table_map 1 4141 table_id: # (test.t1) +master-bin.000001 4141 Write_rows 1 4175 table_id: # flags: STMT_END_F +master-bin.000001 4175 Table_map 1 4216 table_id: # (test.t1) +master-bin.000001 4216 Write_rows 1 4250 table_id: # flags: STMT_END_F +master-bin.000001 4250 Table_map 1 4291 table_id: # (test.t1) +master-bin.000001 4291 Write_rows 1 4325 table_id: # flags: STMT_END_F +master-bin.000001 4325 Table_map 1 4366 table_id: # (test.t1) +master-bin.000001 4366 Write_rows 1 4400 table_id: # flags: STMT_END_F +master-bin.000001 4400 Table_map 1 4441 table_id: # (test.t1) +master-bin.000001 4441 Write_rows 1 4475 table_id: # flags: STMT_END_F +master-bin.000001 4475 Table_map 1 4516 table_id: # (test.t1) +master-bin.000001 4516 Write_rows 1 4550 table_id: # flags: STMT_END_F +master-bin.000001 4550 Table_map 1 4591 table_id: # (test.t1) +master-bin.000001 4591 Write_rows 1 4625 table_id: # flags: STMT_END_F +master-bin.000001 4625 Table_map 1 4666 table_id: # (test.t1) +master-bin.000001 4666 Write_rows 1 4700 table_id: # flags: STMT_END_F +master-bin.000001 4700 Table_map 1 4741 table_id: # (test.t1) +master-bin.000001 4741 Write_rows 1 4775 table_id: # flags: STMT_END_F +master-bin.000001 4775 Table_map 1 4816 table_id: # (test.t1) +master-bin.000001 4816 Write_rows 1 4850 table_id: # flags: STMT_END_F +master-bin.000001 4850 Table_map 1 4891 table_id: # (test.t1) +master-bin.000001 4891 Write_rows 1 4925 table_id: # flags: STMT_END_F +master-bin.000001 4925 Table_map 1 4966 table_id: # (test.t1) +master-bin.000001 4966 Write_rows 1 5000 table_id: # flags: STMT_END_F +master-bin.000001 5000 Table_map 1 5041 table_id: # (test.t1) +master-bin.000001 5041 Write_rows 1 5075 table_id: # flags: STMT_END_F +master-bin.000001 5075 Table_map 1 5116 table_id: # (test.t1) +master-bin.000001 5116 Write_rows 1 5150 table_id: # flags: STMT_END_F +master-bin.000001 5150 Table_map 1 5191 table_id: # (test.t1) +master-bin.000001 5191 Write_rows 1 5225 table_id: # flags: STMT_END_F +master-bin.000001 5225 Table_map 1 5266 table_id: # (test.t1) +master-bin.000001 5266 Write_rows 1 5300 table_id: # flags: STMT_END_F +master-bin.000001 5300 Table_map 1 5341 table_id: # (test.t1) +master-bin.000001 5341 Write_rows 1 5375 table_id: # flags: STMT_END_F +master-bin.000001 5375 Table_map 1 5416 table_id: # (test.t1) +master-bin.000001 5416 Write_rows 1 5450 table_id: # flags: STMT_END_F +master-bin.000001 5450 Table_map 1 5491 table_id: # (test.t1) +master-bin.000001 5491 Write_rows 1 5525 table_id: # flags: STMT_END_F +master-bin.000001 5525 Table_map 1 5566 table_id: # (test.t1) +master-bin.000001 5566 Write_rows 1 5600 table_id: # flags: STMT_END_F +master-bin.000001 5600 Table_map 1 5641 table_id: # (test.t1) +master-bin.000001 5641 Write_rows 1 5675 table_id: # flags: STMT_END_F +master-bin.000001 5675 Table_map 1 5716 table_id: # (test.t1) +master-bin.000001 5716 Write_rows 1 5750 table_id: # flags: STMT_END_F +master-bin.000001 5750 Table_map 1 5791 table_id: # (test.t1) +master-bin.000001 5791 Write_rows 1 5825 table_id: # flags: STMT_END_F +master-bin.000001 5825 Table_map 1 5866 table_id: # (test.t1) +master-bin.000001 5866 Write_rows 1 5900 table_id: # flags: STMT_END_F +master-bin.000001 5900 Table_map 1 5941 table_id: # (test.t1) +master-bin.000001 5941 Write_rows 1 5975 table_id: # flags: STMT_END_F +master-bin.000001 5975 Table_map 1 6016 table_id: # (test.t1) +master-bin.000001 6016 Write_rows 1 6050 table_id: # flags: STMT_END_F +master-bin.000001 6050 Table_map 1 6091 table_id: # (test.t1) +master-bin.000001 6091 Write_rows 1 6125 table_id: # flags: STMT_END_F +master-bin.000001 6125 Table_map 1 6166 table_id: # (test.t1) +master-bin.000001 6166 Write_rows 1 6200 table_id: # flags: STMT_END_F +master-bin.000001 6200 Table_map 1 6241 table_id: # (test.t1) +master-bin.000001 6241 Write_rows 1 6275 table_id: # flags: STMT_END_F +master-bin.000001 6275 Table_map 1 6316 table_id: # (test.t1) +master-bin.000001 6316 Write_rows 1 6350 table_id: # flags: STMT_END_F +master-bin.000001 6350 Table_map 1 6391 table_id: # (test.t1) +master-bin.000001 6391 Write_rows 1 6425 table_id: # flags: STMT_END_F +master-bin.000001 6425 Table_map 1 6466 table_id: # (test.t1) +master-bin.000001 6466 Write_rows 1 6500 table_id: # flags: STMT_END_F +master-bin.000001 6500 Table_map 1 6541 table_id: # (test.t1) +master-bin.000001 6541 Write_rows 1 6575 table_id: # flags: STMT_END_F +master-bin.000001 6575 Table_map 1 6616 table_id: # (test.t1) +master-bin.000001 6616 Write_rows 1 6650 table_id: # flags: STMT_END_F +master-bin.000001 6650 Table_map 1 6691 table_id: # (test.t1) +master-bin.000001 6691 Write_rows 1 6725 table_id: # flags: STMT_END_F +master-bin.000001 6725 Table_map 1 6766 table_id: # (test.t1) +master-bin.000001 6766 Write_rows 1 6800 table_id: # flags: STMT_END_F +master-bin.000001 6800 Table_map 1 6841 table_id: # (test.t1) +master-bin.000001 6841 Write_rows 1 6875 table_id: # flags: STMT_END_F +master-bin.000001 6875 Table_map 1 6916 table_id: # (test.t1) +master-bin.000001 6916 Write_rows 1 6950 table_id: # flags: STMT_END_F +master-bin.000001 6950 Table_map 1 6991 table_id: # (test.t1) +master-bin.000001 6991 Write_rows 1 7025 table_id: # flags: STMT_END_F +master-bin.000001 7025 Table_map 1 7066 table_id: # (test.t1) +master-bin.000001 7066 Write_rows 1 7100 table_id: # flags: STMT_END_F +master-bin.000001 7100 Table_map 1 7141 table_id: # (test.t1) +master-bin.000001 7141 Write_rows 1 7175 table_id: # flags: STMT_END_F +master-bin.000001 7175 Table_map 1 7216 table_id: # (test.t1) +master-bin.000001 7216 Write_rows 1 7250 table_id: # flags: STMT_END_F +master-bin.000001 7250 Table_map 1 7291 table_id: # (test.t1) +master-bin.000001 7291 Write_rows 1 7325 table_id: # flags: STMT_END_F +master-bin.000001 7325 Table_map 1 7366 table_id: # (test.t1) +master-bin.000001 7366 Write_rows 1 7400 table_id: # flags: STMT_END_F +master-bin.000001 7400 Table_map 1 7441 table_id: # (test.t1) +master-bin.000001 7441 Write_rows 1 7475 table_id: # flags: STMT_END_F +master-bin.000001 7475 Table_map 1 7516 table_id: # (test.t1) +master-bin.000001 7516 Write_rows 1 7550 table_id: # flags: STMT_END_F +master-bin.000001 7550 Table_map 1 7591 table_id: # (test.t1) +master-bin.000001 7591 Write_rows 1 7625 table_id: # flags: STMT_END_F +master-bin.000001 7625 Table_map 1 7666 table_id: # (test.t1) +master-bin.000001 7666 Write_rows 1 7700 table_id: # flags: STMT_END_F +master-bin.000001 7700 Table_map 1 7741 table_id: # (test.t1) +master-bin.000001 7741 Write_rows 1 7775 table_id: # flags: STMT_END_F +master-bin.000001 7775 Table_map 1 7816 table_id: # (test.t1) +master-bin.000001 7816 Write_rows 1 7850 table_id: # flags: STMT_END_F +master-bin.000001 7850 Table_map 1 7891 table_id: # (test.t1) +master-bin.000001 7891 Write_rows 1 7925 table_id: # flags: STMT_END_F +master-bin.000001 7925 Table_map 1 7966 table_id: # (test.t1) +master-bin.000001 7966 Write_rows 1 8000 table_id: # flags: STMT_END_F +master-bin.000001 8000 Table_map 1 8041 table_id: # (test.t1) +master-bin.000001 8041 Write_rows 1 8075 table_id: # flags: STMT_END_F +master-bin.000001 8075 Table_map 1 8116 table_id: # (test.t1) +master-bin.000001 8116 Write_rows 1 8150 table_id: # flags: STMT_END_F +master-bin.000001 8150 Table_map 1 8191 table_id: # (test.t1) +master-bin.000001 8191 Write_rows 1 8225 table_id: # flags: STMT_END_F +master-bin.000001 8225 Table_map 1 8266 table_id: # (test.t1) +master-bin.000001 8266 Write_rows 1 8300 table_id: # flags: STMT_END_F +master-bin.000001 8300 Table_map 1 8341 table_id: # (test.t1) +master-bin.000001 8341 Write_rows 1 8375 table_id: # flags: STMT_END_F +master-bin.000001 8375 Table_map 1 8416 table_id: # (test.t1) +master-bin.000001 8416 Write_rows 1 8450 table_id: # flags: STMT_END_F +master-bin.000001 8450 Table_map 1 8491 table_id: # (test.t1) +master-bin.000001 8491 Write_rows 1 8525 table_id: # flags: STMT_END_F +master-bin.000001 8525 Table_map 1 8566 table_id: # (test.t1) +master-bin.000001 8566 Write_rows 1 8600 table_id: # flags: STMT_END_F +master-bin.000001 8600 Table_map 1 8641 table_id: # (test.t1) +master-bin.000001 8641 Write_rows 1 8675 table_id: # flags: STMT_END_F +master-bin.000001 8675 Table_map 1 8716 table_id: # (test.t1) +master-bin.000001 8716 Write_rows 1 8750 table_id: # flags: STMT_END_F +master-bin.000001 8750 Table_map 1 8791 table_id: # (test.t1) +master-bin.000001 8791 Write_rows 1 8825 table_id: # flags: STMT_END_F +master-bin.000001 8825 Table_map 1 8866 table_id: # (test.t1) +master-bin.000001 8866 Write_rows 1 8900 table_id: # flags: STMT_END_F +master-bin.000001 8900 Table_map 1 8941 table_id: # (test.t1) +master-bin.000001 8941 Write_rows 1 8975 table_id: # flags: STMT_END_F +master-bin.000001 8975 Table_map 1 9016 table_id: # (test.t1) +master-bin.000001 9016 Write_rows 1 9050 table_id: # flags: STMT_END_F +master-bin.000001 9050 Table_map 1 9091 table_id: # (test.t1) +master-bin.000001 9091 Write_rows 1 9125 table_id: # flags: STMT_END_F +master-bin.000001 9125 Table_map 1 9166 table_id: # (test.t1) +master-bin.000001 9166 Write_rows 1 9200 table_id: # flags: STMT_END_F +master-bin.000001 9200 Table_map 1 9241 table_id: # (test.t1) +master-bin.000001 9241 Write_rows 1 9275 table_id: # flags: STMT_END_F +master-bin.000001 9275 Table_map 1 9316 table_id: # (test.t1) +master-bin.000001 9316 Write_rows 1 9350 table_id: # flags: STMT_END_F +master-bin.000001 9350 Table_map 1 9391 table_id: # (test.t1) +master-bin.000001 9391 Write_rows 1 9425 table_id: # flags: STMT_END_F +master-bin.000001 9425 Table_map 1 9466 table_id: # (test.t1) +master-bin.000001 9466 Write_rows 1 9500 table_id: # flags: STMT_END_F +master-bin.000001 9500 Table_map 1 9541 table_id: # (test.t1) +master-bin.000001 9541 Write_rows 1 9575 table_id: # flags: STMT_END_F +master-bin.000001 9575 Table_map 1 9616 table_id: # (test.t1) +master-bin.000001 9616 Write_rows 1 9650 table_id: # flags: STMT_END_F +master-bin.000001 9650 Table_map 1 9691 table_id: # (test.t1) +master-bin.000001 9691 Write_rows 1 9725 table_id: # flags: STMT_END_F +master-bin.000001 9725 Table_map 1 9766 table_id: # (test.t1) +master-bin.000001 9766 Write_rows 1 9800 table_id: # flags: STMT_END_F +master-bin.000001 9800 Table_map 1 9841 table_id: # (test.t1) +master-bin.000001 9841 Write_rows 1 9875 table_id: # flags: STMT_END_F +master-bin.000001 9875 Table_map 1 9916 table_id: # (test.t1) +master-bin.000001 9916 Write_rows 1 9950 table_id: # flags: STMT_END_F +master-bin.000001 9950 Table_map 1 9991 table_id: # (test.t1) +master-bin.000001 9991 Write_rows 1 10025 table_id: # flags: STMT_END_F +master-bin.000001 10025 Table_map 1 10066 table_id: # (test.t1) +master-bin.000001 10066 Write_rows 1 10100 table_id: # flags: STMT_END_F +master-bin.000001 10100 Table_map 1 10141 table_id: # (test.t1) +master-bin.000001 10141 Write_rows 1 10175 table_id: # flags: STMT_END_F +master-bin.000001 10175 Table_map 1 10216 table_id: # (test.t1) +master-bin.000001 10216 Write_rows 1 10250 table_id: # flags: STMT_END_F +master-bin.000001 10250 Table_map 1 10291 table_id: # (test.t1) +master-bin.000001 10291 Write_rows 1 10325 table_id: # flags: STMT_END_F +master-bin.000001 10325 Table_map 1 10366 table_id: # (test.t1) +master-bin.000001 10366 Write_rows 1 10400 table_id: # flags: STMT_END_F +master-bin.000001 10400 Table_map 1 10441 table_id: # (test.t1) +master-bin.000001 10441 Write_rows 1 10475 table_id: # flags: STMT_END_F +master-bin.000001 10475 Table_map 1 10516 table_id: # (test.t1) +master-bin.000001 10516 Write_rows 1 10550 table_id: # flags: STMT_END_F +master-bin.000001 10550 Table_map 1 10591 table_id: # (test.t1) +master-bin.000001 10591 Write_rows 1 10625 table_id: # flags: STMT_END_F +master-bin.000001 10625 Table_map 1 10666 table_id: # (test.t1) +master-bin.000001 10666 Write_rows 1 10700 table_id: # flags: STMT_END_F +master-bin.000001 10700 Table_map 1 10741 table_id: # (test.t1) +master-bin.000001 10741 Write_rows 1 10775 table_id: # flags: STMT_END_F +master-bin.000001 10775 Table_map 1 10816 table_id: # (test.t1) +master-bin.000001 10816 Write_rows 1 10850 table_id: # flags: STMT_END_F +master-bin.000001 10850 Table_map 1 10891 table_id: # (test.t1) +master-bin.000001 10891 Write_rows 1 10925 table_id: # flags: STMT_END_F +master-bin.000001 10925 Table_map 1 10966 table_id: # (test.t1) +master-bin.000001 10966 Write_rows 1 11000 table_id: # flags: STMT_END_F +master-bin.000001 11000 Table_map 1 11041 table_id: # (test.t1) +master-bin.000001 11041 Write_rows 1 11075 table_id: # flags: STMT_END_F +master-bin.000001 11075 Table_map 1 11116 table_id: # (test.t1) +master-bin.000001 11116 Write_rows 1 11150 table_id: # flags: STMT_END_F +master-bin.000001 11150 Table_map 1 11191 table_id: # (test.t1) +master-bin.000001 11191 Write_rows 1 11225 table_id: # flags: STMT_END_F +master-bin.000001 11225 Table_map 1 11266 table_id: # (test.t1) +master-bin.000001 11266 Write_rows 1 11300 table_id: # flags: STMT_END_F +master-bin.000001 11300 Table_map 1 11341 table_id: # (test.t1) +master-bin.000001 11341 Write_rows 1 11375 table_id: # flags: STMT_END_F +master-bin.000001 11375 Table_map 1 11416 table_id: # (test.t1) +master-bin.000001 11416 Write_rows 1 11450 table_id: # flags: STMT_END_F +master-bin.000001 11450 Table_map 1 11491 table_id: # (test.t1) +master-bin.000001 11491 Write_rows 1 11525 table_id: # flags: STMT_END_F +master-bin.000001 11525 Table_map 1 11566 table_id: # (test.t1) +master-bin.000001 11566 Write_rows 1 11600 table_id: # flags: STMT_END_F +master-bin.000001 11600 Table_map 1 11641 table_id: # (test.t1) +master-bin.000001 11641 Write_rows 1 11675 table_id: # flags: STMT_END_F +master-bin.000001 11675 Table_map 1 11716 table_id: # (test.t1) +master-bin.000001 11716 Write_rows 1 11750 table_id: # flags: STMT_END_F +master-bin.000001 11750 Table_map 1 11791 table_id: # (test.t1) +master-bin.000001 11791 Write_rows 1 11825 table_id: # flags: STMT_END_F +master-bin.000001 11825 Table_map 1 11866 table_id: # (test.t1) +master-bin.000001 11866 Write_rows 1 11900 table_id: # flags: STMT_END_F +master-bin.000001 11900 Table_map 1 11941 table_id: # (test.t1) +master-bin.000001 11941 Write_rows 1 11975 table_id: # flags: STMT_END_F +master-bin.000001 11975 Table_map 1 12016 table_id: # (test.t1) +master-bin.000001 12016 Write_rows 1 12050 table_id: # flags: STMT_END_F +master-bin.000001 12050 Table_map 1 12091 table_id: # (test.t1) +master-bin.000001 12091 Write_rows 1 12125 table_id: # flags: STMT_END_F +master-bin.000001 12125 Table_map 1 12166 table_id: # (test.t1) +master-bin.000001 12166 Write_rows 1 12200 table_id: # flags: STMT_END_F +master-bin.000001 12200 Table_map 1 12241 table_id: # (test.t1) +master-bin.000001 12241 Write_rows 1 12275 table_id: # flags: STMT_END_F +master-bin.000001 12275 Table_map 1 12316 table_id: # (test.t1) +master-bin.000001 12316 Write_rows 1 12350 table_id: # flags: STMT_END_F +master-bin.000001 12350 Table_map 1 12391 table_id: # (test.t1) +master-bin.000001 12391 Write_rows 1 12425 table_id: # flags: STMT_END_F +master-bin.000001 12425 Table_map 1 12466 table_id: # (test.t1) +master-bin.000001 12466 Write_rows 1 12500 table_id: # flags: STMT_END_F +master-bin.000001 12500 Table_map 1 12541 table_id: # (test.t1) +master-bin.000001 12541 Write_rows 1 12575 table_id: # flags: STMT_END_F +master-bin.000001 12575 Table_map 1 12616 table_id: # (test.t1) +master-bin.000001 12616 Write_rows 1 12650 table_id: # flags: STMT_END_F +master-bin.000001 12650 Table_map 1 12691 table_id: # (test.t1) +master-bin.000001 12691 Write_rows 1 12725 table_id: # flags: STMT_END_F +master-bin.000001 12725 Table_map 1 12766 table_id: # (test.t1) +master-bin.000001 12766 Write_rows 1 12800 table_id: # flags: STMT_END_F +master-bin.000001 12800 Table_map 1 12841 table_id: # (test.t1) +master-bin.000001 12841 Write_rows 1 12875 table_id: # flags: STMT_END_F +master-bin.000001 12875 Table_map 1 12916 table_id: # (test.t1) +master-bin.000001 12916 Write_rows 1 12950 table_id: # flags: STMT_END_F +master-bin.000001 12950 Table_map 1 12991 table_id: # (test.t1) +master-bin.000001 12991 Write_rows 1 13025 table_id: # flags: STMT_END_F +master-bin.000001 13025 Table_map 1 13066 table_id: # (test.t1) +master-bin.000001 13066 Write_rows 1 13100 table_id: # flags: STMT_END_F +master-bin.000001 13100 Table_map 1 13141 table_id: # (test.t1) +master-bin.000001 13141 Write_rows 1 13175 table_id: # flags: STMT_END_F +master-bin.000001 13175 Table_map 1 13216 table_id: # (test.t1) +master-bin.000001 13216 Write_rows 1 13250 table_id: # flags: STMT_END_F +master-bin.000001 13250 Table_map 1 13291 table_id: # (test.t1) +master-bin.000001 13291 Write_rows 1 13325 table_id: # flags: STMT_END_F +master-bin.000001 13325 Table_map 1 13366 table_id: # (test.t1) +master-bin.000001 13366 Write_rows 1 13400 table_id: # flags: STMT_END_F +master-bin.000001 13400 Table_map 1 13441 table_id: # (test.t1) +master-bin.000001 13441 Write_rows 1 13475 table_id: # flags: STMT_END_F +master-bin.000001 13475 Table_map 1 13516 table_id: # (test.t1) +master-bin.000001 13516 Write_rows 1 13550 table_id: # flags: STMT_END_F +master-bin.000001 13550 Table_map 1 13591 table_id: # (test.t1) +master-bin.000001 13591 Write_rows 1 13625 table_id: # flags: STMT_END_F +master-bin.000001 13625 Table_map 1 13666 table_id: # (test.t1) +master-bin.000001 13666 Write_rows 1 13700 table_id: # flags: STMT_END_F +master-bin.000001 13700 Table_map 1 13741 table_id: # (test.t1) +master-bin.000001 13741 Write_rows 1 13775 table_id: # flags: STMT_END_F +master-bin.000001 13775 Table_map 1 13816 table_id: # (test.t1) +master-bin.000001 13816 Write_rows 1 13850 table_id: # flags: STMT_END_F +master-bin.000001 13850 Table_map 1 13891 table_id: # (test.t1) +master-bin.000001 13891 Write_rows 1 13925 table_id: # flags: STMT_END_F +master-bin.000001 13925 Table_map 1 13966 table_id: # (test.t1) +master-bin.000001 13966 Write_rows 1 14000 table_id: # flags: STMT_END_F +master-bin.000001 14000 Table_map 1 14041 table_id: # (test.t1) +master-bin.000001 14041 Write_rows 1 14075 table_id: # flags: STMT_END_F +master-bin.000001 14075 Table_map 1 14116 table_id: # (test.t1) +master-bin.000001 14116 Write_rows 1 14150 table_id: # flags: STMT_END_F +master-bin.000001 14150 Table_map 1 14191 table_id: # (test.t1) +master-bin.000001 14191 Write_rows 1 14225 table_id: # flags: STMT_END_F +master-bin.000001 14225 Table_map 1 14266 table_id: # (test.t1) +master-bin.000001 14266 Write_rows 1 14300 table_id: # flags: STMT_END_F +master-bin.000001 14300 Table_map 1 14341 table_id: # (test.t1) +master-bin.000001 14341 Write_rows 1 14375 table_id: # flags: STMT_END_F +master-bin.000001 14375 Table_map 1 14416 table_id: # (test.t1) +master-bin.000001 14416 Write_rows 1 14450 table_id: # flags: STMT_END_F +master-bin.000001 14450 Table_map 1 14491 table_id: # (test.t1) +master-bin.000001 14491 Write_rows 1 14525 table_id: # flags: STMT_END_F +master-bin.000001 14525 Table_map 1 14566 table_id: # (test.t1) +master-bin.000001 14566 Write_rows 1 14600 table_id: # flags: STMT_END_F +master-bin.000001 14600 Table_map 1 14641 table_id: # (test.t1) +master-bin.000001 14641 Write_rows 1 14675 table_id: # flags: STMT_END_F +master-bin.000001 14675 Table_map 1 14716 table_id: # (test.t1) +master-bin.000001 14716 Write_rows 1 14750 table_id: # flags: STMT_END_F +master-bin.000001 14750 Table_map 1 14791 table_id: # (test.t1) +master-bin.000001 14791 Write_rows 1 14825 table_id: # flags: STMT_END_F +master-bin.000001 14825 Table_map 1 14866 table_id: # (test.t1) +master-bin.000001 14866 Write_rows 1 14900 table_id: # flags: STMT_END_F +master-bin.000001 14900 Table_map 1 14941 table_id: # (test.t1) +master-bin.000001 14941 Write_rows 1 14975 table_id: # flags: STMT_END_F +master-bin.000001 14975 Table_map 1 15016 table_id: # (test.t1) +master-bin.000001 15016 Write_rows 1 15050 table_id: # flags: STMT_END_F +master-bin.000001 15050 Table_map 1 15091 table_id: # (test.t1) +master-bin.000001 15091 Write_rows 1 15125 table_id: # flags: STMT_END_F +master-bin.000001 15125 Table_map 1 15166 table_id: # (test.t1) +master-bin.000001 15166 Write_rows 1 15200 table_id: # flags: STMT_END_F +master-bin.000001 15200 Table_map 1 15241 table_id: # (test.t1) +master-bin.000001 15241 Write_rows 1 15275 table_id: # flags: STMT_END_F +master-bin.000001 15275 Table_map 1 15316 table_id: # (test.t1) +master-bin.000001 15316 Write_rows 1 15350 table_id: # flags: STMT_END_F +master-bin.000001 15350 Table_map 1 15391 table_id: # (test.t1) +master-bin.000001 15391 Write_rows 1 15425 table_id: # flags: STMT_END_F +master-bin.000001 15425 Table_map 1 15466 table_id: # (test.t1) +master-bin.000001 15466 Write_rows 1 15500 table_id: # flags: STMT_END_F +master-bin.000001 15500 Table_map 1 15541 table_id: # (test.t1) +master-bin.000001 15541 Write_rows 1 15575 table_id: # flags: STMT_END_F +master-bin.000001 15575 Table_map 1 15616 table_id: # (test.t1) +master-bin.000001 15616 Write_rows 1 15650 table_id: # flags: STMT_END_F +master-bin.000001 15650 Table_map 1 15691 table_id: # (test.t1) +master-bin.000001 15691 Write_rows 1 15725 table_id: # flags: STMT_END_F +master-bin.000001 15725 Table_map 1 15766 table_id: # (test.t1) +master-bin.000001 15766 Write_rows 1 15800 table_id: # flags: STMT_END_F +master-bin.000001 15800 Table_map 1 15841 table_id: # (test.t1) +master-bin.000001 15841 Write_rows 1 15875 table_id: # flags: STMT_END_F +master-bin.000001 15875 Table_map 1 15916 table_id: # (test.t1) +master-bin.000001 15916 Write_rows 1 15950 table_id: # flags: STMT_END_F +master-bin.000001 15950 Table_map 1 15991 table_id: # (test.t1) +master-bin.000001 15991 Write_rows 1 16025 table_id: # flags: STMT_END_F +master-bin.000001 16025 Table_map 1 16066 table_id: # (test.t1) +master-bin.000001 16066 Write_rows 1 16100 table_id: # flags: STMT_END_F +master-bin.000001 16100 Table_map 1 16141 table_id: # (test.t1) +master-bin.000001 16141 Write_rows 1 16175 table_id: # flags: STMT_END_F +master-bin.000001 16175 Table_map 1 16216 table_id: # (test.t1) +master-bin.000001 16216 Write_rows 1 16250 table_id: # flags: STMT_END_F +master-bin.000001 16250 Table_map 1 16291 table_id: # (test.t1) +master-bin.000001 16291 Write_rows 1 16325 table_id: # flags: STMT_END_F +master-bin.000001 16325 Table_map 1 16366 table_id: # (test.t1) +master-bin.000001 16366 Write_rows 1 16400 table_id: # flags: STMT_END_F +master-bin.000001 16400 Table_map 1 16441 table_id: # (test.t1) +master-bin.000001 16441 Write_rows 1 16475 table_id: # flags: STMT_END_F +master-bin.000001 16475 Table_map 1 16516 table_id: # (test.t1) +master-bin.000001 16516 Write_rows 1 16550 table_id: # flags: STMT_END_F +master-bin.000001 16550 Table_map 1 16591 table_id: # (test.t1) +master-bin.000001 16591 Write_rows 1 16625 table_id: # flags: STMT_END_F +master-bin.000001 16625 Table_map 1 16666 table_id: # (test.t1) +master-bin.000001 16666 Write_rows 1 16700 table_id: # flags: STMT_END_F +master-bin.000001 16700 Table_map 1 16741 table_id: # (test.t1) +master-bin.000001 16741 Write_rows 1 16775 table_id: # flags: STMT_END_F +master-bin.000001 16775 Table_map 1 16816 table_id: # (test.t1) +master-bin.000001 16816 Write_rows 1 16850 table_id: # flags: STMT_END_F +master-bin.000001 16850 Table_map 1 16891 table_id: # (test.t1) +master-bin.000001 16891 Write_rows 1 16925 table_id: # flags: STMT_END_F +master-bin.000001 16925 Table_map 1 16966 table_id: # (test.t1) +master-bin.000001 16966 Write_rows 1 17000 table_id: # flags: STMT_END_F +master-bin.000001 17000 Table_map 1 17041 table_id: # (test.t1) +master-bin.000001 17041 Write_rows 1 17075 table_id: # flags: STMT_END_F +master-bin.000001 17075 Table_map 1 17116 table_id: # (test.t1) +master-bin.000001 17116 Write_rows 1 17150 table_id: # flags: STMT_END_F +master-bin.000001 17150 Table_map 1 17191 table_id: # (test.t1) +master-bin.000001 17191 Write_rows 1 17225 table_id: # flags: STMT_END_F +master-bin.000001 17225 Table_map 1 17266 table_id: # (test.t1) +master-bin.000001 17266 Write_rows 1 17300 table_id: # flags: STMT_END_F +master-bin.000001 17300 Table_map 1 17341 table_id: # (test.t1) +master-bin.000001 17341 Write_rows 1 17375 table_id: # flags: STMT_END_F +master-bin.000001 17375 Table_map 1 17416 table_id: # (test.t1) +master-bin.000001 17416 Write_rows 1 17450 table_id: # flags: STMT_END_F +master-bin.000001 17450 Table_map 1 17491 table_id: # (test.t1) +master-bin.000001 17491 Write_rows 1 17525 table_id: # flags: STMT_END_F +master-bin.000001 17525 Table_map 1 17566 table_id: # (test.t1) +master-bin.000001 17566 Write_rows 1 17600 table_id: # flags: STMT_END_F +master-bin.000001 17600 Table_map 1 17641 table_id: # (test.t1) +master-bin.000001 17641 Write_rows 1 17675 table_id: # flags: STMT_END_F +master-bin.000001 17675 Table_map 1 17716 table_id: # (test.t1) +master-bin.000001 17716 Write_rows 1 17750 table_id: # flags: STMT_END_F +master-bin.000001 17750 Table_map 1 17791 table_id: # (test.t1) +master-bin.000001 17791 Write_rows 1 17825 table_id: # flags: STMT_END_F +master-bin.000001 17825 Table_map 1 17866 table_id: # (test.t1) +master-bin.000001 17866 Write_rows 1 17900 table_id: # flags: STMT_END_F +master-bin.000001 17900 Table_map 1 17941 table_id: # (test.t1) +master-bin.000001 17941 Write_rows 1 17975 table_id: # flags: STMT_END_F +master-bin.000001 17975 Table_map 1 18016 table_id: # (test.t1) +master-bin.000001 18016 Write_rows 1 18050 table_id: # flags: STMT_END_F +master-bin.000001 18050 Table_map 1 18091 table_id: # (test.t1) +master-bin.000001 18091 Write_rows 1 18125 table_id: # flags: STMT_END_F +master-bin.000001 18125 Table_map 1 18166 table_id: # (test.t1) +master-bin.000001 18166 Write_rows 1 18200 table_id: # flags: STMT_END_F +master-bin.000001 18200 Table_map 1 18241 table_id: # (test.t1) +master-bin.000001 18241 Write_rows 1 18275 table_id: # flags: STMT_END_F +master-bin.000001 18275 Table_map 1 18316 table_id: # (test.t1) +master-bin.000001 18316 Write_rows 1 18350 table_id: # flags: STMT_END_F +master-bin.000001 18350 Table_map 1 18391 table_id: # (test.t1) +master-bin.000001 18391 Write_rows 1 18425 table_id: # flags: STMT_END_F +master-bin.000001 18425 Table_map 1 18466 table_id: # (test.t1) +master-bin.000001 18466 Write_rows 1 18500 table_id: # flags: STMT_END_F +master-bin.000001 18500 Table_map 1 18541 table_id: # (test.t1) +master-bin.000001 18541 Write_rows 1 18575 table_id: # flags: STMT_END_F +master-bin.000001 18575 Table_map 1 18616 table_id: # (test.t1) +master-bin.000001 18616 Write_rows 1 18650 table_id: # flags: STMT_END_F +master-bin.000001 18650 Table_map 1 18691 table_id: # (test.t1) +master-bin.000001 18691 Write_rows 1 18725 table_id: # flags: STMT_END_F +master-bin.000001 18725 Table_map 1 18766 table_id: # (test.t1) +master-bin.000001 18766 Write_rows 1 18800 table_id: # flags: STMT_END_F +master-bin.000001 18800 Table_map 1 18841 table_id: # (test.t1) +master-bin.000001 18841 Write_rows 1 18875 table_id: # flags: STMT_END_F +master-bin.000001 18875 Table_map 1 18916 table_id: # (test.t1) +master-bin.000001 18916 Write_rows 1 18950 table_id: # flags: STMT_END_F +master-bin.000001 18950 Table_map 1 18991 table_id: # (test.t1) +master-bin.000001 18991 Write_rows 1 19025 table_id: # flags: STMT_END_F +master-bin.000001 19025 Table_map 1 19066 table_id: # (test.t1) +master-bin.000001 19066 Write_rows 1 19100 table_id: # flags: STMT_END_F +master-bin.000001 19100 Table_map 1 19141 table_id: # (test.t1) +master-bin.000001 19141 Write_rows 1 19175 table_id: # flags: STMT_END_F +master-bin.000001 19175 Table_map 1 19216 table_id: # (test.t1) +master-bin.000001 19216 Write_rows 1 19250 table_id: # flags: STMT_END_F +master-bin.000001 19250 Table_map 1 19291 table_id: # (test.t1) +master-bin.000001 19291 Write_rows 1 19325 table_id: # flags: STMT_END_F +master-bin.000001 19325 Table_map 1 19366 table_id: # (test.t1) +master-bin.000001 19366 Write_rows 1 19400 table_id: # flags: STMT_END_F +master-bin.000001 19400 Table_map 1 19441 table_id: # (test.t1) +master-bin.000001 19441 Write_rows 1 19475 table_id: # flags: STMT_END_F +master-bin.000001 19475 Table_map 1 19516 table_id: # (test.t1) +master-bin.000001 19516 Write_rows 1 19550 table_id: # flags: STMT_END_F +master-bin.000001 19550 Table_map 1 19591 table_id: # (test.t1) +master-bin.000001 19591 Write_rows 1 19625 table_id: # flags: STMT_END_F +master-bin.000001 19625 Table_map 1 19666 table_id: # (test.t1) +master-bin.000001 19666 Write_rows 1 19700 table_id: # flags: STMT_END_F +master-bin.000001 19700 Table_map 1 19741 table_id: # (test.t1) +master-bin.000001 19741 Write_rows 1 19775 table_id: # flags: STMT_END_F +master-bin.000001 19775 Table_map 1 19816 table_id: # (test.t1) +master-bin.000001 19816 Write_rows 1 19850 table_id: # flags: STMT_END_F +master-bin.000001 19850 Table_map 1 19891 table_id: # (test.t1) +master-bin.000001 19891 Write_rows 1 19925 table_id: # flags: STMT_END_F +master-bin.000001 19925 Table_map 1 19966 table_id: # (test.t1) +master-bin.000001 19966 Write_rows 1 20000 table_id: # flags: STMT_END_F +master-bin.000001 20000 Table_map 1 20041 table_id: # (test.t1) +master-bin.000001 20041 Write_rows 1 20075 table_id: # flags: STMT_END_F +master-bin.000001 20075 Table_map 1 20116 table_id: # (test.t1) +master-bin.000001 20116 Write_rows 1 20150 table_id: # flags: STMT_END_F +master-bin.000001 20150 Table_map 1 20191 table_id: # (test.t1) +master-bin.000001 20191 Write_rows 1 20225 table_id: # flags: STMT_END_F +master-bin.000001 20225 Table_map 1 20266 table_id: # (test.t1) +master-bin.000001 20266 Write_rows 1 20300 table_id: # flags: STMT_END_F +master-bin.000001 20300 Table_map 1 20341 table_id: # (test.t1) +master-bin.000001 20341 Write_rows 1 20375 table_id: # flags: STMT_END_F +master-bin.000001 20375 Table_map 1 20416 table_id: # (test.t1) +master-bin.000001 20416 Write_rows 1 20450 table_id: # flags: STMT_END_F +master-bin.000001 20450 Table_map 1 20491 table_id: # (test.t1) +master-bin.000001 20491 Write_rows 1 20525 table_id: # flags: STMT_END_F +master-bin.000001 20525 Table_map 1 20566 table_id: # (test.t1) +master-bin.000001 20566 Write_rows 1 20600 table_id: # flags: STMT_END_F +master-bin.000001 20600 Table_map 1 20641 table_id: # (test.t1) +master-bin.000001 20641 Write_rows 1 20675 table_id: # flags: STMT_END_F +master-bin.000001 20675 Table_map 1 20716 table_id: # (test.t1) +master-bin.000001 20716 Write_rows 1 20750 table_id: # flags: STMT_END_F +master-bin.000001 20750 Table_map 1 20791 table_id: # (test.t1) +master-bin.000001 20791 Write_rows 1 20825 table_id: # flags: STMT_END_F +master-bin.000001 20825 Table_map 1 20866 table_id: # (test.t1) +master-bin.000001 20866 Write_rows 1 20900 table_id: # flags: STMT_END_F +master-bin.000001 20900 Table_map 1 20941 table_id: # (test.t1) +master-bin.000001 20941 Write_rows 1 20975 table_id: # flags: STMT_END_F +master-bin.000001 20975 Table_map 1 21016 table_id: # (test.t1) +master-bin.000001 21016 Write_rows 1 21050 table_id: # flags: STMT_END_F +master-bin.000001 21050 Table_map 1 21091 table_id: # (test.t1) +master-bin.000001 21091 Write_rows 1 21125 table_id: # flags: STMT_END_F +master-bin.000001 21125 Table_map 1 21166 table_id: # (test.t1) +master-bin.000001 21166 Write_rows 1 21200 table_id: # flags: STMT_END_F +master-bin.000001 21200 Table_map 1 21241 table_id: # (test.t1) +master-bin.000001 21241 Write_rows 1 21275 table_id: # flags: STMT_END_F +master-bin.000001 21275 Table_map 1 21316 table_id: # (test.t1) +master-bin.000001 21316 Write_rows 1 21350 table_id: # flags: STMT_END_F +master-bin.000001 21350 Table_map 1 21391 table_id: # (test.t1) +master-bin.000001 21391 Write_rows 1 21425 table_id: # flags: STMT_END_F +master-bin.000001 21425 Table_map 1 21466 table_id: # (test.t1) +master-bin.000001 21466 Write_rows 1 21500 table_id: # flags: STMT_END_F +master-bin.000001 21500 Table_map 1 21541 table_id: # (test.t1) +master-bin.000001 21541 Write_rows 1 21575 table_id: # flags: STMT_END_F +master-bin.000001 21575 Table_map 1 21616 table_id: # (test.t1) +master-bin.000001 21616 Write_rows 1 21650 table_id: # flags: STMT_END_F +master-bin.000001 21650 Table_map 1 21691 table_id: # (test.t1) +master-bin.000001 21691 Write_rows 1 21725 table_id: # flags: STMT_END_F +master-bin.000001 21725 Table_map 1 21766 table_id: # (test.t1) +master-bin.000001 21766 Write_rows 1 21800 table_id: # flags: STMT_END_F +master-bin.000001 21800 Table_map 1 21841 table_id: # (test.t1) +master-bin.000001 21841 Write_rows 1 21875 table_id: # flags: STMT_END_F +master-bin.000001 21875 Table_map 1 21916 table_id: # (test.t1) +master-bin.000001 21916 Write_rows 1 21950 table_id: # flags: STMT_END_F +master-bin.000001 21950 Table_map 1 21991 table_id: # (test.t1) +master-bin.000001 21991 Write_rows 1 22025 table_id: # flags: STMT_END_F +master-bin.000001 22025 Table_map 1 22066 table_id: # (test.t1) +master-bin.000001 22066 Write_rows 1 22100 table_id: # flags: STMT_END_F +master-bin.000001 22100 Table_map 1 22141 table_id: # (test.t1) +master-bin.000001 22141 Write_rows 1 22175 table_id: # flags: STMT_END_F +master-bin.000001 22175 Table_map 1 22216 table_id: # (test.t1) +master-bin.000001 22216 Write_rows 1 22250 table_id: # flags: STMT_END_F +master-bin.000001 22250 Table_map 1 22291 table_id: # (test.t1) +master-bin.000001 22291 Write_rows 1 22325 table_id: # flags: STMT_END_F +master-bin.000001 22325 Table_map 1 22366 table_id: # (test.t1) +master-bin.000001 22366 Write_rows 1 22400 table_id: # flags: STMT_END_F +master-bin.000001 22400 Table_map 1 22441 table_id: # (test.t1) +master-bin.000001 22441 Write_rows 1 22475 table_id: # flags: STMT_END_F +master-bin.000001 22475 Table_map 1 22516 table_id: # (test.t1) +master-bin.000001 22516 Write_rows 1 22550 table_id: # flags: STMT_END_F +master-bin.000001 22550 Table_map 1 22591 table_id: # (test.t1) +master-bin.000001 22591 Write_rows 1 22625 table_id: # flags: STMT_END_F +master-bin.000001 22625 Table_map 1 22666 table_id: # (test.t1) +master-bin.000001 22666 Write_rows 1 22700 table_id: # flags: STMT_END_F +master-bin.000001 22700 Table_map 1 22741 table_id: # (test.t1) +master-bin.000001 22741 Write_rows 1 22775 table_id: # flags: STMT_END_F +master-bin.000001 22775 Table_map 1 22816 table_id: # (test.t1) +master-bin.000001 22816 Write_rows 1 22850 table_id: # flags: STMT_END_F +master-bin.000001 22850 Table_map 1 22891 table_id: # (test.t1) +master-bin.000001 22891 Write_rows 1 22925 table_id: # flags: STMT_END_F +master-bin.000001 22925 Table_map 1 22966 table_id: # (test.t1) +master-bin.000001 22966 Write_rows 1 23000 table_id: # flags: STMT_END_F +master-bin.000001 23000 Table_map 1 23041 table_id: # (test.t1) +master-bin.000001 23041 Write_rows 1 23075 table_id: # flags: STMT_END_F +master-bin.000001 23075 Table_map 1 23116 table_id: # (test.t1) +master-bin.000001 23116 Write_rows 1 23150 table_id: # flags: STMT_END_F +master-bin.000001 23150 Table_map 1 23191 table_id: # (test.t1) +master-bin.000001 23191 Write_rows 1 23225 table_id: # flags: STMT_END_F +master-bin.000001 23225 Table_map 1 23266 table_id: # (test.t1) +master-bin.000001 23266 Write_rows 1 23300 table_id: # flags: STMT_END_F +master-bin.000001 23300 Table_map 1 23341 table_id: # (test.t1) +master-bin.000001 23341 Write_rows 1 23375 table_id: # flags: STMT_END_F +master-bin.000001 23375 Table_map 1 23416 table_id: # (test.t1) +master-bin.000001 23416 Write_rows 1 23450 table_id: # flags: STMT_END_F +master-bin.000001 23450 Table_map 1 23491 table_id: # (test.t1) +master-bin.000001 23491 Write_rows 1 23525 table_id: # flags: STMT_END_F +master-bin.000001 23525 Table_map 1 23566 table_id: # (test.t1) +master-bin.000001 23566 Write_rows 1 23600 table_id: # flags: STMT_END_F +master-bin.000001 23600 Table_map 1 23641 table_id: # (test.t1) +master-bin.000001 23641 Write_rows 1 23675 table_id: # flags: STMT_END_F +master-bin.000001 23675 Table_map 1 23716 table_id: # (test.t1) +master-bin.000001 23716 Write_rows 1 23750 table_id: # flags: STMT_END_F +master-bin.000001 23750 Table_map 1 23791 table_id: # (test.t1) +master-bin.000001 23791 Write_rows 1 23825 table_id: # flags: STMT_END_F +master-bin.000001 23825 Table_map 1 23866 table_id: # (test.t1) +master-bin.000001 23866 Write_rows 1 23900 table_id: # flags: STMT_END_F +master-bin.000001 23900 Table_map 1 23941 table_id: # (test.t1) +master-bin.000001 23941 Write_rows 1 23975 table_id: # flags: STMT_END_F +master-bin.000001 23975 Table_map 1 24016 table_id: # (test.t1) +master-bin.000001 24016 Write_rows 1 24050 table_id: # flags: STMT_END_F +master-bin.000001 24050 Table_map 1 24091 table_id: # (test.t1) +master-bin.000001 24091 Write_rows 1 24125 table_id: # flags: STMT_END_F +master-bin.000001 24125 Table_map 1 24166 table_id: # (test.t1) +master-bin.000001 24166 Write_rows 1 24200 table_id: # flags: STMT_END_F +master-bin.000001 24200 Table_map 1 24241 table_id: # (test.t1) +master-bin.000001 24241 Write_rows 1 24275 table_id: # flags: STMT_END_F +master-bin.000001 24275 Table_map 1 24316 table_id: # (test.t1) +master-bin.000001 24316 Write_rows 1 24350 table_id: # flags: STMT_END_F +master-bin.000001 24350 Table_map 1 24391 table_id: # (test.t1) +master-bin.000001 24391 Write_rows 1 24425 table_id: # flags: STMT_END_F +master-bin.000001 24425 Table_map 1 24466 table_id: # (test.t1) +master-bin.000001 24466 Write_rows 1 24500 table_id: # flags: STMT_END_F +master-bin.000001 24500 Table_map 1 24541 table_id: # (test.t1) +master-bin.000001 24541 Write_rows 1 24575 table_id: # flags: STMT_END_F +master-bin.000001 24575 Table_map 1 24616 table_id: # (test.t1) +master-bin.000001 24616 Write_rows 1 24650 table_id: # flags: STMT_END_F +master-bin.000001 24650 Table_map 1 24691 table_id: # (test.t1) +master-bin.000001 24691 Write_rows 1 24725 table_id: # flags: STMT_END_F +master-bin.000001 24725 Table_map 1 24766 table_id: # (test.t1) +master-bin.000001 24766 Write_rows 1 24800 table_id: # flags: STMT_END_F +master-bin.000001 24800 Table_map 1 24841 table_id: # (test.t1) +master-bin.000001 24841 Write_rows 1 24875 table_id: # flags: STMT_END_F +master-bin.000001 24875 Table_map 1 24916 table_id: # (test.t1) +master-bin.000001 24916 Write_rows 1 24950 table_id: # flags: STMT_END_F +master-bin.000001 24950 Table_map 1 24991 table_id: # (test.t1) +master-bin.000001 24991 Write_rows 1 25025 table_id: # flags: STMT_END_F +master-bin.000001 25025 Table_map 1 25066 table_id: # (test.t1) +master-bin.000001 25066 Write_rows 1 25100 table_id: # flags: STMT_END_F +master-bin.000001 25100 Table_map 1 25141 table_id: # (test.t1) +master-bin.000001 25141 Write_rows 1 25175 table_id: # flags: STMT_END_F +master-bin.000001 25175 Table_map 1 25216 table_id: # (test.t1) +master-bin.000001 25216 Write_rows 1 25250 table_id: # flags: STMT_END_F +master-bin.000001 25250 Table_map 1 25291 table_id: # (test.t1) +master-bin.000001 25291 Write_rows 1 25325 table_id: # flags: STMT_END_F +master-bin.000001 25325 Table_map 1 25366 table_id: # (test.t1) +master-bin.000001 25366 Write_rows 1 25400 table_id: # flags: STMT_END_F +master-bin.000001 25400 Table_map 1 25441 table_id: # (test.t1) +master-bin.000001 25441 Write_rows 1 25475 table_id: # flags: STMT_END_F +master-bin.000001 25475 Table_map 1 25516 table_id: # (test.t1) +master-bin.000001 25516 Write_rows 1 25550 table_id: # flags: STMT_END_F +master-bin.000001 25550 Table_map 1 25591 table_id: # (test.t1) +master-bin.000001 25591 Write_rows 1 25625 table_id: # flags: STMT_END_F +master-bin.000001 25625 Table_map 1 25666 table_id: # (test.t1) +master-bin.000001 25666 Write_rows 1 25700 table_id: # flags: STMT_END_F +master-bin.000001 25700 Table_map 1 25741 table_id: # (test.t1) +master-bin.000001 25741 Write_rows 1 25775 table_id: # flags: STMT_END_F +master-bin.000001 25775 Table_map 1 25816 table_id: # (test.t1) +master-bin.000001 25816 Write_rows 1 25850 table_id: # flags: STMT_END_F +master-bin.000001 25850 Table_map 1 25891 table_id: # (test.t1) +master-bin.000001 25891 Write_rows 1 25925 table_id: # flags: STMT_END_F +master-bin.000001 25925 Table_map 1 25966 table_id: # (test.t1) +master-bin.000001 25966 Write_rows 1 26000 table_id: # flags: STMT_END_F +master-bin.000001 26000 Table_map 1 26041 table_id: # (test.t1) +master-bin.000001 26041 Write_rows 1 26075 table_id: # flags: STMT_END_F +master-bin.000001 26075 Table_map 1 26116 table_id: # (test.t1) +master-bin.000001 26116 Write_rows 1 26150 table_id: # flags: STMT_END_F +master-bin.000001 26150 Table_map 1 26191 table_id: # (test.t1) +master-bin.000001 26191 Write_rows 1 26225 table_id: # flags: STMT_END_F +master-bin.000001 26225 Table_map 1 26266 table_id: # (test.t1) +master-bin.000001 26266 Write_rows 1 26300 table_id: # flags: STMT_END_F +master-bin.000001 26300 Table_map 1 26341 table_id: # (test.t1) +master-bin.000001 26341 Write_rows 1 26375 table_id: # flags: STMT_END_F +master-bin.000001 26375 Table_map 1 26416 table_id: # (test.t1) +master-bin.000001 26416 Write_rows 1 26450 table_id: # flags: STMT_END_F +master-bin.000001 26450 Table_map 1 26491 table_id: # (test.t1) +master-bin.000001 26491 Write_rows 1 26525 table_id: # flags: STMT_END_F +master-bin.000001 26525 Table_map 1 26566 table_id: # (test.t1) +master-bin.000001 26566 Write_rows 1 26600 table_id: # flags: STMT_END_F +master-bin.000001 26600 Table_map 1 26641 table_id: # (test.t1) +master-bin.000001 26641 Write_rows 1 26675 table_id: # flags: STMT_END_F +master-bin.000001 26675 Table_map 1 26716 table_id: # (test.t1) +master-bin.000001 26716 Write_rows 1 26750 table_id: # flags: STMT_END_F +master-bin.000001 26750 Table_map 1 26791 table_id: # (test.t1) +master-bin.000001 26791 Write_rows 1 26825 table_id: # flags: STMT_END_F +master-bin.000001 26825 Table_map 1 26866 table_id: # (test.t1) +master-bin.000001 26866 Write_rows 1 26900 table_id: # flags: STMT_END_F +master-bin.000001 26900 Table_map 1 26941 table_id: # (test.t1) +master-bin.000001 26941 Write_rows 1 26975 table_id: # flags: STMT_END_F +master-bin.000001 26975 Table_map 1 27016 table_id: # (test.t1) +master-bin.000001 27016 Write_rows 1 27050 table_id: # flags: STMT_END_F +master-bin.000001 27050 Table_map 1 27091 table_id: # (test.t1) +master-bin.000001 27091 Write_rows 1 27125 table_id: # flags: STMT_END_F +master-bin.000001 27125 Table_map 1 27166 table_id: # (test.t1) +master-bin.000001 27166 Write_rows 1 27200 table_id: # flags: STMT_END_F +master-bin.000001 27200 Table_map 1 27241 table_id: # (test.t1) +master-bin.000001 27241 Write_rows 1 27275 table_id: # flags: STMT_END_F +master-bin.000001 27275 Table_map 1 27316 table_id: # (test.t1) +master-bin.000001 27316 Write_rows 1 27350 table_id: # flags: STMT_END_F +master-bin.000001 27350 Table_map 1 27391 table_id: # (test.t1) +master-bin.000001 27391 Write_rows 1 27425 table_id: # flags: STMT_END_F +master-bin.000001 27425 Table_map 1 27466 table_id: # (test.t1) +master-bin.000001 27466 Write_rows 1 27500 table_id: # flags: STMT_END_F +master-bin.000001 27500 Table_map 1 27541 table_id: # (test.t1) +master-bin.000001 27541 Write_rows 1 27575 table_id: # flags: STMT_END_F +master-bin.000001 27575 Table_map 1 27616 table_id: # (test.t1) +master-bin.000001 27616 Write_rows 1 27650 table_id: # flags: STMT_END_F +master-bin.000001 27650 Table_map 1 27691 table_id: # (test.t1) +master-bin.000001 27691 Write_rows 1 27725 table_id: # flags: STMT_END_F +master-bin.000001 27725 Table_map 1 27766 table_id: # (test.t1) +master-bin.000001 27766 Write_rows 1 27800 table_id: # flags: STMT_END_F +master-bin.000001 27800 Table_map 1 27841 table_id: # (test.t1) +master-bin.000001 27841 Write_rows 1 27875 table_id: # flags: STMT_END_F +master-bin.000001 27875 Table_map 1 27916 table_id: # (test.t1) +master-bin.000001 27916 Write_rows 1 27950 table_id: # flags: STMT_END_F +master-bin.000001 27950 Table_map 1 27991 table_id: # (test.t1) +master-bin.000001 27991 Write_rows 1 28025 table_id: # flags: STMT_END_F +master-bin.000001 28025 Table_map 1 28066 table_id: # (test.t1) +master-bin.000001 28066 Write_rows 1 28100 table_id: # flags: STMT_END_F +master-bin.000001 28100 Table_map 1 28141 table_id: # (test.t1) +master-bin.000001 28141 Write_rows 1 28175 table_id: # flags: STMT_END_F +master-bin.000001 28175 Table_map 1 28216 table_id: # (test.t1) +master-bin.000001 28216 Write_rows 1 28250 table_id: # flags: STMT_END_F +master-bin.000001 28250 Table_map 1 28291 table_id: # (test.t1) +master-bin.000001 28291 Write_rows 1 28325 table_id: # flags: STMT_END_F +master-bin.000001 28325 Table_map 1 28366 table_id: # (test.t1) +master-bin.000001 28366 Write_rows 1 28400 table_id: # flags: STMT_END_F +master-bin.000001 28400 Table_map 1 28441 table_id: # (test.t1) +master-bin.000001 28441 Write_rows 1 28475 table_id: # flags: STMT_END_F +master-bin.000001 28475 Table_map 1 28516 table_id: # (test.t1) +master-bin.000001 28516 Write_rows 1 28550 table_id: # flags: STMT_END_F +master-bin.000001 28550 Table_map 1 28591 table_id: # (test.t1) +master-bin.000001 28591 Write_rows 1 28625 table_id: # flags: STMT_END_F +master-bin.000001 28625 Table_map 1 28666 table_id: # (test.t1) +master-bin.000001 28666 Write_rows 1 28700 table_id: # flags: STMT_END_F +master-bin.000001 28700 Table_map 1 28741 table_id: # (test.t1) +master-bin.000001 28741 Write_rows 1 28775 table_id: # flags: STMT_END_F +master-bin.000001 28775 Table_map 1 28816 table_id: # (test.t1) +master-bin.000001 28816 Write_rows 1 28850 table_id: # flags: STMT_END_F +master-bin.000001 28850 Table_map 1 28891 table_id: # (test.t1) +master-bin.000001 28891 Write_rows 1 28925 table_id: # flags: STMT_END_F +master-bin.000001 28925 Table_map 1 28966 table_id: # (test.t1) +master-bin.000001 28966 Write_rows 1 29000 table_id: # flags: STMT_END_F +master-bin.000001 29000 Table_map 1 29041 table_id: # (test.t1) +master-bin.000001 29041 Write_rows 1 29075 table_id: # flags: STMT_END_F +master-bin.000001 29075 Table_map 1 29116 table_id: # (test.t1) +master-bin.000001 29116 Write_rows 1 29150 table_id: # flags: STMT_END_F +master-bin.000001 29150 Table_map 1 29191 table_id: # (test.t1) +master-bin.000001 29191 Write_rows 1 29225 table_id: # flags: STMT_END_F +master-bin.000001 29225 Table_map 1 29266 table_id: # (test.t1) +master-bin.000001 29266 Write_rows 1 29300 table_id: # flags: STMT_END_F +master-bin.000001 29300 Table_map 1 29341 table_id: # (test.t1) +master-bin.000001 29341 Write_rows 1 29375 table_id: # flags: STMT_END_F +master-bin.000001 29375 Table_map 1 29416 table_id: # (test.t1) +master-bin.000001 29416 Write_rows 1 29450 table_id: # flags: STMT_END_F +master-bin.000001 29450 Table_map 1 29491 table_id: # (test.t1) +master-bin.000001 29491 Write_rows 1 29525 table_id: # flags: STMT_END_F +master-bin.000001 29525 Table_map 1 29566 table_id: # (test.t1) +master-bin.000001 29566 Write_rows 1 29600 table_id: # flags: STMT_END_F +master-bin.000001 29600 Table_map 1 29641 table_id: # (test.t1) +master-bin.000001 29641 Write_rows 1 29675 table_id: # flags: STMT_END_F +master-bin.000001 29675 Table_map 1 29716 table_id: # (test.t1) +master-bin.000001 29716 Write_rows 1 29750 table_id: # flags: STMT_END_F +master-bin.000001 29750 Table_map 1 29791 table_id: # (test.t1) +master-bin.000001 29791 Write_rows 1 29825 table_id: # flags: STMT_END_F +master-bin.000001 29825 Table_map 1 29866 table_id: # (test.t1) +master-bin.000001 29866 Write_rows 1 29900 table_id: # flags: STMT_END_F +master-bin.000001 29900 Table_map 1 29941 table_id: # (test.t1) +master-bin.000001 29941 Write_rows 1 29975 table_id: # flags: STMT_END_F +master-bin.000001 29975 Table_map 1 30016 table_id: # (test.t1) +master-bin.000001 30016 Write_rows 1 30050 table_id: # flags: STMT_END_F +master-bin.000001 30050 Table_map 1 30091 table_id: # (test.t1) +master-bin.000001 30091 Write_rows 1 30125 table_id: # flags: STMT_END_F +master-bin.000001 30125 Table_map 1 30166 table_id: # (test.t1) +master-bin.000001 30166 Write_rows 1 30200 table_id: # flags: STMT_END_F +master-bin.000001 30200 Table_map 1 30241 table_id: # (test.t1) +master-bin.000001 30241 Write_rows 1 30275 table_id: # flags: STMT_END_F +master-bin.000001 30275 Xid 1 30302 COMMIT /* XID */ +master-bin.000001 30302 Rotate 1 30346 master-bin.000002;pos=4 drop table t1; set global binlog_cache_size=@bcs; set session autocommit = @ac; @@ -1289,14 +1306,14 @@ drop table if exists t3; create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 346 +master-bin.000001 347 insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); show master status /* must show new binlog index after rotating */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 106 +master-bin.000002 107 drop table t3; # # Bug #45998: database crashes when running "create as select" diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index d05d3ccdb7a..9df4164b138 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -36,7 +36,7 @@ create table t1 (n int) engine=innodb; begin; commit; drop table t1; -show binlog events in 'master-bin.000001' from 106; +show binlog events in 'master-bin.000001' from 107; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1 (n int) engine=innodb master-bin.000001 # Query 1 # BEGIN @@ -142,7 +142,7 @@ master-bin.000001 # Query 1 # use `test`; insert into t1 values(2 + 4) master-bin.000001 # Query 1 # use `test`; insert into t1 values(1 + 4) master-bin.000001 # Xid 1 # COMMIT /* xid= */ master-bin.000001 # Rotate 1 # master-bin.000002;pos=4 -show binlog events in 'master-bin.000002' from 106; +show binlog events in 'master-bin.000002' from 107; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000002 # Query 1 # use `test`; drop table t1 set @ac = @@autocommit; @@ -764,14 +764,14 @@ drop table if exists t3; create table t3 (a int(11) NOT NULL AUTO_INCREMENT, b text, PRIMARY KEY (a) ) engine=innodb; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 346 +master-bin.000001 347 insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); insert into t3(b) values ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); show master status /* must show new binlog index after rotating */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000002 106 +master-bin.000002 107 drop table t3; # # Bug #45998: database crashes when running "create as select" diff --git a/mysql-test/suite/binlog/t/binlog_innodb.test b/mysql-test/suite/binlog/t/binlog_innodb.test index f84fd65226a..4469fa6224c 100644 --- a/mysql-test/suite/binlog/t/binlog_innodb.test +++ b/mysql-test/suite/binlog/t/binlog_innodb.test @@ -155,7 +155,8 @@ reset master; UPDATE t2,t1 SET t2.a=t1.a+2; # check select * from t2 /* must be (3,1), (4,4) */; -show master status /* there must no UPDATE in binlog */; +--echo there must no UPDATE in binlog +source include/show_master_status.inc; # B. testing multi_update::send_error() execution branch delete from t1; @@ -165,7 +166,8 @@ insert into t2 values (1,2),(3,4),(4,4); reset master; --error ER_DUP_ENTRY UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; -show master status /* there must be no UPDATE query event */; +--echo there must no UPDATE in binlog +source include/show_master_status.inc; # cleanup bug#27716 drop table t1, t2; diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test index 9b30ec4a0db..d4aa91140cf 100644 --- a/mysql-test/suite/binlog/t/binlog_killed.test +++ b/mysql-test/suite/binlog/t/binlog_killed.test @@ -51,7 +51,7 @@ reap; let $rows= `select count(*) from t2 /* must be 2 or 0 */`; let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --force-if-open --start-position=134 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog +--exec $MYSQL_BINLOG --force-if-open --start-position=135 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog")) diff --git a/mysql-test/suite/binlog/t/binlog_killed_simulate.test b/mysql-test/suite/binlog/t/binlog_killed_simulate.test index ec61271ae88..f9240291dba 100644 --- a/mysql-test/suite/binlog/t/binlog_killed_simulate.test +++ b/mysql-test/suite/binlog/t/binlog_killed_simulate.test @@ -24,7 +24,7 @@ update t1 set a=2 /* will be "killed" after work has been done */; # for some constants like the offset of the first real event # that is different between severs versions. let $MYSQLD_DATADIR= `select @@datadir`; ---exec $MYSQL_BINLOG --force-if-open --start-position=106 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) @@ -52,7 +52,7 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil source include/show_binlog_events.inc; ---exec $MYSQL_BINLOG --force-if-open --start-position=98 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog +--exec $MYSQL_BINLOG --force-if-open --start-position=107 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval select (@a:=load_file("$MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog")) diff --git a/mysql-test/suite/rpl/r/rpl_binlog_grant.result b/mysql-test/suite/rpl/r/rpl_binlog_grant.result index 4a789f361c6..2a7e4401500 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_grant.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_grant.result @@ -17,16 +17,15 @@ show grants for x@y; Grants for x@y GRANT USAGE ON *.* TO 'x'@'y' GRANT SELECT ON `d1`.`t` TO 'x'@'y' -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 106 Query 1 193 drop database if exists d1 -master-bin.000001 193 Query 1 272 create database d1 -master-bin.000001 272 Query 1 370 use `d1`; create table t (s1 int) engine=innodb -master-bin.000001 370 Query 1 436 BEGIN -master-bin.000001 436 Query 1 521 use `d1`; insert into t values (1) -master-bin.000001 521 Xid 1 548 COMMIT /* XID */ -master-bin.000001 548 Query 1 633 use `d1`; grant select on t to x@y +master-bin.000001 # Query # # drop database if exists d1 +master-bin.000001 # Query # # create database d1 +master-bin.000001 # Query # # use `d1`; create table t (s1 int) engine=innodb +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `d1`; insert into t values (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `d1`; grant select on t to x@y start transaction; insert into t values (2); revoke select on t from x@y; @@ -38,19 +37,18 @@ s1 show grants for x@y; Grants for x@y GRANT USAGE ON *.* TO 'x'@'y' -show binlog events; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 106 Query 1 193 drop database if exists d1 -master-bin.000001 193 Query 1 272 create database d1 -master-bin.000001 272 Query 1 370 use `d1`; create table t (s1 int) engine=innodb -master-bin.000001 370 Query 1 436 BEGIN -master-bin.000001 436 Query 1 521 use `d1`; insert into t values (1) -master-bin.000001 521 Xid 1 548 COMMIT /* XID */ -master-bin.000001 548 Query 1 633 use `d1`; grant select on t to x@y -master-bin.000001 633 Query 1 699 BEGIN -master-bin.000001 699 Query 1 784 use `d1`; insert into t values (2) -master-bin.000001 784 Xid 1 811 COMMIT /* XID */ -master-bin.000001 811 Query 1 899 use `d1`; revoke select on t from x@y +master-bin.000001 # Query # # drop database if exists d1 +master-bin.000001 # Query # # create database d1 +master-bin.000001 # Query # # use `d1`; create table t (s1 int) engine=innodb +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `d1`; insert into t values (1) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `d1`; grant select on t to x@y +master-bin.000001 # Query # # BEGIN +master-bin.000001 # Query # # use `d1`; insert into t values (2) +master-bin.000001 # Xid # # COMMIT /* XID */ +master-bin.000001 # Query # # use `d1`; revoke select on t from x@y drop user x@y; drop database d1; diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result index 6c8d35619e5..9b54498d809 100644 --- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result @@ -157,7 +157,7 @@ SET @my_max_relay_log_size= @@global.max_relay_log_size; SET global max_relay_log_size=0; include/stop_slave.inc DELETE FROM t2; -CHANGE MASTER TO MASTER_LOG_POS=440; +CHANGE MASTER TO MASTER_LOG_POS=441; BEGIN; SELECT * FROM t1 FOR UPDATE; a diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result index e2ec78e7adc..fd208055bea 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result @@ -435,7 +435,7 @@ Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno 1364 -Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330 +Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 331 Skip_Counter 0 Exec_Master_Log_Pos # Relay_Log_Space # @@ -453,7 +453,7 @@ Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1364 -Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330 +Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 331 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Create t10 on slave *** diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result index ed5b4eac27d..e50caa8861e 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result @@ -435,7 +435,7 @@ Replicate_Ignore_Table # Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno 1364 -Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330 +Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 331 Skip_Counter 0 Exec_Master_Log_Pos # Relay_Log_Space # @@ -453,7 +453,7 @@ Master_SSL_Verify_Server_Cert No Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1364 -Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330 +Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 331 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Create t10 on slave *** diff --git a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result index 75180334c28..3055216cbd9 100644 --- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result +++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result @@ -33,7 +33,7 @@ Replicate_Wild_Ignore_Table Last_Errno 1105 Last_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10' Skip_Counter 0 -Exec_Master_Log_Pos 246 +Exec_Master_Log_Pos 247 Relay_Log_Space # Until_Condition None Until_Log_File @@ -120,7 +120,7 @@ FROM t2 ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c' Skip_Counter 0 -Exec_Master_Log_Pos 1278 +Exec_Master_Log_Pos 1279 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result index d7a02bc84a5..141bbaeb95e 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata.result @@ -34,9 +34,45 @@ insert into t1 values(1,10); load data infile '../../std_data/rpl_loaddata.dat' into table t1; set global sql_slave_skip_counter=1; start slave; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1797 # # master-bin.000001 Yes Yes # 0 0 1797 # None 0 No # No 0 0 +show slave status;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 1798 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 1798 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error set sql_log_bin=0; delete from t1; set sql_log_bin=1; @@ -44,9 +80,45 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1; stop slave; change master to master_user='test'; change master to master_user='root'; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error -# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1832 # # master-bin.000001 No No # 0 0 1832 # None 0 No # No 0 0 +show slave status;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 1833 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 1833 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; @@ -55,9 +127,45 @@ set sql_log_bin=1; load data infile '../../std_data/rpl_loaddata.dat' into table t1; stop slave; reset slave; -show slave status; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error -# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No 0 0 +show slave status;; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File +Read_Master_Log_Pos 4 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File +Slave_IO_Running No +Slave_SQL_Running No +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 0 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno 0 +Last_IO_Error +Last_SQL_Errno 0 +Last_SQL_Error reset master; create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), unique(day)) engine=MyISAM; diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result index 27fb8623e85..cb2accc86ca 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result @@ -13,7 +13,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 290 +Read_Master_Log_Pos 291 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -28,7 +28,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 290 +Exec_Master_Log_Pos 291 Relay_Log_Space # Until_Condition None Until_Log_File @@ -53,7 +53,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 465 +Read_Master_Log_Pos 466 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -68,7 +68,7 @@ Replicate_Wild_Ignore_Table Last_Errno 1593 Last_Error Fatal error: Not enough memory Skip_Counter 0 -Exec_Master_Log_Pos 325 +Exec_Master_Log_Pos 326 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result index 2e707fb62c1..59726ea5661 100644 --- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result +++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result @@ -31,7 +31,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 594 +Read_Master_Log_Pos 595 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -46,7 +46,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 594 +Exec_Master_Log_Pos 595 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result index 7920b9a981d..27960be8054 100644 --- a/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result +++ b/mysql-test/suite/rpl/r/rpl_row_basic_11bugs.result @@ -58,12 +58,12 @@ DELETE FROM t1 WHERE a = 0; UPDATE t1 SET a=99 WHERE a = 0; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a INT) -master-bin.000001 192 Query 1 260 BEGIN -master-bin.000001 260 Table_map 1 301 table_id: # (test.t1) -master-bin.000001 301 Write_rows 1 340 table_id: # flags: STMT_END_F -master-bin.000001 340 Query 1 409 COMMIT +master-bin.000001 4 Format_desc 1 107 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 107 Query 1 193 use `test`; CREATE TABLE t1 (a INT) +master-bin.000001 193 Query 1 261 BEGIN +master-bin.000001 261 Table_map 1 302 table_id: # (test.t1) +master-bin.000001 302 Write_rows 1 341 table_id: # flags: STMT_END_F +master-bin.000001 341 Query 1 410 COMMIT DROP TABLE t1; ================ Test for BUG#17620 ================ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; diff --git a/mysql-test/suite/rpl/r/rpl_row_conflicts.result b/mysql-test/suite/rpl/r/rpl_row_conflicts.result index 0f15bfc7156..6f98c25c335 100644 --- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result +++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result @@ -24,7 +24,7 @@ a 1 [on slave] ---- Wait until slave stops with an error ---- -Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 346 (expected "duplicate key" error) +Last_SQL_Error = Could not execute Write_rows event on table test.t1; Duplicate entry '1' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 347 (expected "duplicate key" error) SELECT * FROM t1; a 1 @@ -50,7 +50,7 @@ SELECT * FROM t1; a [on slave] ---- Wait until slave stops with an error ---- -Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 982 (expected "can't find record" error) +Last_SQL_Error = Could not execute Delete_rows event on table test.t1; Can't find record in 't1', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log master-bin.000001, end_log_pos 983 (expected "can't find record" error) SELECT * FROM t1; a ---- Resolve the conflict on the slave and restart SQL thread ---- diff --git a/mysql-test/suite/rpl/r/rpl_row_create_table.result b/mysql-test/suite/rpl/r/rpl_row_create_table.result index 5bed9106009..acee168baf2 100644 --- a/mysql-test/suite/rpl/r/rpl_row_create_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_create_table.result @@ -13,30 +13,30 @@ CREATE TABLE t1 (a INT, b INT); CREATE TABLE t2 (a INT, b INT) ENGINE=Merge; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; Log_name # -Pos 106 +Pos 107 Event_type Query Server_id # -End_log_pos 199 +End_log_pos 200 Info use `test`; CREATE TABLE t1 (a INT, b INT) Log_name # -Pos 199 +Pos 200 Event_type Query Server_id # -End_log_pos 305 +End_log_pos 306 Info use `test`; CREATE TABLE t2 (a INT, b INT) ENGINE=Merge Log_name # -Pos 305 +Pos 306 Event_type Query Server_id # -End_log_pos 411 +End_log_pos 412 Info use `test`; CREATE TABLE t3 (a INT, b INT) CHARSET=utf8 Log_name # -Pos 411 +Pos 412 Event_type Query Server_id # -End_log_pos 530 +End_log_pos 531 Info use `test`; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8 **** On Master **** SHOW CREATE TABLE t1; @@ -137,7 +137,7 @@ RESET MASTER; include/start_slave.inc CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; ERROR 23000: Duplicate entry '2' for key 'b' -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; Log_name Pos Event_type Server_id End_log_pos Info CREATE TABLE t7 (a INT, b INT UNIQUE); INSERT INTO t7 SELECT a,b FROM tt3; @@ -147,13 +147,13 @@ a b 1 2 2 4 3 6 -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; Log_name Pos Event_type Server_id End_log_pos Info -# 106 Query # 206 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) -# 206 Query # 274 BEGIN -# 274 Table_map # 316 table_id: # (test.t7) -# 316 Write_rows # 372 table_id: # flags: STMT_END_F -# 372 Query # 443 ROLLBACK +# 107 Query # 207 use `test`; CREATE TABLE t7 (a INT, b INT UNIQUE) +# 207 Query # 275 BEGIN +# 275 Table_map # 317 table_id: # (test.t7) +# 317 Write_rows # 373 table_id: # flags: STMT_END_F +# 373 Query # 444 ROLLBACK SELECT * FROM t7 ORDER BY a,b; a b 1 2 @@ -171,12 +171,12 @@ INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; Log_name Pos Event_type Server_id End_log_pos Info -# 106 Query # 174 BEGIN -# 174 Table_map # 216 table_id: # (test.t7) -# 216 Write_rows # 272 table_id: # flags: STMT_END_F -# 272 Query # 343 ROLLBACK +# 107 Query # 175 BEGIN +# 175 Table_map # 217 table_id: # (test.t7) +# 217 Write_rows # 273 table_id: # flags: STMT_END_F +# 273 Query # 344 ROLLBACK SELECT * FROM t7 ORDER BY a,b; a b 1 2 @@ -216,10 +216,10 @@ Create Table CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; Log_name Pos Event_type Server_id End_log_pos Info -# 106 Query # 192 use `test`; CREATE TABLE t8 LIKE t4 -# 192 Query # 331 use `test`; CREATE TABLE `t9` ( +# 107 Query # 193 use `test`; CREATE TABLE t8 LIKE t4 +# 193 Query # 332 use `test`; CREATE TABLE `t9` ( `a` int(11) DEFAULT NULL, `b` int(11) DEFAULT NULL ) @@ -296,38 +296,38 @@ a 1 2 3 -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; Log_name Pos Event_type Server_id End_log_pos Info -# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT) -# 192 Query # 260 BEGIN -# 260 Table_map # 301 table_id: # (test.t1) -# 301 Write_rows # 345 table_id: # flags: STMT_END_F -# 345 Query # 414 COMMIT -# 414 Query # 482 BEGIN -# 482 Query # 607 use `test`; CREATE TABLE `t2` ( +# 107 Query # 193 use `test`; CREATE TABLE t1 (a INT) +# 193 Query # 261 BEGIN +# 261 Table_map # 302 table_id: # (test.t1) +# 302 Write_rows # 346 table_id: # flags: STMT_END_F +# 346 Query # 415 COMMIT +# 415 Query # 483 BEGIN +# 483 Query # 608 use `test`; CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB -# 607 Table_map # 648 table_id: # (test.t2) -# 648 Write_rows # 692 table_id: # flags: STMT_END_F -# 692 Xid # 719 COMMIT /* XID */ -# 719 Query # 787 BEGIN -# 787 Query # 912 use `test`; CREATE TABLE `t3` ( +# 608 Table_map # 649 table_id: # (test.t2) +# 649 Write_rows # 693 table_id: # flags: STMT_END_F +# 693 Xid # 720 COMMIT /* XID */ +# 720 Query # 788 BEGIN +# 788 Query # 913 use `test`; CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB -# 912 Table_map # 953 table_id: # (test.t3) -# 953 Write_rows # 997 table_id: # flags: STMT_END_F -# 997 Xid # 1024 COMMIT /* XID */ -# 1024 Query # 1092 BEGIN -# 1092 Query # 1217 use `test`; CREATE TABLE `t4` ( +# 913 Table_map # 954 table_id: # (test.t3) +# 954 Write_rows # 998 table_id: # flags: STMT_END_F +# 998 Xid # 1025 COMMIT /* XID */ +# 1025 Query # 1093 BEGIN +# 1093 Query # 1218 use `test`; CREATE TABLE `t4` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB -# 1217 Table_map # 1258 table_id: # (test.t4) -# 1258 Write_rows # 1302 table_id: # flags: STMT_END_F -# 1302 Xid # 1329 COMMIT /* XID */ -# 1329 Query # 1397 BEGIN -# 1397 Table_map # 1438 table_id: # (test.t1) -# 1438 Write_rows # 1482 table_id: # flags: STMT_END_F -# 1482 Query # 1553 ROLLBACK +# 1218 Table_map # 1259 table_id: # (test.t4) +# 1259 Write_rows # 1303 table_id: # flags: STMT_END_F +# 1303 Xid # 1330 COMMIT /* XID */ +# 1330 Query # 1398 BEGIN +# 1398 Table_map # 1439 table_id: # (test.t1) +# 1439 Write_rows # 1483 table_id: # flags: STMT_END_F +# 1483 Query # 1554 ROLLBACK SHOW TABLES; Tables_in_test t1 @@ -390,20 +390,20 @@ a 4 6 9 -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; Log_name Pos Event_type Server_id End_log_pos Info -# 106 Query # 192 use `test`; CREATE TABLE t1 (a INT) -# 192 Query # 260 BEGIN -# 260 Table_map # 301 table_id: # (test.t1) -# 301 Write_rows # 345 table_id: # flags: STMT_END_F -# 345 Query # 414 COMMIT -# 414 Query # 514 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB -# 514 Query # 582 BEGIN -# 582 Table_map # 623 table_id: # (test.t2) -# 623 Write_rows # 667 table_id: # flags: STMT_END_F -# 667 Table_map # 708 table_id: # (test.t2) -# 708 Write_rows # 747 table_id: # flags: STMT_END_F -# 747 Xid # 774 COMMIT /* XID */ +# 107 Query # 193 use `test`; CREATE TABLE t1 (a INT) +# 193 Query # 261 BEGIN +# 261 Table_map # 302 table_id: # (test.t1) +# 302 Write_rows # 346 table_id: # flags: STMT_END_F +# 346 Query # 415 COMMIT +# 415 Query # 515 use `test`; CREATE TABLE t2 (a INT) ENGINE=INNODB +# 515 Query # 583 BEGIN +# 583 Table_map # 624 table_id: # (test.t2) +# 624 Write_rows # 668 table_id: # flags: STMT_END_F +# 668 Table_map # 709 table_id: # (test.t2) +# 709 Write_rows # 748 table_id: # flags: STMT_END_F +# 748 Xid # 775 COMMIT /* XID */ SELECT * FROM t2 ORDER BY a; a 1 @@ -429,14 +429,14 @@ Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back SELECT * FROM t2 ORDER BY a; a -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; Log_name Pos Event_type Server_id End_log_pos Info -# 106 Query # 174 BEGIN -# 174 Table_map # 215 table_id: # (test.t2) -# 215 Write_rows # 259 table_id: # flags: STMT_END_F -# 259 Table_map # 300 table_id: # (test.t2) -# 300 Write_rows # 339 table_id: # flags: STMT_END_F -# 339 Query # 410 ROLLBACK +# 107 Query # 175 BEGIN +# 175 Table_map # 216 table_id: # (test.t2) +# 216 Write_rows # 260 table_id: # flags: STMT_END_F +# 260 Table_map # 301 table_id: # (test.t2) +# 301 Write_rows # 340 table_id: # flags: STMT_END_F +# 340 Query # 411 ROLLBACK SELECT * FROM t2 ORDER BY a; a DROP TABLE t1,t2; diff --git a/mysql-test/suite/rpl/r/rpl_row_drop.result b/mysql-test/suite/rpl/r/rpl_row_drop.result index 89654ebf165..f1a350b3df0 100644 --- a/mysql-test/suite/rpl/r/rpl_row_drop.result +++ b/mysql-test/suite/rpl/r/rpl_row_drop.result @@ -43,10 +43,10 @@ t2 DROP TABLE t1,t2; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: VERSION, Binlog ver: 4 -master-bin.000001 106 Query 1 192 use `test`; CREATE TABLE t1 (a int) -master-bin.000001 192 Query 1 278 use `test`; CREATE TABLE t2 (a int) -master-bin.000001 278 Query 1 382 use `test`; DROP TABLE `t1` /* generated by server */ +master-bin.000001 4 Format_desc 1 107 Server ver: VERSION, Binlog ver: 4 +master-bin.000001 107 Query 1 193 use `test`; CREATE TABLE t1 (a int) +master-bin.000001 193 Query 1 279 use `test`; CREATE TABLE t2 (a int) +master-bin.000001 279 Query 1 383 use `test`; DROP TABLE `t1` /* generated by server */ SHOW TABLES; Tables_in_test t2 diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result index 129bad0fbcc..384573c0461 100644 --- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result @@ -12,13 +12,13 @@ create table t4 (a int); insert into t4 select * from t3; rename table t1 to t5, t2 to t1; flush no_write_to_binlog tables; -SHOW BINLOG EVENTS FROM 897 ; +SHOW BINLOG EVENTS FROM 898 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1 select * from t3; a flush tables; -SHOW BINLOG EVENTS FROM 897 ; +SHOW BINLOG EVENTS FROM 898 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1 master-bin.000001 # Query 1 # use `test`; flush tables diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result index 9593b009d1f..ca8fba3b6bd 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log.result +++ b/mysql-test/suite/rpl/r/rpl_row_log.result @@ -30,14 +30,14 @@ master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # COMMIT -show binlog events from 106 limit 1; +show binlog events from 107 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -show binlog events from 106 limit 2; +show binlog events from 107 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Query 1 # BEGIN -show binlog events from 106 limit 2,1; +show binlog events from 107 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Table_map 1 # table_id: # (test.t1) flush logs; @@ -251,7 +251,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000002 -Read_Master_Log_Pos 516 +Read_Master_Log_Pos 517 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000002 @@ -266,7 +266,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 516 +Exec_Master_Log_Pos 517 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result index 8526bad558b..9347f87ef8f 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result @@ -30,14 +30,14 @@ master-bin.000001 # Query 1 # BEGIN master-bin.000001 # Table_map 1 # table_id: # (test.t1) master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Xid 1 # COMMIT /* XID */ -show binlog events from 106 limit 1; +show binlog events from 107 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB -show binlog events from 106 limit 2; +show binlog events from 107 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=InnoDB master-bin.000001 # Query 1 # BEGIN -show binlog events from 106 limit 2,1; +show binlog events from 107 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Table_map 1 # table_id: # (test.t1) flush logs; @@ -251,7 +251,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000002 -Read_Master_Log_Pos 474 +Read_Master_Log_Pos 475 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000002 @@ -266,7 +266,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 474 +Exec_Master_Log_Pos 475 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result index 6148de5d954..41076f9fee3 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_skip.result +++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result @@ -50,7 +50,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 1115 +Read_Master_Log_Pos 1116 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -65,7 +65,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 762 +Exec_Master_Log_Pos 763 Relay_Log_Space # Until_Condition Master Until_Log_File master-bin.000001 @@ -114,7 +114,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000001 -Read_Master_Log_Pos 248 +Read_Master_Log_Pos 249 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000001 @@ -129,7 +129,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 248 +Exec_Master_Log_Pos 249 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result index 90a362c352b..e2946bb487a 100644 --- a/mysql-test/suite/rpl/r/rpl_sp.result +++ b/mysql-test/suite/rpl/r/rpl_sp.result @@ -409,110 +409,110 @@ return 0; end| use mysqltest; set @a:= mysqltest2.f1(); -show binlog events in 'master-bin.000001' from 106; +show binlog events from ; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query 1 # drop database if exists mysqltest1 -master-bin.000001 # Query 1 # create database mysqltest1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a varchar(100)) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() +master-bin.000001 # Query # # drop database if exists mysqltest1 +master-bin.000001 # Query # # create database mysqltest1 +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a varchar(100)) +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() begin declare b int; set b = 8; insert into t1 values (b); insert into t1 values (unix_timestamp()); end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (unix_timestamp()) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`() +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values ( NAME_CONST('b',8)) +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (unix_timestamp()) +master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo2`() select * from mysqltest1.t1 -master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo2 contains sql -master-bin.000001 # Query 1 # use `mysqltest1`; drop table t1 -master-bin.000001 # Query 1 # use `mysqltest1`; create table t1 (a int) -master-bin.000001 # Query 1 # use `mysqltest1`; create table t2 like t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`() +master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo2 contains sql +master-bin.000001 # Query # # use `mysqltest1`; drop table t1 +master-bin.000001 # Query # # use `mysqltest1`; create table t1 (a int) +master-bin.000001 # Query # # use `mysqltest1`; create table t2 like t1 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo3`() DETERMINISTIC insert into t1 values (15) -master-bin.000001 # Query 1 # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`() +master-bin.000001 # Query # # use `mysqltest1`; grant CREATE ROUTINE, EXECUTE on mysqltest1.* to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query # # use `mysqltest1`; grant SELECT on mysqltest1.t1 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query # # use `mysqltest1`; grant SELECT, INSERT on mysqltest1.t2 to "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` PROCEDURE `foo4`() DETERMINISTIC begin insert into t2 values(3); insert into t1 values (5); end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (15) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; alter procedure foo4 sql security invoker -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(3) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (5) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`() +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (15) +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query # # use `mysqltest1`; alter procedure foo4 sql security invoker +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(3) +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (5) +master-bin.000001 # Query # # use `mysqltest1`; delete from t2 +master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo4`() DETERMINISTIC begin insert into t2 values(20),(20); end -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(20),(20) -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo4 -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo2 -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo3 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(20),(20) +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo4 +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo2 +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo3 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) DETERMINISTIC begin insert into t1 values (x); return x+2; end -master-bin.000001 # Query 1 # use `mysqltest1`; delete t1,t2 from t1,t2 -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t2 values(fn1(21)) -master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11) +master-bin.000001 # Query # # use `mysqltest1`; delete t1,t2 from t1,t2 +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) +master-bin.000001 # Query # # use `mysqltest1`; insert into t2 values(fn1(21)) +master-bin.000001 # Query # # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`() RETURNS int(11) NO SQL begin return unix_timestamp(); end -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values(fn1()) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) +master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values(fn1()) +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`zedjzlcsjhd`@`127.0.0.1` FUNCTION `fn2`() RETURNS int(11) NO SQL begin return unix_timestamp(); end -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11) +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS int(11) READS SQL DATA begin return 0; end -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t2 -master-bin.000001 # Query 1 # use `mysqltest1`; alter table t2 add unique (a) -master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) +master-bin.000001 # Query # # use `mysqltest1`; delete from t2 +master-bin.000001 # Query # # use `mysqltest1`; alter table t2 add unique (a) +master-bin.000001 # Query # # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` FUNCTION `fn1`(x int) RETURNS int(11) begin insert into t2 values(x),(x); return 10; end -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100) -master-bin.000001 # Query 1 # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) -master-bin.000001 # Query 1 # use `mysqltest1`; delete from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; drop trigger trg -master-bin.000001 # Query 1 # use `mysqltest1`; insert into t1 values (1) -master-bin.000001 # Query 1 # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(100) +master-bin.000001 # Query # # use `mysqltest1`; SELECT `mysqltest1`.`fn1`(20) +master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` trigger trg before insert on t1 for each row set new.a= 10 +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Query # # use `mysqltest1`; delete from t1 +master-bin.000001 # Query # # use `mysqltest1`; drop trigger trg +master-bin.000001 # Query # # use `mysqltest1`; insert into t1 values (1) +master-bin.000001 # Query # # use `mysqltest1`; CREATE DEFINER=`root`@`localhost` PROCEDURE `foo`() READS SQL DATA select * from t1 -master-bin.000001 # Query 1 # use `mysqltest1`; drop procedure foo -master-bin.000001 # Query 1 # use `mysqltest1`; drop function fn1 -master-bin.000001 # Query 1 # drop database mysqltest1 -master-bin.000001 # Query 1 # drop user "zedjzlcsjhd"@127.0.0.1 -master-bin.000001 # Query 1 # use `test`; drop function if exists f1 -master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +master-bin.000001 # Query # # use `mysqltest1`; drop procedure foo +master-bin.000001 # Query # # use `mysqltest1`; drop function fn1 +master-bin.000001 # Query # # drop database mysqltest1 +master-bin.000001 # Query # # drop user "zedjzlcsjhd"@127.0.0.1 +master-bin.000001 # Query # # use `test`; drop function if exists f1 +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) READS SQL DATA begin declare var integer; @@ -522,41 +522,41 @@ fetch c into var; close c; return var; end -master-bin.000001 # Query 1 # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a -master-bin.000001 # Query 1 # use `test`; create table t1 (a int) -master-bin.000001 # Query 1 # use `test`; insert into t1 (a) values (f1()) -master-bin.000001 # Query 1 # use `test`; drop view v1 -master-bin.000001 # Query 1 # use `test`; drop function f1 -master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1 -master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS t1 -master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1(col VARCHAR(10)) -master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10)) +master-bin.000001 # Query # # use `test`; CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 as a +master-bin.000001 # Query # # use `test`; create table t1 (a int) +master-bin.000001 # Query # # use `test`; insert into t1 (a) values (f1()) +master-bin.000001 # Query # # use `test`; drop view v1 +master-bin.000001 # Query # # use `test`; drop function f1 +master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1 +master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS t1 +master-bin.000001 # Query # # use `test`; CREATE TABLE t1(col VARCHAR(10)) +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`(arg VARCHAR(10)) INSERT INTO t1 VALUES(arg) -master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci')) -master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1 -master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE IF EXISTS p1 -master-bin.000001 # Query 1 # use `test`; DROP FUNCTION IF EXISTS f1 -master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +master-bin.000001 # Query # # use `test`; INSERT INTO t1 VALUES( NAME_CONST('arg',_latin1'test' COLLATE 'latin1_swedish_ci')) +master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1 +master-bin.000001 # Query # # use `test`; DROP PROCEDURE IF EXISTS p1 +master-bin.000001 # Query # # use `test`; DROP FUNCTION IF EXISTS f1 +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() SET @a = 1 -master-bin.000001 # Query 1 # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) RETURN 0 -master-bin.000001 # Query 1 # use `test`; DROP PROCEDURE p1 -master-bin.000001 # Query 1 # use `test`; DROP FUNCTION f1 -master-bin.000001 # Query 1 # use `test`; drop table t1 -master-bin.000001 # Query 1 # drop database if exists mysqltest -master-bin.000001 # Query 1 # drop database if exists mysqltest2 -master-bin.000001 # Query 1 # create database mysqltest -master-bin.000001 # Query 1 # create database mysqltest2 -master-bin.000001 # Query 1 # use `mysqltest2`; create table t ( t integer ) -master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`() +master-bin.000001 # Query # # use `test`; DROP PROCEDURE p1 +master-bin.000001 # Query # # use `test`; DROP FUNCTION f1 +master-bin.000001 # Query # # use `test`; drop table t1 +master-bin.000001 # Query # # drop database if exists mysqltest +master-bin.000001 # Query # # drop database if exists mysqltest2 +master-bin.000001 # Query # # create database mysqltest +master-bin.000001 # Query # # create database mysqltest2 +master-bin.000001 # Query # # use `mysqltest2`; create table t ( t integer ) +master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` PROCEDURE `mysqltest`.`test`() begin end -master-bin.000001 # Query 1 # use `mysqltest2`; insert into t values ( 1 ) -master-bin.000001 # Query 1 # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +master-bin.000001 # Query # # use `mysqltest2`; insert into t values ( 1 ) +master-bin.000001 # Query # # use `mysqltest2`; CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) begin insert into t values (1); return 0; end -master-bin.000001 # Query 1 # use `mysqltest`; SELECT `mysqltest2`.`f1`() +master-bin.000001 # Query # # use `mysqltest`; SELECT `mysqltest2`.`f1`() set @@global.log_bin_trust_routine_creators= @old_log_bin_trust_routine_creators; Warnings: Warning 1287 The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 6.0. Please use '@@log_bin_trust_function_creators' instead diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result index 74031af1dde..1f6c86768b5 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result +++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result @@ -12,13 +12,13 @@ create table t4 (a int); insert into t4 select * from t3; rename table t1 to t5, t2 to t1; flush no_write_to_binlog tables; -SHOW BINLOG EVENTS FROM 656 ; +SHOW BINLOG EVENTS FROM 657 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1 select * from t3; a flush tables; -SHOW BINLOG EVENTS FROM 656 ; +SHOW BINLOG EVENTS FROM 657 ; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; rename table t1 to t5, t2 to t1 master-bin.000001 # Query 1 # use `test`; flush tables diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index bcefc6f9d3d..61eba2b4b3f 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -26,14 +26,14 @@ master-bin.000001 # Query 1 # use `test`; drop table t1 master-bin.000001 # Query 1 # use `test`; create table t1 (word char(20) not null)ENGINE=MyISAM master-bin.000001 # Begin_load_query 1 # ;file_id=1;block_len=581 master-bin.000001 # Execute_load_query 1 # use `test`; load data infile '../../std_data/words.dat' into table t1 ignore 1 lines ;file_id=1 -show binlog events from 106 limit 1; +show binlog events from 107 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM -show binlog events from 106 limit 2; +show binlog events from 107 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=MyISAM master-bin.000001 # Intvar 1 # INSERT_ID=1 -show binlog events from 106 limit 2,1; +show binlog events from 107 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; insert into t1 values (NULL) flush logs; @@ -233,7 +233,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000002 -Read_Master_Log_Pos 392 +Read_Master_Log_Pos 393 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000002 @@ -248,7 +248,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 392 +Exec_Master_Log_Pos 393 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/suite/rpl/t/rpl_binlog_grant.test b/mysql-test/suite/rpl/t/rpl_binlog_grant.test index 31163927ce2..da14b45d5c3 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_grant.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_grant.test @@ -25,9 +25,7 @@ grant select on t to x@y; # rollback; show grants for x@y; ---replace_result $VERSION VERSION ---replace_regex /\/\* xid=.* \*\//\/* XID *\// -show binlog events; +source include/show_binlog_events.inc; start transaction; insert into t values (2); revoke select on t from x@y; @@ -37,9 +35,7 @@ revoke select on t from x@y; commit; select * from t; show grants for x@y; ---replace_result $VERSION VERSION ---replace_regex /\/\* xid=.* \*\//\/* XID *\// -show binlog events; +source include/show_binlog_events.inc; drop user x@y; drop database d1; --sync_slave_with_master diff --git a/mysql-test/suite/rpl/t/rpl_row_create_table.test b/mysql-test/suite/rpl/t/rpl_row_create_table.test index 319f9546a81..0d91d855a57 100644 --- a/mysql-test/suite/rpl/t/rpl_row_create_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_create_table.test @@ -38,7 +38,7 @@ CREATE TABLE t3 (a INT, b INT) CHARSET=utf8; CREATE TABLE t4 (a INT, b INT) ENGINE=Merge CHARSET=utf8; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ ---query_vertical SHOW BINLOG EVENTS FROM 106 +--query_vertical SHOW BINLOG EVENTS FROM 107 --echo **** On Master **** --query_vertical SHOW CREATE TABLE t1 --query_vertical SHOW CREATE TABLE t2 @@ -76,7 +76,7 @@ CREATE TABLE t7 (UNIQUE(b)) SELECT a,b FROM tt3; # Shouldn't be written to the binary log --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; # Test that INSERT-SELECT works the same way as for SBR. CREATE TABLE t7 (a INT, b INT UNIQUE); @@ -86,7 +86,7 @@ SELECT * FROM t7 ORDER BY a,b; # Should be written to the binary log --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; @@ -100,7 +100,7 @@ INSERT INTO t7 SELECT a,b FROM tt4; ROLLBACK; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; SELECT * FROM t7 ORDER BY a,b; sync_slave_with_master; SELECT * FROM t7 ORDER BY a,b; @@ -118,7 +118,7 @@ CREATE TEMPORARY TABLE tt7 SELECT 1; --query_vertical SHOW CREATE TABLE t9 --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; sync_slave_with_master; --echo **** On Slave **** --query_vertical SHOW CREATE TABLE t8 @@ -170,7 +170,7 @@ SELECT * FROM t3 ORDER BY a; SELECT * FROM t4 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; sync_slave_with_master; SHOW TABLES; SELECT TABLE_NAME,ENGINE @@ -216,7 +216,7 @@ COMMIT; SELECT * FROM t2 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; sync_slave_with_master; SELECT * FROM t2 ORDER BY a; @@ -239,7 +239,7 @@ ROLLBACK; SELECT * FROM t2 ORDER BY a; --replace_column 1 # 4 # --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ -SHOW BINLOG EVENTS FROM 106; +SHOW BINLOG EVENTS FROM 107; sync_slave_with_master; SELECT * FROM t2 ORDER BY a; diff --git a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test index 667e1d9a1a8..d2996bbe525 100644 --- a/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test @@ -1,7 +1,7 @@ # depends on the binlog output -- source include/have_binlog_format_row.inc -let $rename_event_pos= 897; +let $rename_event_pos= 898; # Bug#18326: Do not lock table for writing during prepare of statement # The use of the ps protocol causes extra table maps in the binlog, so diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test index 3328d582692..a7967f6643a 100644 --- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test +++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test @@ -164,13 +164,13 @@ remove_file $MYSQLTEST_VARDIR/tmp/master.sql; # this test for position option -# By setting this position to 416, we should only get the create of t3 +# By setting this position to 417, we should only get the create of t3 --disable_query_log select "--- Test 2 position test --" as ""; --enable_query_log let $MYSQLD_DATADIR= `select @@datadir;`; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=416 --stop-position=569 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=417 --stop-position=570 $MYSQLD_DATADIR/master-bin.000001 # These are tests for remote binlog. # They should return the same as previous test. @@ -181,7 +181,7 @@ select "--- Test 3 First Remote test --" as ""; # This is broken now --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=569 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=570 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 # This part is disabled due to bug #17654 @@ -272,7 +272,7 @@ let $MYSQLD_DATADIR= `select @@datadir;`; select "--- Test 7 reading stdin w/position --" as ""; --enable_query_log --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL_BINLOG --short-form --position=416 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --position=417 --stop-position=569 - < $MYSQLD_DATADIR/master-bin.000001 # Bug#16217 (mysql client did not know how not switch its internal charset) --disable_query_log diff --git a/mysql-test/suite/rpl/t/rpl_sp.test b/mysql-test/suite/rpl/t/rpl_sp.test index 9be630e9ae8..2811db8ef1e 100644 --- a/mysql-test/suite/rpl/t/rpl_sp.test +++ b/mysql-test/suite/rpl/t/rpl_sp.test @@ -568,9 +568,7 @@ connection master; # Final inspection which verifies how all statements of this test file # were written to the binary log. ---replace_column 2 # 5 # ---replace_regex /table_id: [0-9]+/table_id: #/ -show binlog events in 'master-bin.000001' from 106; +source include/show_binlog_events.inc; # Restore log_bin_trust_function_creators to its original value. diff --git a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test index a8a33d05e8b..f3993f80b90 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test +++ b/mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test @@ -1,7 +1,7 @@ # depends on the binlog output --source include/have_binlog_format_mixed_or_statement.inc -let $rename_event_pos= 656; +let $rename_event_pos= 657; -- source extra/rpl_tests/rpl_flsh_tbls.test # End of 4.1 tests diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result index 540c430e757..86752fbc4b8 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result @@ -34,14 +34,14 @@ master-bin.000001 # Table_map 1 # table_id: # (mysql.ndb_apply_status) master-bin.000001 # Write_rows 1 # table_id: # master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F master-bin.000001 # Query 1 # COMMIT -show binlog events from 106 limit 1; +show binlog events from 107 limit 1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB -show binlog events from 106 limit 2; +show binlog events from 107 limit 2; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Query 1 # use `test`; create table t1(n int not null auto_increment primary key)ENGINE=NDB master-bin.000001 # Query 1 # BEGIN -show binlog events from 106 limit 2,1; +show binlog events from 107 limit 2,1; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Table_map 1 # table_id: # (test.t1) flush logs; @@ -267,7 +267,7 @@ Master_User root Master_Port MASTER_PORT Connect_Retry 1 Master_Log_File master-bin.000002 -Read_Master_Log_Pos 623 +Read_Master_Log_Pos 624 Relay_Log_File # Relay_Log_Pos # Relay_Master_Log_File master-bin.000002 @@ -282,7 +282,7 @@ Replicate_Wild_Ignore_Table Last_Errno 0 Last_Error Skip_Counter 0 -Exec_Master_Log_Pos 623 +Exec_Master_Log_Pos 624 Relay_Log_Space # Until_Condition None Until_Log_File diff --git a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result index d6c57aed41b..6c9e20fd56a 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_truncate_7ndb.result @@ -29,16 +29,16 @@ a b DROP TABLE t1; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 223 Query 1 287 BEGIN -master-bin.000001 287 Table_map 1 330 table_id: # (test.t1) -master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status) -master-bin.000001 392 Write_rows 1 451 table_id: # -master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F -master-bin.000001 498 Query 1 563 COMMIT -master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1 -master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1 +master-bin.000001 4 Format_desc 1 107 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 107 Query 1 224 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 224 Query 1 288 BEGIN +master-bin.000001 288 Table_map 1 331 table_id: # (test.t1) +master-bin.000001 331 Table_map 1 393 table_id: # (mysql.ndb_apply_status) +master-bin.000001 393 Write_rows 1 452 table_id: # +master-bin.000001 452 Write_rows 1 499 table_id: # flags: STMT_END_F +master-bin.000001 499 Query 1 564 COMMIT +master-bin.000001 564 Query 1 644 use `test`; TRUNCATE TABLE t1 +master-bin.000001 644 Query 1 720 use `test`; DROP TABLE t1 **** On Master **** CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB; INSERT INTO t1 VALUES (1,1), (2,2); @@ -65,27 +65,27 @@ a b DROP TABLE t1; SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: SERVER_VERSION, Binlog ver: 4 -master-bin.000001 106 Query 1 223 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 223 Query 1 287 BEGIN -master-bin.000001 287 Table_map 1 330 table_id: # (test.t1) -master-bin.000001 330 Table_map 1 392 table_id: # (mysql.ndb_apply_status) -master-bin.000001 392 Write_rows 1 451 table_id: # -master-bin.000001 451 Write_rows 1 498 table_id: # flags: STMT_END_F -master-bin.000001 498 Query 1 563 COMMIT -master-bin.000001 563 Query 1 643 use `test`; TRUNCATE TABLE t1 -master-bin.000001 643 Query 1 719 use `test`; DROP TABLE t1 -master-bin.000001 719 Query 1 836 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB -master-bin.000001 836 Query 1 900 BEGIN -master-bin.000001 900 Table_map 1 943 table_id: # (test.t1) -master-bin.000001 943 Table_map 1 1005 table_id: # (mysql.ndb_apply_status) -master-bin.000001 1005 Write_rows 1 1064 table_id: # -master-bin.000001 1064 Write_rows 1 1111 table_id: # flags: STMT_END_F -master-bin.000001 1111 Query 1 1176 COMMIT -master-bin.000001 1176 Query 1 1240 BEGIN -master-bin.000001 1240 Table_map 1 1283 table_id: # (test.t1) -master-bin.000001 1283 Table_map 1 1345 table_id: # (mysql.ndb_apply_status) -master-bin.000001 1345 Write_rows 1 1404 table_id: # -master-bin.000001 1404 Delete_rows 1 1443 table_id: # flags: STMT_END_F -master-bin.000001 1443 Query 1 1508 COMMIT -master-bin.000001 1508 Query 1 1584 use `test`; DROP TABLE t1 +master-bin.000001 4 Format_desc 1 107 Server ver: SERVER_VERSION, Binlog ver: 4 +master-bin.000001 107 Query 1 224 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 224 Query 1 288 BEGIN +master-bin.000001 288 Table_map 1 331 table_id: # (test.t1) +master-bin.000001 331 Table_map 1 393 table_id: # (mysql.ndb_apply_status) +master-bin.000001 393 Write_rows 1 452 table_id: # +master-bin.000001 452 Write_rows 1 499 table_id: # flags: STMT_END_F +master-bin.000001 499 Query 1 564 COMMIT +master-bin.000001 564 Query 1 644 use `test`; TRUNCATE TABLE t1 +master-bin.000001 644 Query 1 720 use `test`; DROP TABLE t1 +master-bin.000001 720 Query 1 837 use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b LONG) ENGINE=NDB +master-bin.000001 837 Query 1 901 BEGIN +master-bin.000001 901 Table_map 1 944 table_id: # (test.t1) +master-bin.000001 944 Table_map 1 1006 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1006 Write_rows 1 1065 table_id: # +master-bin.000001 1065 Write_rows 1 1112 table_id: # flags: STMT_END_F +master-bin.000001 1112 Query 1 1177 COMMIT +master-bin.000001 1177 Query 1 1241 BEGIN +master-bin.000001 1241 Table_map 1 1284 table_id: # (test.t1) +master-bin.000001 1284 Table_map 1 1346 table_id: # (mysql.ndb_apply_status) +master-bin.000001 1346 Write_rows 1 1405 table_id: # +master-bin.000001 1405 Delete_rows 1 1444 table_id: # flags: STMT_END_F +master-bin.000001 1444 Query 1 1509 COMMIT +master-bin.000001 1509 Query 1 1585 use `test`; DROP TABLE t1 diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test index 89df33a6df5..19f44695f28 100644 --- a/mysql-test/t/ctype_cp932_binlog_stm.test +++ b/mysql-test/t/ctype_cp932_binlog_stm.test @@ -22,14 +22,14 @@ CALL bug18293("Foo's a Bar", _cp932 0xED40ED41ED42, 47.93)| SELECT HEX(s1),HEX(s2),d FROM t4| DROP PROCEDURE bug18293| DROP TABLE t4| -SHOW BINLOG EVENTS FROM 370| +SHOW BINLOG EVENTS FROM 371| delimiter ;| --echo End of 5.0 tests # # #28436: Incorrect position in SHOW BINLOG EVENTS causes server coredump -# Note: 364 is a magic position (found experimentally, depends on +# Note: 365 is a magic position (found experimentally, depends on # the log's contents) that caused the server crash. --error 1220 diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 7767abe43d0..597c9671053 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -71,7 +71,7 @@ select "--- --position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=239 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --position=240 $MYSQLD_DATADIR/master-bin.000002 # These are tests for remote binlog. # They should return the same as previous test. @@ -107,7 +107,7 @@ select "--- --position --" as ""; --enable_query_log --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=239 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 +--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --read-from-remote-server --position=240 --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 # Bug#7853 mysqlbinlog does not accept input from stdin --disable_query_log @@ -119,7 +119,7 @@ select "--- reading stdin --" as ""; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 +--exec $MYSQL_BINLOG --short-form --position=80 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 drop table t1,t2; # diff --git a/mysql-test/t/mysqlbinlog2.test b/mysql-test/t/mysqlbinlog2.test index d6be029ea56..6089b83e42d 100644 --- a/mysql-test/t/mysqlbinlog2.test +++ b/mysql-test/t/mysqlbinlog2.test @@ -50,15 +50,15 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=609 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=608 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=609 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 $MYSQLD_DATADIR/master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=609 --stop-position 726 $MYSQLD_DATADIR/master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -84,11 +84,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=609 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=134 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=135 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -111,15 +111,15 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --stop-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start and stop positions ---" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 --stop-position 725 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 +--exec $MYSQL_BINLOG --short-form --start-position=609 --stop-position 726 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log @@ -142,11 +142,11 @@ select "--- offset --" as ""; --disable_query_log select "--- start-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --start-position=608 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--exec $MYSQL_BINLOG --short-form --start-position=609 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- stop-position --" as ""; --enable_query_log ---exec $MYSQL_BINLOG --short-form --stop-position=134 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 +--exec $MYSQL_BINLOG --short-form --stop-position=135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002 --disable_query_log select "--- start-datetime --" as ""; --enable_query_log diff --git a/mysql-test/t/sp_trans_log.test b/mysql-test/t/sp_trans_log.test index 2f2b84a9bef..68467f71ee1 100644 --- a/mysql-test/t/sp_trans_log.test +++ b/mysql-test/t/sp_trans_log.test @@ -35,7 +35,8 @@ reset master| --error ER_DUP_ENTRY insert into t2 values (bug23333(),1)| --replace_column 2 # 5 # 6 # -show binlog events from 106 /* with fixes for #23333 will show there is the query */| +# the following must show there is (are) events after the query */ +source include/show_binlog_events.inc| select count(*),@a from t1 /* must be 1,1 */| delimiter ;| diff --git a/sql/lex.h b/sql/lex.h index b199a79350b..790808a8c14 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -323,6 +323,7 @@ static SYMBOL symbols[] = { { "MASTER_SSL_KEY", SYM(MASTER_SSL_KEY_SYM)}, { "MASTER_SSL_VERIFY_SERVER_CERT", SYM(MASTER_SSL_VERIFY_SERVER_CERT_SYM)}, { "MASTER_USER", SYM(MASTER_USER_SYM)}, + { "MASTER_HEARTBEAT_PERIOD", SYM(MASTER_HEARTBEAT_PERIOD_SYM)}, { "MATCH", SYM(MATCH)}, { "MAX_CONNECTIONS_PER_HOUR", SYM(MAX_CONNECTIONS_PER_HOUR)}, { "MAX_QUERIES_PER_HOUR", SYM(MAX_QUERIES_PER_HOUR)}, diff --git a/sql/log.cc b/sql/log.cc index 1af2f3a4ddc..362df871ba9 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2413,7 +2413,7 @@ const char *MYSQL_LOG::generate_name(const char *log_name, MYSQL_BIN_LOG::MYSQL_BIN_LOG() :bytes_written(0), prepared_xids(0), file_id(1), open_count(1), need_start_event(TRUE), m_table_map_version(0), - is_relay_log(0), + is_relay_log(0), signal_cnt(0), description_event_for_exec(0), description_event_for_queue(0) { /* @@ -4605,12 +4605,9 @@ err: /** - Wait until we get a signal that the binary log has been updated. + Wait until we get a signal that the relay log has been updated. @param thd Thread variable - @param is_slave If 0, the caller is the Binlog_dump thread from master; - if 1, the caller is the SQL thread from the slave. This - influences only thd->proc_info. @note One must have a lock on LOCK_log before calling this function. @@ -4618,22 +4615,53 @@ err: THD::enter_cond() (see NOTES in sql_class.h). */ -void MYSQL_BIN_LOG::wait_for_update(THD* thd, bool is_slave) +void MYSQL_BIN_LOG::wait_for_update_relay_log(THD* thd) { const char *old_msg; - DBUG_ENTER("wait_for_update"); + DBUG_ENTER("wait_for_update_relay_log"); old_msg= thd->enter_cond(&update_cond, &LOCK_log, - is_slave ? - "Has read all relay log; waiting for the slave I/O " - "thread to update it" : - "Has sent all binlog to slave; waiting for binlog " - "to be updated"); + "Slave has read all relay log; " + "waiting for the slave I/O " + "thread to update it" ); pthread_cond_wait(&update_cond, &LOCK_log); thd->exit_cond(old_msg); DBUG_VOID_RETURN; } +/** + Wait until we get a signal that the binary log has been updated. + Applies to master only. + + NOTES + @param[in] thd a THD struct + @param[in] timeout a pointer to a timespec; + NULL means to wait w/o timeout. + @retval 0 if got signalled on update + @retval non-0 if wait timeout elapsed + @note + LOCK_log must be taken before calling this function. + LOCK_log is being released while the thread is waiting. + LOCK_log is released by the caller. +*/ + +int MYSQL_BIN_LOG::wait_for_update_bin_log(THD* thd, + const struct timespec *timeout) +{ + int ret= 0; + const char* old_msg = thd->proc_info; + DBUG_ENTER("wait_for_update_bin_log"); + old_msg= thd->enter_cond(&update_cond, &LOCK_log, + "Master has sent all binlog to slave; " + "waiting for binlog to be updated"); + if (!timeout) + pthread_cond_wait(&update_cond, &LOCK_log); + else + ret= pthread_cond_timedwait(&update_cond, &LOCK_log, + const_cast(timeout)); + DBUG_RETURN(ret); +} + /** Close the log file. @@ -4846,6 +4874,7 @@ bool flush_error_log() void MYSQL_BIN_LOG::signal_update() { DBUG_ENTER("MYSQL_BIN_LOG::signal_update"); + signal_cnt++; pthread_cond_broadcast(&update_cond); DBUG_VOID_RETURN; } diff --git a/sql/log.h b/sql/log.h index d306d6f7182..8d6a90d8a35 100644 --- a/sql/log.h +++ b/sql/log.h @@ -284,7 +284,7 @@ public: /* This is relay log */ bool is_relay_log; - + ulong signal_cnt; // update of the counter is checked by heartbeat /* These describe the log's format. This is used only for relay logs. _for_exec is used by the SQL thread, _for_queue by the I/O thread. It's @@ -339,7 +339,8 @@ public: } void set_max_size(ulong max_size_arg); void signal_update(); - void wait_for_update(THD* thd, bool master_or_slave); + void wait_for_update_relay_log(THD* thd); + int wait_for_update_bin_log(THD* thd, const struct timespec * timeout); void set_need_start_event() { need_start_event = 1; } void init(bool no_auto_events_arg, ulong max_size); void init_pthread_objects(); diff --git a/sql/log_event.cc b/sql/log_event.cc index fb6a5230fda..6c240735d23 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3643,6 +3643,7 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) post_header_len[UPDATE_ROWS_EVENT-1]= post_header_len[DELETE_ROWS_EVENT-1]= 6;); post_header_len[INCIDENT_EVENT-1]= INCIDENT_HEADER_LEN; + post_header_len[HEARTBEAT_LOG_EVENT-1]= 0; // Sanity-check that all post header lengths are initialized. IF_DBUG({ @@ -9427,3 +9428,16 @@ st_print_event_info::st_print_event_info() open_cached_file(&body_cache, NULL, NULL, 0, flags); } #endif + + +#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT) +Heartbeat_log_event::Heartbeat_log_event(const char* buf, uint event_len, + const Format_description_log_event* description_event) + :Log_event(buf, description_event) +{ + uint8 header_size= description_event->common_header_len; + ident_len = event_len - header_size; + set_if_smaller(ident_len,FN_REFLEN-1); + log_ident= buf + header_size; +} +#endif diff --git a/sql/log_event.h b/sql/log_event.h index 8202dddcc76..b481ae59502 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -250,6 +250,7 @@ struct sql_ex_info #define EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN (4 + 4 + 4 + 1) #define EXECUTE_LOAD_QUERY_HEADER_LEN (QUERY_HEADER_LEN + EXECUTE_LOAD_QUERY_EXTRA_HEADER_LEN) #define INCIDENT_HEADER_LEN 2 +#define HEARTBEAT_HEADER_LEN 0 /* Max number of possible extra bytes in a replication event compared to a packet (i.e. a query) sent from client to master; @@ -574,6 +575,12 @@ enum Log_event_type */ INCIDENT_EVENT= 26, + /* + Heartbeat event to be send by master at its idle time + to ensure master's online status to slave + */ + HEARTBEAT_LOG_EVENT= 27, + /* Add new events here - right above this comment! Existing events (except ENUM_END_EVENT) should never change their numbers @@ -689,6 +696,20 @@ typedef struct st_print_event_info } PRINT_EVENT_INFO; #endif +/** + the struct aggregates two paramenters that identify an event + uniquely in scope of communication of a particular master and slave couple. + I.e there can not be 2 events from the same staying connected master which + have the same coordinates. + @note + Such identifier is not yet unique generally as the event originating master + is resetable. Also the crashed master can be replaced with some other. +*/ +struct event_coordinates +{ + char * file_name; // binlog file name (directories stripped) + my_off_t pos; // event's position in the binlog file +}; /** @class Log_event @@ -3916,6 +3937,42 @@ static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE); } +#ifndef MYSQL_CLIENT +/***************************************************************************** + + Heartbeat Log Event class + + Replication event to ensure to slave that master is alive. + The event is originated by master's dump thread and sent straight to + slave without being logged. Slave itself does not store it in relay log + but rather uses a data for immediate checks and throws away the event. + + Two members of the class log_ident and Log_event::log_pos comprise + @see the event_coordinates instance. The coordinates that a heartbeat + instance carries correspond to the last event master has sent from + its binlog. + + ****************************************************************************/ +class Heartbeat_log_event: public Log_event +{ +public: + Heartbeat_log_event(const char* buf, uint event_len, + const Format_description_log_event* description_event); + Log_event_type get_type_code() { return HEARTBEAT_LOG_EVENT; } + bool is_valid() const + { + return (log_ident != NULL && + log_pos >= BIN_LOG_HEADER_SIZE); + } + const char * get_log_ident() { return log_ident; } + uint get_ident_len() { return ident_len; } + +private: + const char* log_ident; + uint ident_len; +}; +#endif + /** @} (end of group Replication) */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 7e9eb6e7291..4bbb49f47ff 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7068,6 +7068,40 @@ static int show_slave_retried_trans(THD *thd, SHOW_VAR *var, char *buff) pthread_mutex_unlock(&LOCK_active_mi); return 0; } + +static int show_slave_received_heartbeats(THD *thd, SHOW_VAR *var, char *buff) +{ + pthread_mutex_lock(&LOCK_active_mi); + if (active_mi) + { + var->type= SHOW_LONGLONG; + var->value= buff; + pthread_mutex_lock(&active_mi->rli.data_lock); + *((longlong *)buff)= active_mi->received_heartbeats; + pthread_mutex_unlock(&active_mi->rli.data_lock); + } + else + var->type= SHOW_UNDEF; + pthread_mutex_unlock(&LOCK_active_mi); + return 0; +} + +static int show_heartbeat_period(THD *thd, SHOW_VAR *var, char *buff) +{ + pthread_mutex_lock(&LOCK_active_mi); + if (active_mi) + { + var->type= SHOW_CHAR; + var->value= buff; + my_sprintf(buff, (buff, "%.3f",active_mi->heartbeat_period)); + } + else + var->type= SHOW_UNDEF; + pthread_mutex_unlock(&LOCK_active_mi); + return 0; +} + + #endif /* HAVE_REPLICATION */ static int show_open_tables(THD *thd, SHOW_VAR *var, char *buff) @@ -7432,6 +7466,8 @@ SHOW_VAR status_vars[]= { {"Slave_open_temp_tables", (char*) &slave_open_temp_tables, SHOW_LONG}, #ifdef HAVE_REPLICATION {"Slave_retried_transactions",(char*) &show_slave_retried_trans, SHOW_FUNC}, + {"Slave_heartbeat_period", (char*) &show_heartbeat_period, SHOW_FUNC}, + {"Slave_received_heartbeats",(char*) &show_slave_received_heartbeats, SHOW_FUNC}, {"Slave_running", (char*) &show_slave_running, SHOW_FUNC}, #endif {"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG}, diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 5e46837e948..77f7b7e1929 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -26,12 +26,13 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, const char *default_val); +int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val); Master_info::Master_info() :Slave_reporting_capability("I/O"), ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0), inited(0), - abort_slave(0),slave_running(0), - slave_run_id(0) + abort_slave(0),slave_running(0), slave_run_id(0), + heartbeat_period(0), received_heartbeats(0) { host[0] = 0; user[0] = 0; password[0] = 0; ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0; @@ -84,6 +85,17 @@ void init_master_info_with_options(Master_info* mi) strmake(mi->ssl_key, master_ssl_key, sizeof(mi->ssl_key)-1); /* Intentionally init ssl_verify_server_cert to 0, no option available */ mi->ssl_verify_server_cert= 0; + /* + always request heartbeat unless master_heartbeat_period is set + explicitly zero. Here is the default value for heartbeat period + if CHANGE MASTER did not specify it. (no data loss in conversion + as hb period has a max) + */ + mi->heartbeat_period= (float) min(SLAVE_MAX_HEARTBEAT_PERIOD, + (slave_net_timeout/2.0)); + DBUG_ASSERT(mi->heartbeat_period > (float) 0.001 + || mi->heartbeat_period == 0); + DBUG_VOID_RETURN; } @@ -94,8 +106,11 @@ enum { /* 5.1.16 added value of master_ssl_verify_server_cert */ LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT= 15, + /* 6.0 added value of master_heartbeat_period */ + LINE_FOR_MASTER_HEARTBEAT_PERIOD= 16, + /* Number of lines currently used when saving master info file */ - LINES_IN_MASTER_INFO= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT + LINES_IN_MASTER_INFO= LINE_FOR_MASTER_HEARTBEAT_PERIOD }; int init_master_info(Master_info* mi, const char* master_info_fname, @@ -197,6 +212,7 @@ file '%s')", fname); mi->fd = fd; int port, connect_retry, master_log_pos, lines; int ssl= 0, ssl_verify_server_cert= 0; + float master_heartbeat_period= 0.0; char *first_non_digit; /* @@ -281,7 +297,13 @@ file '%s')", fname); if (lines >= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT && init_intvar_from_file(&ssl_verify_server_cert, &mi->file, 0)) goto errwithmsg; - + /* + Starting from 6.0 master_heartbeat_period might be + in the file + */ + if (lines >= LINE_FOR_MASTER_HEARTBEAT_PERIOD && + init_floatvar_from_file(&master_heartbeat_period, &mi->file, 0.0)) + goto errwithmsg; } #ifndef HAVE_OPENSSL @@ -300,6 +322,7 @@ file '%s')", fname); mi->connect_retry= (uint) connect_retry; mi->ssl= (my_bool) ssl; mi->ssl_verify_server_cert= ssl_verify_server_cert; + mi->heartbeat_period= master_heartbeat_period; } DBUG_PRINT("master_info",("log_file_name: %s position: %ld", mi->master_log_name, @@ -378,16 +401,18 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) contents of file). But because of number of lines in the first line of file we don't care about this garbage. */ - + char heartbeat_buf[sizeof(mi->heartbeat_period) * 4]; // buffer to suffice always + my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period)); my_b_seek(file, 0L); my_b_printf(file, - "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n", + "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n", LINES_IN_MASTER_INFO, mi->master_log_name, llstr(mi->master_log_pos, lbuf), mi->host, mi->user, mi->password, mi->port, mi->connect_retry, (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert, - mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert); + mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert, + heartbeat_buf); DBUG_RETURN(-flush_io_cache(file)); } diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 93fb0a98198..35e18414932 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -83,6 +83,8 @@ class Master_info : public Slave_reporting_capability Relay_log_info rli; uint port; uint connect_retry; + float heartbeat_period; // interface with CHANGE MASTER or master.info + ulonglong received_heartbeats; // counter of received heartbeat events #ifndef DBUG_OFF int events_till_disconnect; #endif diff --git a/sql/slave.cc b/sql/slave.cc index fac9ee214c5..4a161a345eb 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -770,7 +770,6 @@ static bool sql_slave_killed(THD* thd, Relay_log_info* rli) DBUG_RETURN(0); } - /* skip_load_data_infile() @@ -860,6 +859,37 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val) DBUG_RETURN(1); } +int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val) +{ + char buf[16]; + DBUG_ENTER("init_floatvar_from_file"); + + + if (my_b_gets(f, buf, sizeof(buf))) + { + if (sscanf(buf, "%f", var) != 1) + DBUG_RETURN(1); + else + DBUG_RETURN(0); + } + else if (default_val != 0.0) + { + *var = default_val; + DBUG_RETURN(0); + } + DBUG_RETURN(1); +} + +static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info) +{ + if (io_slave_killed(thd, mi)) + { + if (info && global_system_variables.log_warnings) + sql_print_information(info); + return TRUE; + } + return FALSE; +} /* Check if the error is caused by network. @@ -1189,6 +1219,32 @@ when it try to get the value of TIME_ZONE global variable from master."; } } + if (mi->heartbeat_period != 0.0) + { + char llbuf[22]; + const char query_format[]= "SET @master_heartbeat_period= %s"; + char query[sizeof(query_format) - 2 + sizeof(llbuf)]; + /* + the period is an ulonglong of nano-secs. + */ + llstr((ulonglong) (mi->heartbeat_period*1000000000UL), llbuf); + my_sprintf(query, (query, query_format, llbuf)); + + if (mysql_real_query(mysql, query, strlen(query)) + && !check_io_slave_killed(mi->io_thd, mi, NULL)) + { + errmsg= "The slave I/O thread stops because querying master with '%s' " + "failed; error: '%s' "; + err_code= ER_SLAVE_FATAL_ERROR; + sprintf(err_buff, "%s Error: %s", errmsg, + query, mysql_error(mysql)); + mysql_free_result(mysql_store_result(mysql)); + goto err; + } + mysql_free_result(mysql_store_result(mysql)); + } + + err: if (errmsg) { @@ -2381,18 +2437,6 @@ on this slave.\ } -static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info) -{ - if (io_slave_killed(thd, mi)) - { - if (info && global_system_variables.log_warnings) - sql_print_information(info); - return TRUE; - } - return FALSE; -} - - /** @brief Try to reconnect slave IO thread. @@ -3552,6 +3596,7 @@ static int queue_old_event(Master_info *mi, const char *buf, static int queue_event(Master_info* mi,const char* buf, ulong event_len) { int error= 0; + String error_msg; ulong inc_pos; Relay_log_info *rli= &mi->rli; pthread_mutex_t *log_lock= rli->relay_log.get_log_lock(); @@ -3586,7 +3631,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) Rotate_log_event rev(buf,event_len,mi->rli.relay_log.description_event_for_queue); if (unlikely(process_io_rotate(mi,&rev))) { - error= 1; + error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE; goto err; } /* @@ -3613,7 +3658,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) Log_event::read_log_event(buf, event_len, &errmsg, mi->rli.relay_log.description_event_for_queue))) { - error= 2; + error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE; goto err; } delete mi->rli.relay_log.description_event_for_queue; @@ -3632,6 +3677,56 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) } break; + + case HEARTBEAT_LOG_EVENT: + { + /* + HB (heartbeat) cannot come before RL (Relay) + */ + char llbuf[22]; + Heartbeat_log_event hb(buf, event_len, mi->rli.relay_log.description_event_for_queue); + if (!hb.is_valid()) + { + error= ER_SLAVE_HEARTBEAT_FAILURE; + error_msg.append(STRING_WITH_LEN("inconsistent heartbeat event content;")); + error_msg.append(STRING_WITH_LEN("the event's data: log_file_name ")); + error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident())); + error_msg.append(STRING_WITH_LEN(" log_pos ")); + llstr(hb.log_pos, llbuf); + error_msg.append(llbuf, strlen(llbuf)); + goto err; + } + mi->received_heartbeats++; + /* + compare local and event's versions of log_file, log_pos. + + Heartbeat is sent only after an event corresponding to the corrdinates + the heartbeat carries. + Slave can not have a difference in coordinates except in the only + special case when mi->master_log_name, master_log_pos have never + been updated by Rotate event i.e when slave does not have any history + with the master (and thereafter mi->master_log_pos is NULL). + + TODO: handling `when' for SHOW SLAVE STATUS' snds behind + */ + if ((memcmp(mi->master_log_name, hb.get_log_ident(), hb.get_ident_len()) + && mi->master_log_name != NULL) + || mi->master_log_pos != hb.log_pos) + { + /* missed events of heartbeat from the past */ + error= ER_SLAVE_HEARTBEAT_FAILURE; + error_msg.append(STRING_WITH_LEN("heartbeat is not compatible with local info;")); + error_msg.append(STRING_WITH_LEN("the event's data: log_file_name ")); + error_msg.append(hb.get_log_ident(), (uint) strlen(hb.get_log_ident())); + error_msg.append(STRING_WITH_LEN(" log_pos ")); + llstr(hb.log_pos, llbuf); + error_msg.append(llbuf, strlen(llbuf)); + goto err; + } + goto skip_relay_logging; + } + break; + default: inc_pos= event_len; break; @@ -3692,15 +3787,23 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) rli->relay_log.harvest_bytes_written(&rli->log_space_total); } else - error= 3; + { + error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE; + } rli->ign_master_log_name_end[0]= 0; // last event is not ignored } pthread_mutex_unlock(log_lock); - +skip_relay_logging: + err: pthread_mutex_unlock(&mi->data_lock); DBUG_PRINT("info", ("error: %d", error)); + if (error) + mi->report(ERROR_LEVEL, error, ER(error), + (error == ER_SLAVE_RELAY_LOG_WRITE_FAILURE)? + "could not queue event from master" : + error_msg.ptr()); DBUG_RETURN(error); } @@ -4208,8 +4311,8 @@ static Log_event* next_event(Relay_log_info* rli) */ pthread_mutex_unlock(&rli->log_space_lock); pthread_cond_broadcast(&rli->log_space_cond); - // Note that wait_for_update unlocks lock_log ! - rli->relay_log.wait_for_update(rli->sql_thd, 1); + // Note that wait_for_update_relay_log unlocks lock_log ! + rli->relay_log.wait_for_update_relay_log(rli->sql_thd); // re-acquire data lock since we released it earlier pthread_mutex_lock(&rli->data_lock); rli->last_master_timestamp= save_timestamp; diff --git a/sql/slave.h b/sql/slave.h index a44a7eed83e..e8364090eb4 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -22,6 +22,17 @@ @file */ + +/** + Some of defines are need in parser even though replication is not + compiled in (embedded). +*/ + +/** + The maximum is defined as (ULONG_MAX/1000) with 4 bytes ulong +*/ +#define SLAVE_MAX_HEARTBEAT_PERIOD 4294967 + #ifdef HAVE_REPLICATION #include "log.h" @@ -33,7 +44,6 @@ #define MAX_SLAVE_ERROR 2000 - // Forward declarations class Relay_log_info; class Master_info; diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 6f9f667a75a..f6effab93a4 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -206,14 +206,15 @@ typedef struct st_lex_master_info { char *host, *user, *password, *log_file_name; uint port, connect_retry; + float heartbeat_period; ulonglong pos; ulong server_id; /* Enum is used for making it possible to detect if the user changed variable or if it should be left at old value */ - enum {SSL_UNCHANGED, SSL_DISABLE, SSL_ENABLE} - ssl, ssl_verify_server_cert; + enum {LEX_MI_UNCHANGED, LEX_MI_DISABLE, LEX_MI_ENABLE} + ssl, ssl_verify_server_cert, heartbeat_opt; char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher; char *relay_log_name; ulong relay_log_pos; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 0ec8d91214c..cde713b1b40 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -336,6 +336,74 @@ Increase max_allowed_packet on master"; } +/** + An auxiliary function for calling in mysql_binlog_send + to initialize the heartbeat timeout in waiting for a binlogged event. + + @param[in] thd THD to access a user variable + + @return heartbeat period an ulonglong of nanoseconds + or zero if heartbeat was not demanded by slave +*/ +static ulonglong get_heartbeat_period(THD * thd) +{ + my_bool null_value; + LEX_STRING name= { C_STRING_WITH_LEN("master_heartbeat_period")}; + user_var_entry *entry= + (user_var_entry*) hash_search(&thd->user_vars, (uchar*) name.str, + name.length); + return entry? entry->val_int(&null_value) : 0; +} + +/* + Function prepares and sends repliation heartbeat event. + + @param net net object of THD + @param packet buffer to store the heartbeat instance + @param event_coordinates binlog file name and position of the last + real event master sent from binlog + + @note + Among three essential pieces of heartbeat data Log_event::when + is computed locally. + The error to send is serious and should force terminating + the dump thread. +*/ +static int send_heartbeat_event(NET* net, String* packet, + const struct event_coordinates *coord) +{ + DBUG_ENTER("send_heartbeat_event"); + char header[LOG_EVENT_HEADER_LEN]; + /* + 'when' (the timestamp) is set to 0 so that slave could distinguish between + real and fake Rotate events (if necessary) + */ + memset(header, 0, 4); // when + + header[EVENT_TYPE_OFFSET] = HEARTBEAT_LOG_EVENT; + + char* p= coord->file_name + dirname_length(coord->file_name); + + uint ident_len = strlen(p); + ulong event_len = ident_len + LOG_EVENT_HEADER_LEN; + int4store(header + SERVER_ID_OFFSET, server_id); + int4store(header + EVENT_LEN_OFFSET, event_len); + int2store(header + FLAGS_OFFSET, 0); + + int4store(header + LOG_POS_OFFSET, coord->pos); // log_pos + + packet->append(header, sizeof(header)); + packet->append(p, ident_len); // log_file_name + + if (my_net_write(net, (uchar*) packet->ptr(), packet->length()) || + net_flush(net)) + { + DBUG_RETURN(-1); + } + packet->set("\0", 1, &my_charset_bin); + DBUG_RETURN(0); +} + /* TODO: Clean up loop to only have one call to send_file() */ @@ -361,7 +429,22 @@ void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, DBUG_PRINT("enter",("log_ident: '%s' pos: %ld", log_ident, (long) pos)); bzero((char*) &log,sizeof(log)); - + /* + heartbeat_period from @master_heartbeat_period user variable + */ + ulonglong heartbeat_period= get_heartbeat_period(thd); + struct timespec heartbeat_buf; + struct event_coordinates coord_buf; + struct timespec *heartbeat_ts= NULL; + struct event_coordinates *coord= NULL; + if (heartbeat_period != LL(0)) + { + heartbeat_ts= &heartbeat_buf; + set_timespec_nsec(*heartbeat_ts, 0); + coord= &coord_buf; + coord->file_name= log_file_name; // initialization basing on what slave remembers + coord->pos= pos; + } #ifndef DBUG_OFF if (opt_sporadic_binlog_dump_fail && (binlog_dump_count++ % 2)) { @@ -555,6 +638,11 @@ impossible position"; goto err; } #endif + /* + log's filename does not change while it's active + */ + if (coord) + coord->pos= uint4korr(packet->ptr() + 1 + LOG_POS_OFFSET); if ((*packet)[EVENT_TYPE_OFFSET+1] == FORMAT_DESCRIPTION_EVENT) { @@ -650,26 +738,65 @@ impossible position"; /* we read successfully, so we'll need to send it to the slave */ pthread_mutex_unlock(log_lock); read_packet = 1; + if (coord) + coord->pos= uint4korr(packet->ptr() + 1 + LOG_POS_OFFSET); break; case LOG_READ_EOF: + { + int ret; + ulong signal_cnt; DBUG_PRINT("wait",("waiting for data in binary log")); if (thd->server_id==0) // for mysqlbinlog (mysqlbinlog.server_id==0) { pthread_mutex_unlock(log_lock); goto end; } - if (!thd->killed) - { - /* Note that the following call unlocks lock_log */ - mysql_bin_log.wait_for_update(thd, 0); - } - else - pthread_mutex_unlock(log_lock); - DBUG_PRINT("wait",("binary log received update")); - break; - default: +#ifndef DBUG_OFF + ulong hb_info_counter= 0; +#endif + signal_cnt= mysql_bin_log.signal_cnt; + do + { + if (coord) + { + DBUG_ASSERT(heartbeat_ts && heartbeat_period != LL(0)); + set_timespec_nsec(*heartbeat_ts, heartbeat_period); + } + ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts); + DBUG_ASSERT(ret == 0 || heartbeat_period != LL(0) && coord != NULL); + if (ret == ETIMEDOUT || ret == ETIME) + { +#ifndef DBUG_OFF + if (hb_info_counter < 3) + { + sql_print_information("master sends heartbeat message"); + hb_info_counter++; + if (hb_info_counter == 3) + sql_print_information("the rest of heartbeat info skipped ..."); + } +#endif + if (send_heartbeat_event(net, packet, coord)) + { + errmsg = "Failed on my_net_write()"; + my_errno= ER_UNKNOWN_ERROR; + pthread_mutex_unlock(log_lock); + goto err; + } + } + else + { + DBUG_ASSERT(ret == 0 && signal_cnt != mysql_bin_log.signal_cnt || + thd->killed); + DBUG_PRINT("wait",("binary log received update")); + } + } while (signal_cnt == mysql_bin_log.signal_cnt && !thd->killed); + pthread_mutex_unlock(log_lock); + } + break; + + default: pthread_mutex_unlock(log_lock); fatal_error = 1; break; @@ -753,6 +880,8 @@ impossible position"; packet->length(0); packet->append('\0'); + if (coord) + coord->file_name= log_file_name; // reset to the next } } @@ -1195,13 +1324,18 @@ bool change_master(THD* thd, Master_info* mi) mi->port = lex_mi->port; if (lex_mi->connect_retry) mi->connect_retry = lex_mi->connect_retry; + if (lex_mi->heartbeat_opt != LEX_MASTER_INFO::LEX_MI_UNCHANGED) + mi->heartbeat_period = lex_mi->heartbeat_period; + else + mi->heartbeat_period= (float) min(SLAVE_MAX_HEARTBEAT_PERIOD, + (slave_net_timeout/2.0)); + mi->received_heartbeats= LL(0); // counter lives until master is CHANGEd + if (lex_mi->ssl != LEX_MASTER_INFO::LEX_MI_UNCHANGED) + mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::LEX_MI_ENABLE); - if (lex_mi->ssl != LEX_MASTER_INFO::SSL_UNCHANGED) - mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::SSL_ENABLE); - - if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::SSL_UNCHANGED) + if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::LEX_MI_UNCHANGED) mi->ssl_verify_server_cert= - (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::SSL_ENABLE); + (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::LEX_MI_ENABLE); if (lex_mi->ssl_ca) strmake(mi->ssl_ca, lex_mi->ssl_ca, sizeof(mi->ssl_ca)-1); @@ -1745,6 +1879,26 @@ public: bool update(THD *thd, set_var *var); }; +static void fix_slave_net_timeout(THD *thd, enum_var_type type) +{ + DBUG_ENTER("fix_slave_net_timeout"); +#ifdef HAVE_REPLICATION + pthread_mutex_lock(&LOCK_active_mi); + DBUG_PRINT("info",("slave_net_timeout=%lu mi->heartbeat_period=%.3f", + slave_net_timeout, + (active_mi? active_mi->heartbeat_period : 0.0))); + if (active_mi && slave_net_timeout < active_mi->heartbeat_period) + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, + "The currect value for master_heartbeat_period" + " exceeds the new value of `slave_net_timeout' sec." + " A sensible value for the period should be" + " less than the timeout."); + pthread_mutex_unlock(&LOCK_active_mi); +#endif + DBUG_VOID_RETURN; +} + static sys_var_chain vars = { NULL, NULL }; static sys_var_const sys_log_slave_updates(&vars, "log_slave_updates", @@ -1770,7 +1924,8 @@ static sys_var_const sys_slave_load_tmpdir(&vars, "slave_load_tmpdir", OPT_GLOBAL, SHOW_CHAR_PTR, (uchar*) &slave_load_tmpdir); static sys_var_long_ptr sys_slave_net_timeout(&vars, "slave_net_timeout", - &slave_net_timeout); + &slave_net_timeout, + fix_slave_net_timeout); static sys_var_const sys_slave_skip_errors(&vars, "slave_skip_errors", OPT_GLOBAL, SHOW_CHAR, (uchar*) slave_skip_error_names); @@ -1835,6 +1990,7 @@ int init_replication_sys_vars() return 0; } + #endif /* HAVE_REPLICATION */ diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index a18f57bf9cf..50395d386e8 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -814,6 +814,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token MASTER_SSL_VERIFY_SERVER_CERT_SYM %token MASTER_SYM %token MASTER_USER_SYM +%token MASTER_HEARTBEAT_PERIOD_SYM %token MATCH /* SQL-2003-R */ %token MAX_CONNECTIONS_PER_HOUR %token MAX_QUERIES_PER_HOUR @@ -1592,7 +1593,7 @@ master_def: | MASTER_SSL_SYM EQ ulong_num { Lex->mi.ssl= $3 ? - LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE; + LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE; } | MASTER_SSL_CA_SYM EQ TEXT_STRING_sys { @@ -1617,9 +1618,51 @@ master_def: | MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num { Lex->mi.ssl_verify_server_cert= $3 ? - LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE; + LEX_MASTER_INFO::LEX_MI_ENABLE : LEX_MASTER_INFO::LEX_MI_DISABLE; } - | master_file_def + + | MASTER_HEARTBEAT_PERIOD_SYM EQ NUM_literal + { + Lex->mi.heartbeat_period= (float) $3->val_real(); + if (Lex->mi.heartbeat_period > SLAVE_MAX_HEARTBEAT_PERIOD || + Lex->mi.heartbeat_period < 0.0) + { + const char format[]= "%d seconds"; + char buf[4*sizeof(SLAVE_MAX_HEARTBEAT_PERIOD) + sizeof(format)]; + my_sprintf(buf, (buf, format, SLAVE_MAX_HEARTBEAT_PERIOD)); + my_error(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, + MYF(0), + " is negative or exceeds the maximum ", + buf); + MYSQL_YYABORT; + } + if (Lex->mi.heartbeat_period > slave_net_timeout) + { + push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, + ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE), + " exceeds the value of `slave_net_timeout' sec.", + " A sensible value for the period should be" + " less than the timeout."); + } + if (Lex->mi.heartbeat_period < 0.001) + { + if (Lex->mi.heartbeat_period != 0.0) + { + push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE, + ER(ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE), + " is less than 1 msec.", + " The period is reset to zero which means" + " no heartbeats will be sending"); + Lex->mi.heartbeat_period= 0.0; + } + Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_DISABLE; + } + Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; + } + | + master_file_def ; master_file_def: From a029813bf7eb15263d1e0ed2c1b8db2738549fa3 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Tue, 29 Sep 2009 14:18:41 +0300 Subject: [PATCH 41/88] WL#342 heartbeat Backporting the basic tests --- mysql-test/suite/rpl/r/rpl_heartbeat.result | 139 ++++++++++++++++ mysql-test/suite/rpl/t/rpl_heartbeat.test | 166 ++++++++++++++++++++ 2 files changed, 305 insertions(+) create mode 100644 mysql-test/suite/rpl/r/rpl_heartbeat.result create mode 100644 mysql-test/suite/rpl/t/rpl_heartbeat.test diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat.result b/mysql-test/suite/rpl/r/rpl_heartbeat.result new file mode 100644 index 00000000000..5775351c33d --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result @@ -0,0 +1,139 @@ +reset master; +set @@global.slave_net_timeout= 10; +Warnings: +Warning 1624 The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout. +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 5.000 +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 4294968; +ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 5.000 +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.0009999; +Warnings: +Warning 1624 The requested value for the heartbeat period is less than 1 msec. The period is reset to zero which means no heartbeats will be sending +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 0.000 +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 4294967; +Warnings: +Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout. +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 4294967.000 +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.001; +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 0.001 +reset slave; +set @@global.slave_net_timeout= 5; +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 5.001; +Warnings: +Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout. +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 5.001 +reset slave; +set @@global.slave_net_timeout= 5; +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 4; +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 4.000 +set @@global.slave_net_timeout= 3 /* must be a warning */; +Warnings: +Warning 1624 The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout. +reset slave; +drop table if exists t1; +set @@global.slave_net_timeout= 10; +change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root', master_heartbeat_period= 0.5; +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 0.500 +start slave; +create table t1 (f1 int); +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 280 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 280 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno # +Last_IO_Error # +Last_SQL_Errno 0 +Last_SQL_Error +SHOW SLAVE STATUS; +Slave_IO_State # +Master_Host 127.0.0.1 +Master_User root +Master_Port MASTER_PORT +Connect_Retry 1 +Master_Log_File master-bin.000001 +Read_Master_Log_Pos 280 +Relay_Log_File # +Relay_Log_Pos # +Relay_Master_Log_File master-bin.000001 +Slave_IO_Running Yes +Slave_SQL_Running Yes +Replicate_Do_DB +Replicate_Ignore_DB +Replicate_Do_Table +Replicate_Ignore_Table # +Replicate_Wild_Do_Table +Replicate_Wild_Ignore_Table +Last_Errno 0 +Last_Error +Skip_Counter 0 +Exec_Master_Log_Pos 280 +Relay_Log_Space # +Until_Condition None +Until_Log_File +Until_Log_Pos 0 +Master_SSL_Allowed No +Master_SSL_CA_File +Master_SSL_CA_Path +Master_SSL_Cert +Master_SSL_Cipher +Master_SSL_Key +Seconds_Behind_Master # +Master_SSL_Verify_Server_Cert No +Last_IO_Errno # +Last_IO_Error # +Last_SQL_Errno 0 +Last_SQL_Error +show status like 'Slave_heartbeat_period';; +Variable_name Slave_heartbeat_period +Value 0.500 +A heartbeat has been received by the slave +drop table t1; +End of tests diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat.test b/mysql-test/suite/rpl/t/rpl_heartbeat.test new file mode 100644 index 00000000000..4304888d6a5 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test @@ -0,0 +1,166 @@ +# Testing master to slave heartbeat protocol +# +# Including: +# - user interface, grammar, checking the range and warnings about +# unreasonable values for the heartbeat period; +# - no rotation of relay log if heartbeat is less that slave_net_timeout +# - SHOW STATUS like 'Slave_received_heartbeats' action +# - SHOW STATUS like 'Slave_heartbeat_period' report + +-- source include/have_log_bin.inc + +connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK); +connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK); + +connection master; +reset master; + +connection slave; +set @@global.slave_net_timeout= 10; + +### +### Checking the range +### + +# +# default period slave_net_timeout/2 +# +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root'; +--query_vertical show status like 'Slave_heartbeat_period'; + +# +# the max for the period is ULONG_MAX/1000; an attempt to exceed it is denied +# +--replace_result $MASTER_MYPORT MASTER_PORT +--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 4294968; +--query_vertical show status like 'Slave_heartbeat_period'; + +# +# the min value for the period is 1 millisecond an attempt to assign a +# lesser will be warned with treating the value as zero +# +connection slave; +--replace_result $MASTER_MYPORT MASTER_PORT +### 5.1 mtr does not have --warning ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 0.0009999; +--query_vertical show status like 'Slave_heartbeat_period'; + +# +# the actual max and min must be accepted +# +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 4294967; +--query_vertical show status like 'Slave_heartbeat_period'; + +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 0.001; +--query_vertical show status like 'Slave_heartbeat_period'; + +reset slave; + +# +# A warning if period greater than slave_net_timeout +# +set @@global.slave_net_timeout= 5; +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 5.001; +--query_vertical show status like 'Slave_heartbeat_period'; + +reset slave; + +# +# A warning if slave_net_timeout is set to less than the current HB period +# +set @@global.slave_net_timeout= 5; +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 4; +--query_vertical show status like 'Slave_heartbeat_period'; +set @@global.slave_net_timeout= 3 /* must be a warning */; + +reset slave; + + +### +### checking no rotation +### + +connection master; +--disable_warnings +drop table if exists t1; +--enable_warnings +# +# Even though master_heartbeat_period= 0.5 is 20 times less than +# @@global.slave_net_timeout= 10 in some circumstances master will +# not be able to send any heartbeat during the slave's net timeout +# and slave's relay log will rotate. +# The probability for such a scenario is pretty small so the following +# part is almost deterministic. +# + +connection slave; +set @@global.slave_net_timeout= 10; +--replace_result $MASTER_MYPORT MASTER_PORT +# no error this time but rather a warning +eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root', master_heartbeat_period= 0.5; +--query_vertical show status like 'Slave_heartbeat_period'; + +start slave; + +connection master; +create table t1 (f1 int); + +#connection slave; +sync_slave_with_master; +source include/show_slave_status.inc; + +# there is an explicit sleep lasting longer than slave_net_timeout +# to ensure that nothing will come to slave from master for that period. +# That would cause reconnecting and relaylog rotation w/o the fix i.e +# without a heartbeat received. + +real_sleep 15; + +# check (compare with the previous show's results) that no rotation happened +source include/show_slave_status.inc; + +### +### SHOW STATUS like 'Slave_heartbeat_period' and 'Slave_received_heartbeats' +### + +--query_vertical show status like 'Slave_heartbeat_period'; + +# +# proof that there has been received at least one heartbeat; +# The exact number of received heartbeat is an indeterministic value +# and therefore it's not recorded into results. +# + +let $slave_wait_param_counter= 300; +let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1); +# Checking the fact that at least one heartbeat is received +while (`select $slave_value = 0`) +{ + dec $slave_wait_param_counter; + if (!$slave_wait_param_counter) + { + --echo ERROR: failed while waiting for slave parameter $slave_param: $slave_param_value + query_vertical show slave status; + SHOW STATUS like 'Slave_received_heartbeats'; + exit; + } + sleep 0.1; + let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1); +} +--echo A heartbeat has been received by the slave +# cleanup + +connection master; +drop table t1; + +#connection slave; +sync_slave_with_master; + + +--echo End of tests From 8acf951e223a8cd68d2d6f795ddb27ffa93f0133 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Tue, 29 Sep 2009 14:37:52 +0300 Subject: [PATCH 42/88] WL#342 heartbeat Improving an error report generating. --- sql/slave.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sql/slave.cc b/sql/slave.cc index 4a161a345eb..bbdfb8e633f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1233,11 +1233,10 @@ when it try to get the value of TIME_ZONE global variable from master."; if (mysql_real_query(mysql, query, strlen(query)) && !check_io_slave_killed(mi->io_thd, mi, NULL)) { - errmsg= "The slave I/O thread stops because querying master with '%s' " - "failed; error: '%s' "; + errmsg= "The slave I/O thread stops because SET @master_heartbeat_period " + "on master failed."; err_code= ER_SLAVE_FATAL_ERROR; - sprintf(err_buff, "%s Error: %s", errmsg, - query, mysql_error(mysql)); + sprintf(err_buff, "%s Error: %s", errmsg, mysql_error(mysql)); mysql_free_result(mysql_store_result(mysql)); goto err; } From f940fe75cc0ce3b94e269e0691ee01e7ce717cfd Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Tue, 29 Sep 2009 14:38:32 +0100 Subject: [PATCH 43/88] BUG#44663 Unused replication options prevent server from starting. NOTE: Backporting the patch to next-mr. The use of option log_slave_updates without log_bin was preventing the server from starting. To fix the problem, we replaced the error message and the exit call by a warning message. --- sql/mysqld.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9b70096eb73..a57ee04081f 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3819,9 +3819,8 @@ with --log-bin instead."); } if (opt_log_slave_updates && !opt_bin_log) { - sql_print_error("You need to use --log-bin to make " + sql_print_warning("You need to use --log-bin to make " "--log-slave-updates work."); - unireg_abort(1); } if (!opt_bin_log) { @@ -3851,11 +3850,17 @@ with --log-bin instead."); #ifdef HAVE_REPLICATION if (opt_log_slave_updates && replicate_same_server_id) { - sql_print_error("\ -using --replicate-same-server-id in conjunction with \ + if (opt_bin_log) + { + sql_print_error("using --replicate-same-server-id in conjunction with \ --log-slave-updates is impossible, it would lead to infinite loops in this \ server."); - unireg_abort(1); + unireg_abort(1); + } + else + sql_print_warning("using --replicate-same-server-id in conjunction with \ +--log-slave-updates would lead to infinite loops in this server. However this \ +will be ignored as the --log-bin option is not defined."); } #endif From 5280dc82c1c5c0564073c49b377aab4c877dda58 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Tue, 29 Sep 2009 14:55:36 +0100 Subject: [PATCH 44/88] WL#4828 and BUG#45747 NOTE: Backporting the patch to next-mr. WL#4828 Augment DBUG_ENTER/DBUG_EXIT to crash MySQL in different functions ------- The assessment of the replication code in the presence of faults is extremely import to increase reliability. In particular, one needs to know if servers will either correctly recovery or print out appropriate error messages thus avoiding unexpected problems in a production environment. In order to accomplish this, the current patch refactories the debug macros already provided in the source code and introduces three new macros that allows to inject faults, specifically crashes, while entering or exiting a function or method. For instance, to crash a server while returning from the init_slave function (see module sql/slave.cc), one needs to do what follows: 1 - Modify the source replacing DBUG_RETURN by DBUG_CRASH_RETURN; DBUG_CRASH_RETURN(0); 2 - Use the debug variable to activate dbug instructions: SET SESSION debug="+d,init_slave_crash_return"; The new macros are briefly described below: DBUG_CRASH_ENTER (function) is equivalent to DBUG_ENTER which registers the beginning of a function but in addition to it allows for crashing the server while entering the function if the appropriate dbug instruction is activate. In this case, the dbug instruction should be "+d,function_crash_enter". DBUG_CRASH_RETURN (value) is equivalent to DBUG_RETURN which notifies the end of a function but in addition to it allows for crashing the server while returning from the function if the appropriate dbug instruction is activate. In this case, the dbug instruction should be "+d,function_crash_return". Note that "function" should be the same string used by either the DBUG_ENTER or DBUG_CRASH_ENTER. DBUG_CRASH_VOID_RETURN (value) is equivalent to DBUG_VOID_RETURN which notifies the end of a function but in addition to it allows for crashing the server while returning from the function if the appropriate dbug instruction is activate. In this case, the dbug instruction should be "+d,function_crash_return". Note that "function" should be the same string used by either the DBUG_ENTER or DBUG_CRASH_ENTER. To inject other faults, for instance, wrong return values, one should rely on the macros already available. The current patch also removes a set of macros that were either not being used or were redundant as other macros could be used to provide the same feature. In the future, we also consider dynamic instrumentation of the code. BUG#45747 DBUG_CRASH_* is not setting the strict option --------- When combining DBUG_CRASH_* with "--debug=d:t:i:A,file" the server crashes due to a call to the abort function in the DBUG_CRASH_* macro althought the appropriate keyword has not been set. --- dbug/dbug.c | 28 +++++++++++++ include/my_dbug.h | 19 +++++++++ sql/mysql_priv.h | 94 -------------------------------------------- sql/sql_class.cc | 3 -- sql/sql_class.h | 3 -- sql/sql_partition.cc | 4 ++ 6 files changed, 51 insertions(+), 100 deletions(-) diff --git a/dbug/dbug.c b/dbug/dbug.c index baf080f5e27..1ea160852eb 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -1662,6 +1662,27 @@ BOOLEAN _db_keyword_(CODE_STATE *cs, const char *keyword) InList(cs->stack->processes, cs->process)); } +/* + * FUNCTION + * + * _db_keywords_ test keyword formed by a set of strings for member + * of keyword list + * + * DESCRIPTION + * + * This function is similar to _db_keyword but receives a set of strings to + * be concatenated in order to make the keyword to be compared. + */ + +BOOLEAN _db_keywords_(const char *function, const char *type) +{ + char dest[_DBUG_MAX_FUNC_NAME_ + 1]; + + strxnmov(dest, _DBUG_MAX_FUNC_NAME_, function, type, NULL); + + return _db_strict_keyword_(dest); +} + /* * FUNCTION * @@ -2281,6 +2302,13 @@ void _db_unlock_file_() pthread_mutex_unlock(&THR_LOCK_dbug); } +const char* _db_get_func_(void) +{ + CODE_STATE *cs= 0; + get_code_state_or_return NULL; + return cs->func; +} + /* * Here we need the definitions of the clock routine. Add your * own for whatever system that you have. diff --git a/include/my_dbug.h b/include/my_dbug.h index a77e439b5db..7df080bee72 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -22,6 +22,7 @@ extern "C" { #if !defined(DBUG_OFF) && !defined(_lint) struct _db_code_state_; extern int _db_keyword_(struct _db_code_state_ *cs, const char *keyword); +extern int _db_keywords_(const char *, const char *); extern int _db_strict_keyword_(const char *keyword); extern int _db_explain_(struct _db_code_state_ *cs, char *buf, size_t len); extern int _db_explain_init_(char *buf, size_t len); @@ -46,6 +47,7 @@ extern void _db_end_(void); extern void _db_lock_file_(void); extern void _db_unlock_file_(void); extern FILE *_db_fp_(void); +extern const char* _db_get_func_(void); #define DBUG_ENTER(a) const char *_db_func_, *_db_file_; uint _db_level_; \ char **_db_framep_; \ @@ -81,6 +83,20 @@ extern FILE *_db_fp_(void); #define DBUG_EXPLAIN(buf,len) _db_explain_(0, (buf),(len)) #define DBUG_EXPLAIN_INITIAL(buf,len) _db_explain_init_((buf),(len)) #define IF_DBUG(A) A +#define _DBUG_MAX_FUNC_NAME_ 255 +#define DBUG_CHECK_CRASH(func, op) \ + do { \ + if (_db_keywords_((func), (op))) \ + { abort(); } \ + } while (0) +#define DBUG_CRASH_ENTER(func) \ + DBUG_ENTER(func); DBUG_CHECK_CRASH(func, "_crash_enter") +#define DBUG_CRASH_RETURN(val) \ + do {DBUG_CHECK_CRASH(_db_get_func_(), "_crash_return"); \ + DBUG_RETURN(val);} while(0) +#define DBUG_CRASH_VOID_RETURN \ + do {DBUG_CHECK_CRASH (_db_get_func_(), "_crash_return"); \ + DBUG_VOID_RETURN;} while(0) #else /* No debugger */ #define DBUG_ENTER(a1) @@ -108,6 +124,9 @@ extern FILE *_db_fp_(void); #define DBUG_EXPLAIN(buf,len) #define DBUG_EXPLAIN_INITIAL(buf,len) #define IF_DBUG(A) +#define DBUG_CRASH_ENTER(func) +#define DBUG_CRASH_RETURN(val) do { return(val); } while(0) +#define DBUG_CRASH_VOID_RETURN do { return; } while(0) #endif #ifdef __cplusplus } diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 381a0313add..52cfa7934c3 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -938,100 +938,6 @@ struct Query_cache_query_flags #define query_cache_is_cacheable_query(L) 0 #endif /*HAVE_QUERY_CACHE*/ -/* - Error injector Macros to enable easy testing of recovery after failures - in various error cases. -*/ -#ifndef ERROR_INJECT_SUPPORT - -#define ERROR_INJECT(x) 0 -#define ERROR_INJECT_ACTION(x,action) 0 -#define ERROR_INJECT_CRASH(x) 0 -#define ERROR_INJECT_VALUE(x) 0 -#define ERROR_INJECT_VALUE_ACTION(x,action) 0 -#define ERROR_INJECT_VALUE_CRASH(x) 0 -#define SET_ERROR_INJECT_VALUE(x) - -#else - -inline bool check_and_unset_keyword(const char *dbug_str) -{ - const char *extra_str= "-d,"; - char total_str[200]; - if (_db_strict_keyword_ (dbug_str)) - { - strxmov(total_str, extra_str, dbug_str, NullS); - DBUG_SET(total_str); - return 1; - } - return 0; -} - - -inline bool -check_and_unset_inject_value(int value) -{ - THD *thd= current_thd; - if (thd->error_inject_value == (uint)value) - { - thd->error_inject_value= 0; - return 1; - } - return 0; -} - -/* - ERROR INJECT MODULE: - -------------------- - These macros are used to insert macros from the application code. - The event that activates those error injections can be activated - from SQL by using: - SET SESSION dbug=+d,code; - - After the error has been injected, the macros will automatically - remove the debug code, thus similar to using: - SET SESSION dbug=-d,code - from SQL. - - ERROR_INJECT_CRASH will inject a crash of the MySQL Server if code - is set when macro is called. ERROR_INJECT_CRASH can be used in - if-statements, it will always return FALSE unless of course it - crashes in which case it doesn't return at all. - - ERROR_INJECT_ACTION will inject the action specified in the action - parameter of the macro, before performing the action the code will - be removed such that no more events occur. ERROR_INJECT_ACTION - can also be used in if-statements and always returns FALSE. - ERROR_INJECT can be used in a normal if-statement, where the action - part is performed in the if-block. The macro returns TRUE if the - error was activated and otherwise returns FALSE. If activated the - code is removed. - - Sometimes it is necessary to perform error inject actions as a serie - of events. In this case one can use one variable on the THD object. - Thus one sets this value by using e.g. SET_ERROR_INJECT_VALUE(100). - Then one can later test for it by using ERROR_INJECT_CRASH_VALUE, - ERROR_INJECT_ACTION_VALUE and ERROR_INJECT_VALUE. This have the same - behaviour as the above described macros except that they use the - error inject value instead of a code used by DBUG macros. -*/ -#define SET_ERROR_INJECT_VALUE(x) \ - current_thd->error_inject_value= (x) -#define ERROR_INJECT_CRASH(code) \ - DBUG_EVALUATE_IF(code, (abort(), 0), 0) -#define ERROR_INJECT_ACTION(code, action) \ - (check_and_unset_keyword(code) ? ((action), 0) : 0) -#define ERROR_INJECT(code) \ - check_and_unset_keyword(code) -#define ERROR_INJECT_VALUE(value) \ - check_and_unset_inject_value(value) -#define ERROR_INJECT_VALUE_ACTION(value,action) \ - (check_and_unset_inject_value(value) ? (action) : 0) -#define ERROR_INJECT_VALUE_CRASH(value) \ - ERROR_INJECT_VALUE_ACTION(value, (abort(), 0)) - -#endif - void write_bin_log(THD *thd, bool clear_error, char const *query, ulong query_length); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 3f568566c89..6c2133ae6c8 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -586,9 +586,6 @@ THD::THD() limit_found_rows= 0; row_count_func= -1; statement_id_counter= 0UL; -#ifdef ERROR_INJECT_SUPPORT - error_inject_value= 0UL; -#endif // Must be reset to handle error with THD's created for init of mysqld lex->current_select= 0; start_time=(time_t) 0; diff --git a/sql/sql_class.h b/sql/sql_class.h index 49f9bc3fd5e..47b51559ed1 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1720,9 +1720,6 @@ public: query_id_t query_id, warn_id; ulong col_access; -#ifdef ERROR_INJECT_SUPPORT - ulong error_inject_value; -#endif /* Statement id is thread-wide. This counter is used to generate ids */ ulong statement_id_counter; ulong rand_saved_seed1, rand_saved_seed2; diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 08ff2daacb9..a4c0f02e480 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -40,6 +40,10 @@ #ifdef WITH_PARTITION_STORAGE_ENGINE #include "ha_partition.h" + +#define ERROR_INJECT_CRASH(code) \ + DBUG_EVALUATE_IF(code, (abort(), 0), 0) + /* Partition related functions declarations and some static constants; */ From bbc830f7fce965a3aa6055a4bf7bea5712eaebf5 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Tue, 29 Sep 2009 15:04:21 +0100 Subject: [PATCH 45/88] BUG#38173 Field doesn't have a default value with row-based replication NOTE: Backporting the patch to next-mr. The reason of the bug was incompatibile with the master side behaviour. INSERT query on the master is allowed to insert into a table without specifying values of DEFAULT-less fields if sql_mode is not strict. Fixed with checking sql_mode by the sql thread to decide how to react. Non-strict sql_mode should allow Write_rows event to complete. todo: warnings can be shown via show slave status, still this is a separate rather general issue how to show warnings for the slave threads. --- .../extra/rpl_tests/rpl_extraSlave_Col.test | 35 +++++++++---- .../extra/rpl_tests/rpl_row_tabledefs.test | 15 +++--- .../suite/rpl/r/rpl_extraCol_innodb.result | 52 ++++--------------- .../suite/rpl/r/rpl_extraCol_myisam.result | 52 ++++--------------- .../rpl/r/rpl_row_tabledefs_2myisam.result | 44 ++-------------- .../rpl/r/rpl_row_tabledefs_3innodb.result | 44 ++-------------- sql/log_event.cc | 5 +- sql/rpl_record.cc | 34 ++++++++---- sql/rpl_record.h | 3 +- 9 files changed, 88 insertions(+), 196 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test index a7b02065144..1eaefa661f9 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test @@ -407,13 +407,18 @@ sync_slave_with_master; ########################################### # Bug#22234, Bug#23907 Extra Slave Col is not # erroring on extra col with no default values. -######################################################## +############################################################### +# Error reaction is up to sql_mode of the slave sql (bug#38173) #--echo *** Create t9 on slave *** STOP SLAVE; RESET SLAVE; eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), d TIMESTAMP, - e INT NOT NULL) ENGINE=$engine_type; + e INT NOT NULL, + f text not null, + g text, + h blob not null, + i blob) ENGINE=$engine_type; --echo *** Create t9 on Master *** connection master; @@ -431,13 +436,25 @@ set @b1 = 'b1b1b1b1'; set @b1 = concat(@b1,@b1); INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); -connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +# the test would stop slave if @@sql_mode for the sql thread +# was set to strict. Otherwise, as with this tests setup, +# the implicit defaults will be inserted into fields even though +# they are declared without DEFAULT clause. + +sync_slave_with_master; +select * from t9; + +# todo: fix Bug #43992 slave sql thread can't tune own sql_mode ... +# and add/restore waiting for stop test + +#--source include/wait_for_slave_sql_to_stop.inc +#--replace_result $MASTER_MYPORT MASTER_PORT +#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # +#--query_vertical SHOW SLAVE STATUS +#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; +#START SLAVE; + + #--echo *** Drop t9 *** #connection master; diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test index 3b03caee35c..083088f12ff 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test +++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test @@ -111,21 +111,18 @@ SELECT a,b,x FROM t1_int ORDER BY a; SELECT a,b,HEX(x),HEX(y),HEX(z) FROM t1_bit ORDER BY a; SELECT a,b,x FROM t1_char ORDER BY a; -# Each of these inserts should generate an error and stop the slave - connection master; INSERT INTO t9 VALUES (2); sync_slave_with_master; # Now slave is guaranteed to be running connection master; INSERT INTO t1_nodef VALUES (1,2); -connection slave; ---source include/wait_for_slave_sql_to_stop.inc ---replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 4 # 7 # 8 # 9 # 20 22 # 23 # 33 # 35 36 38 ---query_vertical SHOW SLAVE STATUS -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; + +# Last insert on wider slave table succeeds while slave sql sql_mode permits. +# The previous version of the above test expected slave sql to stop. +# bug#38173 relaxed conditions to stop only with the strict mode. +sync_slave_with_master; +select count(*) from t1_nodef; # # Replicating to tables with fewer columns at the end works as of WL#3228 diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result index e2ec78e7adc..63154383e8c 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result @@ -404,7 +404,11 @@ STOP SLAVE; RESET SLAVE; CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), d TIMESTAMP, -e INT NOT NULL) ENGINE='InnoDB'; +e INT NOT NULL, +f text not null, +g text, +h blob not null, +i blob) ENGINE='InnoDB'; *** Create t9 on Master *** CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) ) ENGINE='InnoDB'; @@ -415,47 +419,11 @@ START SLAVE; set @b1 = 'b1b1b1b1'; set @b1 = concat(@b1,@b1); INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); -SHOW SLAVE STATUS; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port # -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table # -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 1364 -Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330 -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno # -Last_IO_Error # -Last_SQL_Errno 1364 -Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +select * from t9; +a b c d e f g h i +1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL +2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL +3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL *** Create t10 on slave *** STOP SLAVE; RESET SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result index ed5b4eac27d..d80ac5eea2c 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result @@ -404,7 +404,11 @@ STOP SLAVE; RESET SLAVE; CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), d TIMESTAMP, -e INT NOT NULL) ENGINE='MyISAM'; +e INT NOT NULL, +f text not null, +g text, +h blob not null, +i blob) ENGINE='MyISAM'; *** Create t9 on Master *** CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) ) ENGINE='MyISAM'; @@ -415,47 +419,11 @@ START SLAVE; set @b1 = 'b1b1b1b1'; set @b1 = concat(@b1,@b1); INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); -SHOW SLAVE STATUS; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port # -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table # -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 1364 -Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330 -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno # -Last_IO_Error # -Last_SQL_Errno 1364 -Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 330 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +select * from t9; +a b c d e f g h i +1 b1b1b1b1b1b1b1b1 Kyle 0000-00-00 00:00:00 0 NULL NULL +2 b1b1b1b1b1b1b1b1 JOE 0000-00-00 00:00:00 0 NULL NULL +3 b1b1b1b1b1b1b1b1 QA 0000-00-00 00:00:00 0 NULL NULL *** Create t10 on slave *** STOP SLAVE; RESET SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result index a6a2181cd2a..bb9865ab2d1 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result @@ -105,47 +105,9 @@ a b x 2 10 Foo is a bar INSERT INTO t9 VALUES (2); INSERT INTO t1_nodef VALUES (1,2); -SHOW SLAVE STATUS; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port # -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 1364 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno -Last_IO_Error -Last_SQL_Errno 1364 -Last_SQL_Error -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +select count(*) from t1_nodef; +count(*) +1 INSERT INTO t9 VALUES (2); **** On Master **** INSERT INTO t2 VALUES (2,4); diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result index 02e8c074354..f606a28c2d9 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result @@ -105,47 +105,9 @@ a b x 2 10 Foo is a bar INSERT INTO t9 VALUES (2); INSERT INTO t1_nodef VALUES (1,2); -SHOW SLAVE STATUS; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port # -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 1364 -Last_Error -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno -Last_IO_Error -Last_SQL_Errno 1364 -Last_SQL_Error -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; +select count(*) from t1_nodef; +count(*) +1 INSERT INTO t9 VALUES (2); **** On Master **** INSERT INTO t2 VALUES (2,4); diff --git a/sql/log_event.cc b/sql/log_event.cc index fb6a5230fda..d595f00bffd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -8446,7 +8446,10 @@ Rows_log_event::write_row(const Relay_log_info *const rli, /* fill table->record[0] with default values */ if ((error= prepare_record(table, m_width, - TRUE /* check if columns have def. values */))) + table->file->ht->db_type != DB_TYPE_NDBCLUSTER, + (rli->sql_thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | + MODE_STRICT_ALL_TABLES))))) DBUG_RETURN(error); /* unpack row into table->record[0] */ diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 14a80cbb4b6..f4768e2456a 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -305,13 +305,17 @@ unpack_row(Relay_log_info const *rli, @param table Table whose record[0] buffer is prepared. @param skip Number of columns for which default/nullable check should be skipped. - @param check Indicates if errors should be raised when checking - default/nullable field properties. + @param check Specifies if lack of default error needs checking. + @param abort_on_warning + Controls how to react on lack of a field's default. + The parameter mimics the master side one for + @c check_that_all_fields_are_given_values. @returns 0 on success or a handler level error code */ int prepare_record(TABLE *const table, - const uint skip, const bool check) + const uint skip, const bool check, + const bool abort_on_warning) { DBUG_ENTER("prepare_record"); @@ -326,17 +330,27 @@ int prepare_record(TABLE *const table, if (skip >= table->s->fields || !check) DBUG_RETURN(0); - /* Checking if exists default/nullable fields in the default values. */ - - for (Field **field_ptr= table->field+skip ; *field_ptr ; ++field_ptr) + /* + For fields the extra fields on the slave, we check if they have a default. + The check follows the same rules as the INSERT query without specifying an + explicit value for a field not having the explicit default + (@c check_that_all_fields_are_given_values()). + */ + for (Field **field_ptr= table->field+skip; *field_ptr; ++field_ptr) { uint32 const mask= NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG; Field *const f= *field_ptr; - - if (((f->flags & mask) == mask)) + if ((f->flags & NO_DEFAULT_VALUE_FLAG) && + (f->real_type() != MYSQL_TYPE_ENUM)) { - my_error(ER_NO_DEFAULT_FOR_FIELD, MYF(0), f->field_name); - error = HA_ERR_ROWS_EVENT_APPLY; + push_warning_printf(current_thd, abort_on_warning? + MYSQL_ERROR::WARN_LEVEL_ERROR : + MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NO_DEFAULT_FOR_FIELD, + ER(ER_NO_DEFAULT_FOR_FIELD), + f->field_name); + if (abort_on_warning) + error = HA_ERR_ROWS_EVENT_APPLY; } } diff --git a/sql/rpl_record.h b/sql/rpl_record.h index f9e64f0ab1d..ab2bcd382ca 100644 --- a/sql/rpl_record.h +++ b/sql/rpl_record.h @@ -30,7 +30,8 @@ int unpack_row(Relay_log_info const *rli, uchar const **const row_end, ulong *const master_reclength); // Fill table's record[0] with default values. -int prepare_record(TABLE *const, const uint =0, const bool =FALSE); +int prepare_record(TABLE *const table, const uint skip, const bool check, + const bool abort_on_warning= FALSE); #endif #endif From 7cf996223d12dc4049ebccb9ccc80df7ece9e091 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 29 Sep 2009 15:09:01 +0100 Subject: [PATCH 46/88] BUG#23300: Slow query log on slave does not log slow replicated statements NOTE: this is the backport to next-mr. When using replication, the slave will not log any slow query logs queries replicated from the master, even if the option "--log-slow-slave-statements" is set and these take more than "log_query_time" to execute. In order to log slow queries in replicated thread one needs to set the --log-slow-slave-statements, so that the SQL thread is initialized with the correct switch. Although setting this flag correctly configures the slave thread option to log slow queries, there is an issue with the condition that is used to check whether to log the slow query or not. When replaying binlog events the statement contains the SET TIMESTAMP clause which will force the slow logging condition check to fail. Consequently, the slow query logging will not take place. This patch addresses this issue by removing the second condition from the log_slow_statements as it prevents slow queries to be binlogged and seems to be deprecated. --- .../suite/rpl/r/rpl_slow_query_log.result | 47 +++++ .../suite/rpl/t/rpl_slow_query_log-slave.opt | 1 + .../suite/rpl/t/rpl_slow_query_log.test | 187 ++++++++++++++++++ sql/log.cc | 1 + sql/sql_parse.cc | 4 +- 5 files changed, 238 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_slow_query_log.result create mode 100644 mysql-test/suite/rpl/t/rpl_slow_query_log-slave.opt create mode 100644 mysql-test/suite/rpl/t/rpl_slow_query_log.test diff --git a/mysql-test/suite/rpl/r/rpl_slow_query_log.result b/mysql-test/suite/rpl/r/rpl_slow_query_log.result new file mode 100644 index 00000000000..ced357b21e9 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_slow_query_log.result @@ -0,0 +1,47 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +include/stop_slave.inc +SET @old_log_output= @@log_output; +SET GLOBAL log_output= 'TABLE'; +SET @old_long_query_time= @@long_query_time; +SET GLOBAL long_query_time= 2; +TRUNCATE mysql.slow_log; +include/start_slave.inc +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 values(1, 1); +INSERT INTO t1 values(1, sleep(3)); +TRUNCATE mysql.slow_log; +SELECT 1, sleep(3); +1 sleep(3) +1 0 +SELECT 1; +1 +1 +TRUNCATE mysql.slow_log; +SET TIMESTAMP= 1; +SELECT 2, sleep(3); +2 sleep(3) +2 0 +SELECT 2; +2 +2 +TRUNCATE mysql.slow_log; +SET @old_slow_query_log= @@slow_query_log; +SET GLOBAL slow_query_log= 'OFF'; +SELECT 3, sleep(3); +3 sleep(3) +3 0 +SELECT 3; +3 +3 +TRUNCATE mysql.slow_log; +SET GLOBAL slow_query_log= @old_slow_query_log; +DROP TABLE t1; +include/stop_slave.inc +SET GLOBAL long_query_time= @old_long_query_time; +SET GLOBAL log_output= @old_log_output; +include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log-slave.opt b/mysql-test/suite/rpl/t/rpl_slow_query_log-slave.opt new file mode 100644 index 00000000000..a27d3a0f5a7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log-slave.opt @@ -0,0 +1 @@ +--force-restart --log-slow-slave-statements --log-slow-queries diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test new file mode 100644 index 00000000000..1d5fcf950f2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test @@ -0,0 +1,187 @@ +# +# BUG#23300: Slow query log on slave does not log slow replicated statements +# +# Description: +# The slave should log slow queries replicated from master when +# --log-slow-slave-statements is used. +# +# Test is implemented as follows: +# i) stop slave +# ii) On slave, set long_query_time to a small value. +# ii) start slave so that long_query_time variable is picked by sql thread +# iii) On master, do one short time query and one long time query, on slave +# and check that slow query is logged to slow query log but fast query +# is not. +# iv) On slave, check that slow queries go into the slow log and fast dont, +# when issued through a regular client connection +# v) On slave, check that slow queries go into the slow log and fast dont +# when we use SET TIMESTAMP= 1 on a regular client connection. +# vi) check that when setting slow_query_log= OFF in a connection 'extra2' +# prevents logging slow queries in a connection 'extra' +# +# OBS: +# This test only runs for statement and mixed binlogging firmat because on +# row format slow queries do not get slow query logged. + +source include/master-slave.inc; +source include/have_binlog_format_mixed_or_statement.inc; + + +# Prepare slave for different long_query_time we need to stop the slave +# and restart it as long_query_time variable is dynamic and, after +# setting it, it only takes effect on new connections. +# +# Reference: +# http://dev.mysql.com/doc/refman/6.0/en/set-option.html +connection slave; + +source include/stop_slave.inc; + +SET @old_log_output= @@log_output; +SET GLOBAL log_output= 'TABLE'; +SET @old_long_query_time= @@long_query_time; +SET GLOBAL long_query_time= 2; +TRUNCATE mysql.slow_log; + +source include/start_slave.inc; + +connection master; +CREATE TABLE t1 (a int, b int); + +# test: +# check that slave logs the slow query to the slow log, but not the fast one. + +let $slow_query= INSERT INTO t1 values(1, sleep(3)); +let $fast_query= INSERT INTO t1 values(1, 1); + +eval $fast_query; +eval $slow_query; +sync_slave_with_master; + +let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`; +let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`; + +if ($found_fast_query) +{ + SELECT * FROM mysql.slow_log; + die "Assertion failed! Fast query FOUND in slow query log. Bailing out!"; +} + +if (!$found_slow_query) +{ + SELECT * FROM mysql.slow_log; + die "Assertion failed! Slow query NOT FOUND in slow query log. Bailing out!"; +} +TRUNCATE mysql.slow_log; + +# regular checks for slow query log (using a new connection - 'extra' - to slave) + +# test: +# when using direct connections to the slave, check that slow query is logged +# but not the fast one. + +connect(extra,127.0.0.1,root,,test,$SLAVE_MYPORT); +connection extra; + +let $fast_query= SELECT 1; +let $slow_query= SELECT 1, sleep(3); + +eval $slow_query; +eval $fast_query; + +let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`; +let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`; + +if ($found_fast_query) +{ + SELECT * FROM mysql.slow_log; + die "Assertion failed! Fast query FOUND in slow query log. Bailing out!"; +} + +if (!$found_slow_query) +{ + SELECT * FROM mysql.slow_log; + die "Assertion failed! Slow query NOT FOUND in slow query log. Bailing out!"; +} +TRUNCATE mysql.slow_log; + +# test: +# when using direct connections to the slave, check that when setting timestamp to 1 the +# slow query is logged but the fast one is not. + +let $fast_query= SELECT 2; +let $slow_query= SELECT 2, sleep(3); + +SET TIMESTAMP= 1; +eval $slow_query; +eval $fast_query; + +let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`; +let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`; + +if ($found_fast_query) +{ + SELECT * FROM mysql.slow_log; + die "Assertion failed! Fast query FOUND in slow query log. Bailing out!"; +} + +if (!$found_slow_query) +{ + SELECT * FROM mysql.slow_log; + die "Assertion failed! Slow query NOT FOUND in slow query log. Bailing out!"; +} +TRUNCATE mysql.slow_log; + +# test: +# check that when setting the slow_query_log= OFF on connection 'extra2' +# prevents connection 'extra' from logging to slow query log. + +let $fast_query= SELECT 3; +let $slow_query= SELECT 3, sleep(3); + +connect(extra2,127.0.0.1,root,,test,$SLAVE_MYPORT); +connection extra2; + +SET @old_slow_query_log= @@slow_query_log; +SET GLOBAL slow_query_log= 'OFF'; + +connection extra; + +eval $slow_query; +eval $fast_query; + +let $found_fast_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$fast_query'`; +let $found_slow_query= `SELECT count(*) = 1 FROM mysql.slow_log WHERE sql_text like '$slow_query'`; + +if ($found_fast_query) +{ + SELECT * FROM mysql.slow_log; + die "Assertion failed! Fast query FOUND in slow query log when slow_query_log= OFF. Bailing out!"; +} + +if ($found_slow_query) +{ + SELECT * FROM mysql.slow_log; + die "Assertion failed! Slow query FOUND in slow query log when slow_query_log= OFF. Bailing out!"; +} +TRUNCATE mysql.slow_log; + +# clean up: drop tables, reset the variables back to the previous value, +# disconnect extra connections +connection extra2; + +SET GLOBAL slow_query_log= @old_slow_query_log; + +connection master; +DROP TABLE t1; +sync_slave_with_master; + +source include/stop_slave.inc; + +SET GLOBAL long_query_time= @old_long_query_time; +SET GLOBAL log_output= @old_log_output; + +source include/start_slave.inc; + +disconnect extra; +disconnect extra2; diff --git a/sql/log.cc b/sql/log.cc index 1af2f3a4ddc..5c25d30bad0 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -961,6 +961,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length, uint user_host_len= 0; ulonglong query_utime, lock_utime; + DBUG_ASSERT(thd->enable_slow_log); /* Print the message to the buffer if we have slow log enabled */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 513b9230c37..d0897646cec 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1615,9 +1615,9 @@ void log_slow_statement(THD *thd) /* Do not log administrative statements unless the appropriate option is - set; do not log into slow log if reading from backup. + set. */ - if (thd->enable_slow_log && !thd->user_time) + if (thd->enable_slow_log) { ulonglong end_utime_of_query= thd->current_utime(); thd_proc_info(thd, "logging slow query"); From 19ac26274b390b722fffac18f2eb67bbe984f2a8 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 29 Sep 2009 15:09:46 +0100 Subject: [PATCH 47/88] BUG#28796: CHANGE MASTER TO MASTER_HOST="" leads to invalid master.info NOTE: this is the backport to next-mr. This patch addresses the bug reported by checking wether host argument is an empty string or not. If empty, an error is reported to the client, otherwise continue normally. This commit is based on the originally proposed patch and adds a test case as requested during review as well as refines comments, and makes test case result file less verbose (compared to previous patch). --- .../suite/rpl/r/rpl_empty_master_host.result | 16 ++++++ .../suite/rpl/t/rpl_empty_master_host.test | 51 +++++++++++++++++++ sql/sql_repl.cc | 13 +++++ 3 files changed, 80 insertions(+) create mode 100644 mysql-test/suite/rpl/r/rpl_empty_master_host.result create mode 100644 mysql-test/suite/rpl/t/rpl_empty_master_host.test diff --git a/mysql-test/suite/rpl/r/rpl_empty_master_host.result b/mysql-test/suite/rpl/r/rpl_empty_master_host.result new file mode 100644 index 00000000000..46ef32d415b --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_empty_master_host.result @@ -0,0 +1,16 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +STOP SLAVE; +Master_Host = '127.0.0.1' (expected '127.0.0.1') +CHANGE MASTER TO MASTER_HOST=""; +ERROR HY000: Incorrect arguments to MASTER_HOST +Master_Host = '127.0.0.1' (expected '127.0.0.1') +CHANGE MASTER TO MASTER_HOST="foo"; +Master_Host = 'foo' (expected 'foo') +CHANGE MASTER TO MASTER_HOST="127.0.0.1"; +Master_Host = '127.0.0.1' (expected '127.0.0.1') +START SLAVE; diff --git a/mysql-test/suite/rpl/t/rpl_empty_master_host.test b/mysql-test/suite/rpl/t/rpl_empty_master_host.test new file mode 100644 index 00000000000..7d245b1d5d5 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_empty_master_host.test @@ -0,0 +1,51 @@ +# +# BUG +# --- +# BUG#28796: CHANGE MASTER TO MASTER_HOST="" leads to invalid master.info +# +# Description +# ----------- +# +# This test aims at: +# i) verifying that an error is thrown when setting MASTER_HOST='' +# ii) no error is thrown when setting non empty MASTER_HOST +# iii) replication works after setting a correct host name/ip +# +# Implementation is performed by feeding different values (according +# to i), ii) and iii) ) to CHANGE MASTER TO MASTER_HOST= x and checking +# along the way if error/no error is thrown and/or if replication starts +# working when expected. + +--source include/master-slave.inc + +connection slave; +STOP SLAVE; +--source include/wait_for_slave_to_stop.inc + +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master_Host = '$master_host' (expected '127.0.0.1') + +# attempt to change to an empty master host should +# result in error ER_WRONG_ARGUMENTS: "Incorrect arguments to ..." +error ER_WRONG_ARGUMENTS; +CHANGE MASTER TO MASTER_HOST=""; + +# show slave status still holds previous information +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master_Host = '$master_host' (expected '127.0.0.1') + +# changing master to other than empty master host succeeds +CHANGE MASTER TO MASTER_HOST="foo"; + +# show slave status should hold "foo" as master host +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master_Host = '$master_host' (expected 'foo') + +# changing back to localhost +CHANGE MASTER TO MASTER_HOST="127.0.0.1"; +let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1); +--echo Master_Host = '$master_host' (expected '127.0.0.1') + +# start slave must succeed. +START SLAVE; +--source include/wait_for_slave_to_start.inc diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 4d9b7410b88..1cc21162022 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1150,6 +1150,19 @@ bool change_master(THD* thd, Master_info* mi) thd_proc_info(thd, "Changing master"); LEX_MASTER_INFO* lex_mi= &thd->lex->mi; + /* + We need to check if there is an empty master_host. Otherwise + change master succeeds, a master.info file is created containing + empty master_host string and when issuing: start slave; an error + is thrown stating that the server is not configured as slave. + (See BUG#28796). + */ + if(lex_mi->host && !*lex_mi->host) + { + my_error(ER_WRONG_ARGUMENTS, MYF(0), "MASTER_HOST"); + unlock_slave_threads(mi); + DBUG_RETURN(TRUE); + } // TODO: see if needs re-write if (init_master_info(mi, master_info_file, relay_log_info_file, 0, thread_mask)) From ca151daf85f1e5e8af957157855e9c6de20555e3 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 29 Sep 2009 15:10:37 +0100 Subject: [PATCH 48/88] Bug #30703 SHOW STATUS LIKE 'Slave_running' is not compatible with `SHOW SLAVE STATUS' NOTE: this is the backport to next-mr. SHOW SHOW STATUS LIKE 'Slave_running' command believes that if active_mi->slave_running != 0, then io thread is running normally. But it isn't so in fact. When some errors happen to make io thread try to reconnect master, then it will become transitional status (MYSQL_SLAVE_RUN_NOT_CONNECT == 1), which also doesn't equal 0. Yet, "SHOW SLAVE STATUS" believes that only if active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT, then io thread is running. So "SHOW SLAVE STATUS" can get the correct result. Fixed to make SHOW SHOW STATUS LIKE 'Slave_running' command have the same check condition with "SHOW SLAVE STATUS". It only believe that the io thread is running when active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT. --- mysql-test/include/test_fieldsize.inc | 2 +- sql/mysqld.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/include/test_fieldsize.inc b/mysql-test/include/test_fieldsize.inc index cbe63e26318..606bc63779d 100644 --- a/mysql-test/include/test_fieldsize.inc +++ b/mysql-test/include/test_fieldsize.inc @@ -22,7 +22,7 @@ eval $test_insert; connection slave; START SLAVE; -wait_for_slave_to_stop; +--source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # --query_vertical SHOW SLAVE STATUS diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9b70096eb73..9ae3db4762b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7043,7 +7043,8 @@ static int show_slave_running(THD *thd, SHOW_VAR *var, char *buff) var->type= SHOW_MY_BOOL; pthread_mutex_lock(&LOCK_active_mi); var->value= buff; - *((my_bool *)buff)= (my_bool) (active_mi && active_mi->slave_running && + *((my_bool *)buff)= (my_bool) (active_mi && + active_mi->slave_running == MYSQL_SLAVE_RUN_CONNECT && active_mi->rli.slave_running); pthread_mutex_unlock(&LOCK_active_mi); return 0; From bdacc5622ece6bc5a32e66e4d88b2ecb6fd60e72 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 29 Sep 2009 15:12:07 +0100 Subject: [PATCH 49/88] BUG#40611: MySQL cannot make a binary log after sequential number beyond unsigned long. BUG#44779: binlog.binlog_max_extension may be causing failure on next test in PB NOTE1: this is the backport to next-mr. NOTE2: already includes patch for BUG#44779. Binlog file extensions would turn into negative numbers once the variable used to hold the value reached maximum for signed long. Consequently, incrementing value to the next (negative) number would lead to .000000 extension, causing the server to fail. This patch addresses this issue by not allowing negative extensions and by returning an error on find_uniq_filename, when the limit is reached. Additionally, warnings are printed to the error log when the limit is approaching. FLUSH LOGS will also report warnings to the user, if the extension number has reached the limit. The limit has been set to 0x7FFFFFFF as the maximum. --- .../binlog/r/binlog_max_extension.result | 8 ++ .../suite/binlog/t/binlog_max_extension.test | 92 +++++++++++++++++++ sql/log.cc | 75 ++++++++++++--- sql/log.h | 13 +++ 4 files changed, 174 insertions(+), 14 deletions(-) create mode 100644 mysql-test/suite/binlog/r/binlog_max_extension.result create mode 100644 mysql-test/suite/binlog/t/binlog_max_extension.test diff --git a/mysql-test/suite/binlog/r/binlog_max_extension.result b/mysql-test/suite/binlog/r/binlog_max_extension.result new file mode 100644 index 00000000000..af341db4536 --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_max_extension.result @@ -0,0 +1,8 @@ +call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0."); +call mtr.add_suppression("Log filename extension number exhausted:"); +call mtr.add_suppression("Can't generate a unique log-filename"); +RESET MASTER; +FLUSH LOGS; +Warnings: +Warning 1098 Can't generate a unique log-filename master-bin.(1-999) + diff --git a/mysql-test/suite/binlog/t/binlog_max_extension.test b/mysql-test/suite/binlog/t/binlog_max_extension.test new file mode 100644 index 00000000000..9f52d195e21 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_max_extension.test @@ -0,0 +1,92 @@ +# BUG#40611: MySQL cannot make a binary log after sequential number beyond +# unsigned long. +# +# Problem statement +# ================= +# +# Extension for log file names might be created with negative +# numbers (when counter used would wrap around), causing server +# failure when incrementing -00001 (reaching number 000000 +# extension). +# +# Test +# ==== +# This tests aims at testing the a patch that removes negatives +# numbers from log name extensions and checks that the server +# reports gracefully that the limit has been reached. +# +# It instruments index file to point to a log file close to +# the new maximum and calls flush logs to get warning. +# + +call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0."); +call mtr.add_suppression("Log filename extension number exhausted:"); +call mtr.add_suppression("Can't generate a unique log-filename"); + + +-- source include/have_log_bin.inc +RESET MASTER; + +-- let $MYSQLD_DATADIR= `select @@datadir` + +############################################### +# check hitting maximum file name extension: +############################################### + +########## +# Prepare +########## + +# 1. Stop master server +-- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF +-- shutdown_server 10 +-- source include/wait_until_disconnected.inc + +# 2. Prepare log and index file +-- copy_file $MYSQLD_DATADIR/master-bin.index $MYSQLD_DATADIR/master-bin.index.orig +-- copy_file $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.2147483646 +-- append_file $MYSQLD_DATADIR/master-bin.index +master-bin.2147483646 +EOF + +# 3. Restart the server +-- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF +-- enable_reconnect +-- source include/wait_until_connected_again.inc + +########### +# Assertion +########### + +# assertion: should throw warning +FLUSH LOGS; + +############## +# Clean up +############## + +# 1. Stop the server +-- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF +-- shutdown_server 10 +-- source include/wait_until_disconnected.inc + +# 2. Undo changes to index and log files +-- remove_file $MYSQLD_DATADIR/master-bin.index +-- copy_file $MYSQLD_DATADIR/master-bin.index.orig $MYSQLD_DATADIR/master-bin.index +-- remove_file $MYSQLD_DATADIR/master-bin.index.orig + +-- remove_file $MYSQLD_DATADIR/master-bin.2147483646 +-- remove_file $MYSQLD_DATADIR/master-bin.2147483647 + +# 3. Restart the server +-- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF +-- enable_reconnect +-- source include/wait_until_connected_again.inc diff --git a/sql/log.cc b/sql/log.cc index 5c25d30bad0..19b26fcf5ab 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -53,7 +53,7 @@ MYSQL_BIN_LOG mysql_bin_log; ulong sync_binlog_counter= 0; static bool test_if_number(const char *str, - long *res, bool allow_wildcards); + ulong *res, bool allow_wildcards); static int binlog_init(void *p); static int binlog_close_connection(handlerton *hton, THD *thd); static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv); @@ -1835,22 +1835,27 @@ static void setup_windows_event_source() /** Find a unique filename for 'filename.#'. - Set '#' to a number as low as possible. + Set '#' to the number next to the maximum found in the most + recent log file extension. + + This function will return nonzero if: (i) the generated name + exceeds FN_REFLEN; (ii) if the number of extensions is exhausted; + or (iii) some other error happened while examining the filesystem. @return - nonzero if not possible to get unique filename + nonzero if not possible to get unique filename. */ static int find_uniq_filename(char *name) { - long number; uint i; - char buff[FN_REFLEN]; + char buff[FN_REFLEN], ext_buf[FN_REFLEN]; struct st_my_dir *dir_info; reg1 struct fileinfo *file_info; - ulong max_found=0; + ulong max_found= 0, next= 0, number= 0; size_t buf_length, length; char *start, *end; + int error= 0; DBUG_ENTER("find_uniq_filename"); length= dirname_part(buff, name, &buf_length); @@ -1858,15 +1863,15 @@ static int find_uniq_filename(char *name) end= strend(start); *end='.'; - length= (size_t) (end-start+1); + length= (size_t) (end - start + 1); - if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT)))) + if (!(dir_info= my_dir(buff,MYF(MY_DONT_SORT)))) { // This shouldn't happen strmov(end,".1"); // use name+1 - DBUG_RETURN(0); + DBUG_RETURN(1); } file_info= dir_info->dir_entry; - for (i=dir_info->number_off_files ; i-- ; file_info++) + for (i= dir_info->number_off_files ; i-- ; file_info++) { if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 && test_if_number(file_info->name+length, &number,0)) @@ -1876,9 +1881,44 @@ static int find_uniq_filename(char *name) } my_dirend(dir_info); + /* check if reached the maximum possible extension number */ + if ((max_found == MAX_LOG_UNIQUE_FN_EXT)) + { + sql_print_error("Log filename extension number exhausted: %06lu. \ +Please fix this by archiving old logs and \ +updating the index files.", max_found); + error= 1; + goto end; + } + + next= max_found + 1; + sprintf(ext_buf, "%06lu", next); *end++='.'; - sprintf(end,"%06ld",max_found+1); - DBUG_RETURN(0); + + /* + Check if the generated extension size + the file name exceeds the + buffer size used. If one did not check this, then the filename might be + truncated, resulting in error. + */ + if (((strlen(ext_buf) + (end - name)) >= FN_REFLEN)) + { + sql_print_error("Log filename too large: %s%s (%d). \ +Please fix this by archiving old logs and updating the \ +index files.", name, ext_buf, (strlen(ext_buf) + (end - name))); + error= 1; + goto end; + } + + sprintf(end, "%06lu", next); + + /* print warning if reaching the end of available extensions. */ + if ((next > (MAX_LOG_UNIQUE_FN_EXT - LOG_WARN_UNIQUE_FN_EXT_LEFT))) + sql_print_warning("Next log extension: %lu. \ +Remaining log filename extensions: %lu. \ +Please consider archiving some logs.", next, (MAX_LOG_UNIQUE_FN_EXT - next)); + +end: + DBUG_RETURN(error); } @@ -2077,6 +2117,13 @@ int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name) { if (find_uniq_filename(new_name)) { + /* + This should be treated as error once propagation of error further + up in the stack gets proper handling. + */ + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_NO_UNIQUE_LOGFILE, ER(ER_NO_UNIQUE_LOGFILE), + log_name); sql_print_error(ER(ER_NO_UNIQUE_LOGFILE), log_name); return 1; } @@ -4739,11 +4786,11 @@ void MYSQL_BIN_LOG::set_max_size(ulong max_size_arg) @retval 1 String is a number @retval - 0 Error + 0 String is not a number */ static bool test_if_number(register const char *str, - long *res, bool allow_wildcards) + ulong *res, bool allow_wildcards) { reg2 int flag; const char *start; diff --git a/sql/log.h b/sql/log.h index d306d6f7182..3c2ccc521cc 100644 --- a/sql/log.h +++ b/sql/log.h @@ -121,6 +121,19 @@ extern TC_LOG_DUMMY tc_log_dummy; #define LOG_CLOSE_TO_BE_OPENED 2 #define LOG_CLOSE_STOP_EVENT 4 +/* + Maximum unique log filename extension. + Note: setting to 0x7FFFFFFF due to atol windows + overflow/truncate. + */ +#define MAX_LOG_UNIQUE_FN_EXT 0x7FFFFFFF + +/* + Number of warnings that will be printed to error log + before extension number is exhausted. +*/ +#define LOG_WARN_UNIQUE_FN_EXT_LEFT 1000 + class Relay_log_info; typedef struct st_log_info From a11e2137c241a3e5e588c4f48659d3f7a856f51e Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Tue, 29 Sep 2009 15:12:43 +0100 Subject: [PATCH 50/88] BUG#42928: binlog-format setting prevents server from start if binary logging is disabled NOTE: this is the backport to next-mr. If one sets binlog-format but does NOT enable binary log, server refuses to start up. The following messages appears in the error log: 090217 12:47:14 [ERROR] You need to use --log-bin to make --binlog-format work. 090217 12:47:14 [ERROR] Aborting This patch addresses this by making the server not to bail out if the binlog-format is set without the log-bin option. Additionally, the specified binlog-format is stored, in the global system variable "binlog_format", and a warning is printed instead of an error. --- sql/mysqld.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 9ae3db4762b..513302b6aec 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3827,9 +3827,10 @@ with --log-bin instead."); { if (opt_binlog_format_id != BINLOG_FORMAT_UNSPEC) { - sql_print_error("You need to use --log-bin to make " - "--binlog-format work."); - unireg_abort(1); + sql_print_warning("You need to use --log-bin to make " + "--binlog-format work."); + + global_system_variables.binlog_format= opt_binlog_format_id; } else { From 63278c561cd6b24a622cab9e2674dd272b24f061 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Tue, 29 Sep 2009 15:18:44 +0100 Subject: [PATCH 51/88] BUG#43789 different master/slave table defs cause crash: text/varchar null vs not null NOTE: Backporting the patch to next-mr. The replication was generating corrupted data, warning messages on Valgrind and aborting on debug mode while replicating a "null" to "not null" field. Specifically the unpack_row routine, was considering the slave's table definition and trying to retrieve a field value, where there was nothing to be retrieved, ignoring the fact that the value was defined as "null" by the master. To fix the problem, we proceed as follows: 1 - If it is not STRICT sql_mode, implicit default values are used, regardless if it is multi-row or single-row statement. 2 - However, if it is STRICT mode, then a we do what follows: 2.1 If it is a transactional engine, we do a rollback on the first NULL that is to be set into a NOT NULL column and return an error. 2.2 If it is a non-transactional engine and it is the first row to be inserted with multi-row, we also return the error. Otherwise, we proceed with the execution, use implicit default values and print out warning messages. Unfortunately, the current patch cannot mimic the behavior showed by the master for updates on multi-tables and multi-row inserts. This happens because such statements are unfolded in different row events. For instance, considering the following updates and strict mode: (master) create table t1 (a int); create table t2 (a int not null); insert into t1 values (1); insert into t2 values (2); update t1, t2 SET t1.a=10, t2.a=NULL; t1 would have (10) and t2 would have (0) as this would be handled as a multi-row update. On the other hand, if we had the following updates: (master) create table t1 (a int); create table t2 (a int); (slave) create table t1 (a int); create table t2 (a int not null); (master) insert into t1 values (1); insert into t2 values (2); update t1, t2 SET t1.a=10, t2.a=NULL; On the master t1 would have (10) and t2 would have (NULL). On the slave, t1 would have (10) but the update on t1 would fail. --- mysql-test/extra/rpl_tests/rpl_not_null.test | 364 ++++++++++++++++++ .../suite/rpl/r/rpl_not_null_innodb.result | 202 ++++++++++ .../suite/rpl/r/rpl_not_null_myisam.result | 202 ++++++++++ .../suite/rpl/t/rpl_not_null_innodb.test | 19 + .../suite/rpl/t/rpl_not_null_myisam.test | 18 + sql/log_event.cc | 17 +- sql/log_event.h | 8 +- sql/rpl_record.cc | 56 ++- sql/rpl_record.h | 6 +- 9 files changed, 873 insertions(+), 19 deletions(-) create mode 100644 mysql-test/extra/rpl_tests/rpl_not_null.test create mode 100644 mysql-test/suite/rpl/r/rpl_not_null_innodb.result create mode 100644 mysql-test/suite/rpl/r/rpl_not_null_myisam.result create mode 100644 mysql-test/suite/rpl/t/rpl_not_null_innodb.test create mode 100644 mysql-test/suite/rpl/t/rpl_not_null_myisam.test diff --git a/mysql-test/extra/rpl_tests/rpl_not_null.test b/mysql-test/extra/rpl_tests/rpl_not_null.test new file mode 100644 index 00000000000..88f37f9a95e --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_not_null.test @@ -0,0 +1,364 @@ +################################################################################# +# This test checks if the replication between "null" fields to either "null" +# fields or "not null" fields works properly. In the first case, the execution +# should work fine. In the second case, it may fail according to the sql_mode +# being used. +# +# The test is devided in three main parts: +# +# 1 - NULL --> NULL (no failures) +# 2 - NULL --> NOT NULL ( sql-mode = STRICT and failures) +# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures) +# +################################################################################# +connection master; + +SET SQL_LOG_BIN= 0; +eval CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; + +eval CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; + +eval CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; + +eval CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +SET SQL_LOG_BIN= 1; + +connection slave; + +eval CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; + +eval CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; + +eval CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00', +`c` INT DEFAULT 500, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; + +eval CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00', +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; + +--echo ************* EXECUTION WITH INSERTS ************* +connection master; +INSERT INTO t1(a,b,c) VALUES (1, null, 1); +INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2); +INSERT INTO t1(a,b) VALUES (3, null); +INSERT INTO t1(a,c) VALUES (4, 4); +INSERT INTO t1(a) VALUES (5); + +INSERT INTO t2(a,b) VALUES (1, null); +INSERT INTO t2(a,b) VALUES (2,'1111-11-11'); +INSERT INTO t2(a) VALUES (3); + +INSERT INTO t3(a,b) VALUES (1, null); +INSERT INTO t3(a,b) VALUES (2,'1111-11-11'); +INSERT INTO t3(a) VALUES (3); + +INSERT INTO t4(a,b,c) VALUES (1, null, 1); +INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2); +INSERT INTO t4(a,b) VALUES (3, null); +INSERT INTO t4(a,c) VALUES (4, 4); +INSERT INTO t4(a) VALUES (5); + +--echo ************* SHOWING THE RESULT SETS WITH INSERTS ************* +sync_slave_with_master; + +--echo TABLES t1 and t2 must be equal otherwise an error will be thrown. +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +let $diff_table_1=master:test.t2; +let $diff_table_2=slave:test.t2; +source include/diff_tables.inc; + +--echo TABLES t2 and t3 must be different. +connection master; +SELECT * FROM t3; +connection slave; +SELECT * FROM t3; +connection master; +SELECT * FROM t4; +connection slave; +SELECT * FROM t4; + +--echo ************* EXECUTION WITH UPDATES and REPLACES ************* +connection master; +DELETE FROM t1; +INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1); +REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2); +UPDATE t1 set b= NULL, c= 300 where a= 1; +REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); + +--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* +sync_slave_with_master; + +--echo TABLES t1 and t2 must be equal otherwise an error will be thrown. +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +--echo ************* CLEANING ************* +connection master; + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; + +sync_slave_with_master; + +connection master; + +SET SQL_LOG_BIN= 0; +eval CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL, +PRIMARY KEY (`a`)) ENGINE= $engine; +SET SQL_LOG_BIN= 1; + +connection slave; + +eval CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL, +PRIMARY KEY (`a`)) ENGINE= $engine; + +--echo ************* EXECUTION WITH INSERTS ************* +connection master; +INSERT INTO t1(a,b,c) VALUES (1, null, b'01'); +INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01'); +INSERT INTO t1(a,b) VALUES (3, null); +INSERT INTO t1(a,c) VALUES (4, b'01'); +INSERT INTO t1(a) VALUES (5); + +--echo ************* SHOWING THE RESULT SETS WITH INSERTS ************* +--echo TABLES t1 and t2 must be different. +sync_slave_with_master; +connection master; +SELECT a,b+0,c+0 FROM t1; +connection slave; +SELECT a,b+0,c+0 FROM t1; + +--echo ************* EXECUTION WITH UPDATES and REPLACES ************* +connection master; +DELETE FROM t1; +INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01'); +REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01'); +UPDATE t1 set b= NULL, c= b'00' where a= 1; +REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); + +--echo ************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* +--echo TABLES t1 and t2 must be equal otherwise an error will be thrown. +sync_slave_with_master; +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +connection master; + +DROP TABLE t1; + +sync_slave_with_master; + +--echo ################################################################################ +--echo # NULL ---> NOT NULL (STRICT MODE) +--echo # UNCOMMENT THIS AFTER FIXING BUG#43992 +--echo ################################################################################ +#connection slave; +#SET GLOBAL sql_mode="TRADITIONAL"; +# +#STOP SLAVE; +#--source include/wait_for_slave_to_stop.inc +#START SLAVE; +#--source include/wait_for_slave_to_start.inc +# +#let $y=0; +#while (`select $y < 6`) +#{ +# connection master; +# +# SET SQL_LOG_BIN= 0; +# eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT, +# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +# eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT, +# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +# eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT, +# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +# SET SQL_LOG_BIN= 1; +# +# connection slave; +# +# eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL, +# `c` INT NOT NULL, +# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +# eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL, +# `c` INT, +# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +# eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL, +# `c` INT DEFAULT 500, +# PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +# +# if (`select $y=0`) +# { +# --echo ************* EXECUTION WITH INSERTS ************* +# connection master; +# INSERT INTO t1(a) VALUES (1); +# } +# +# if (`select $y=1`) +# { +# --echo ************* EXECUTION WITH INSERTS ************* +# connection master; +# INSERT INTO t1(a, b) VALUES (1, NULL); +# } +# +# if (`select $y=2`) +# { +# --echo ************* EXECUTION WITH UPDATES ************* +# connection master; +# INSERT INTO t3(a, b) VALUES (1, 1); +# INSERT INTO t3(a, b) VALUES (2, 1); +# UPDATE t3 SET b = NULL where a= 1; +# } +# +# if (`select $y=3`) +# { +# --echo ************* EXECUTION WITH INSERTS/REPLACES ************* +# connection master; +# REPLACE INTO t3(a, b) VALUES (1, null); +# } +# +# if (`select $y=4`) +# { +# --echo ************* EXECUTION WITH UPDATES/REPLACES ************* +# connection master; +# INSERT INTO t3(a, b) VALUES (1, 1); +# REPLACE INTO t3(a, b) VALUES (1, null); +# } +# +# if (`select $y=5`) +# { +# --echo ************* EXECUTION WITH MULTI-ROW INSERTS ************* +# connection master; +# +# SET SQL_LOG_BIN= 0; +# INSERT INTO t2(a, b) VALUES (1, 1); +# INSERT INTO t2(a, b) VALUES (2, 1); +# INSERT INTO t2(a, b) VALUES (3, null); +# INSERT INTO t2(a, b) VALUES (4, 1); +# INSERT INTO t2(a, b) VALUES (5, 1); +# SET SQL_LOG_BIN= 1; +# +# INSERT INTO t2 SELECT a + 10, b from t2; +# --echo The statement below is just executed to stop processing +# INSERT INTO t1(a) VALUES (1); +# } +# +# --echo ************* SHOWING THE RESULT SETS ************* +# connection slave; +# --source include/wait_for_slave_sql_to_stop.inc +# connection master; +# SELECT * FROM t1; +# connection slave; +# SELECT * FROM t1; +# connection master; +# SELECT * FROM t2; +# connection slave; +# SELECT * FROM t2; +# connection master; +# SELECT * FROM t3; +# connection slave; +# SELECT * FROM t3; +# --source include/reset_master_and_slave.inc +# +# connection master; +# +# DROP TABLE t1; +# DROP TABLE t2; +# DROP TABLE t3; +# +# sync_slave_with_master; +# +# inc $y; +#} +#connection slave; +#SET GLOBAL sql_mode=""; +# +#STOP SLAVE; +#source include/wait_for_slave_to_stop.inc; +#START SLAVE; +#--source include/wait_for_slave_to_start.inc + +--echo ################################################################################ +--echo # NULL ---> NOT NULL (NON-STRICT MODE) +--echo ################################################################################ +connection master; + +SET SQL_LOG_BIN= 0; +eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +SET SQL_LOG_BIN= 1; + +connection slave; + +eval CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT NOT NULL, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +eval CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; +eval CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT DEFAULT 500, +PRIMARY KEY(`a`)) ENGINE=$engine DEFAULT CHARSET=LATIN1; + +--echo ************* EXECUTION WITH INSERTS ************* +connection master; +INSERT INTO t1(a) VALUES (1); +INSERT INTO t1(a, b) VALUES (2, NULL); +INSERT INTO t1(a, b) VALUES (3, 1); + +INSERT INTO t2(a) VALUES (1); +INSERT INTO t2(a, b) VALUES (2, NULL); +INSERT INTO t2(a, b) VALUES (3, 1); + +INSERT INTO t3(a) VALUES (1); +INSERT INTO t3(a, b) VALUES (2, NULL); +INSERT INTO t3(a, b) VALUES (3, 1); +INSERT INTO t3(a, b) VALUES (4, 1); +REPLACE INTO t3(a, b) VALUES (5, null); + +REPLACE INTO t3(a, b) VALUES (3, null); +UPDATE t3 SET b = NULL where a = 4; + +--echo ************* SHOWING THE RESULT SETS ************* +connection master; +sync_slave_with_master; + +connection master; +SELECT * FROM t1; +connection slave; +SELECT * FROM t1; +connection master; +SELECT * FROM t2; +connection slave; +SELECT * FROM t2; +connection master; +SELECT * FROM t3; +connection slave; +SELECT * FROM t3; + +connection master; + +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; + +sync_slave_with_master; diff --git a/mysql-test/suite/rpl/r/rpl_not_null_innodb.result b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result new file mode 100644 index 00000000000..7717beb0a47 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result @@ -0,0 +1,202 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +SET SQL_LOG_BIN= 0; +CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +SET SQL_LOG_BIN= 1; +CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00', +`c` INT DEFAULT 500, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00', +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +************* EXECUTION WITH INSERTS ************* +INSERT INTO t1(a,b,c) VALUES (1, null, 1); +INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2); +INSERT INTO t1(a,b) VALUES (3, null); +INSERT INTO t1(a,c) VALUES (4, 4); +INSERT INTO t1(a) VALUES (5); +INSERT INTO t2(a,b) VALUES (1, null); +INSERT INTO t2(a,b) VALUES (2,'1111-11-11'); +INSERT INTO t2(a) VALUES (3); +INSERT INTO t3(a,b) VALUES (1, null); +INSERT INTO t3(a,b) VALUES (2,'1111-11-11'); +INSERT INTO t3(a) VALUES (3); +INSERT INTO t4(a,b,c) VALUES (1, null, 1); +INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2); +INSERT INTO t4(a,b) VALUES (3, null); +INSERT INTO t4(a,c) VALUES (4, 4); +INSERT INTO t4(a) VALUES (5); +************* SHOWING THE RESULT SETS WITH INSERTS ************* +TABLES t1 and t2 must be equal otherwise an error will be thrown. +Comparing tables master:test.t1 and slave:test.t1 +Comparing tables master:test.t2 and slave:test.t2 +TABLES t2 and t3 must be different. +SELECT * FROM t3; +a b +1 NULL +2 1111-11-11 +3 NULL +SELECT * FROM t3; +a b c +1 NULL 500 +2 1111-11-11 500 +3 NULL 500 +SELECT * FROM t4; +a b c +1 NULL 1 +2 1111-11-11 2 +3 NULL NULL +4 NULL 4 +5 NULL NULL +SELECT * FROM t4; +a b +1 NULL +2 1111-11-11 +3 NULL +4 NULL +5 NULL +************* EXECUTION WITH UPDATES and REPLACES ************* +DELETE FROM t1; +INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1); +REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2); +UPDATE t1 set b= NULL, c= 300 where a= 1; +REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); +************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* +TABLES t1 and t2 must be equal otherwise an error will be thrown. +Comparing tables master:test.t1 and slave:test.t1 +************* CLEANING ************* +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; +SET SQL_LOG_BIN= 0; +CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL, +PRIMARY KEY (`a`)) ENGINE= Innodb; +SET SQL_LOG_BIN= 1; +CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL, +PRIMARY KEY (`a`)) ENGINE= Innodb; +************* EXECUTION WITH INSERTS ************* +INSERT INTO t1(a,b,c) VALUES (1, null, b'01'); +INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01'); +INSERT INTO t1(a,b) VALUES (3, null); +INSERT INTO t1(a,c) VALUES (4, b'01'); +INSERT INTO t1(a) VALUES (5); +************* SHOWING THE RESULT SETS WITH INSERTS ************* +TABLES t1 and t2 must be different. +SELECT a,b+0,c+0 FROM t1; +a b+0 c+0 +1 NULL 1 +2 0 1 +3 NULL NULL +4 NULL 1 +5 NULL NULL +SELECT a,b+0,c+0 FROM t1; +a b+0 c+0 +1 NULL 1 +2 0 1 +3 NULL NULL +4 NULL 1 +5 NULL NULL +************* EXECUTION WITH UPDATES and REPLACES ************* +DELETE FROM t1; +INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01'); +REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01'); +UPDATE t1 set b= NULL, c= b'00' where a= 1; +REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); +************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* +TABLES t1 and t2 must be equal otherwise an error will be thrown. +Comparing tables master:test.t1 and slave:test.t1 +DROP TABLE t1; +################################################################################ +# NULL ---> NOT NULL (STRICT MODE) +# UNCOMMENT THIS AFTER FIXING BUG#43992 +################################################################################ +################################################################################ +# NULL ---> NOT NULL (NON-STRICT MODE) +################################################################################ +SET SQL_LOG_BIN= 0; +CREATE TABLE t1(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t2(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t3(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +SET SQL_LOG_BIN= 1; +CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT NOT NULL, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT DEFAULT 500, +PRIMARY KEY(`a`)) ENGINE=Innodb DEFAULT CHARSET=LATIN1; +************* EXECUTION WITH INSERTS ************* +INSERT INTO t1(a) VALUES (1); +INSERT INTO t1(a, b) VALUES (2, NULL); +INSERT INTO t1(a, b) VALUES (3, 1); +INSERT INTO t2(a) VALUES (1); +INSERT INTO t2(a, b) VALUES (2, NULL); +INSERT INTO t2(a, b) VALUES (3, 1); +INSERT INTO t3(a) VALUES (1); +INSERT INTO t3(a, b) VALUES (2, NULL); +INSERT INTO t3(a, b) VALUES (3, 1); +INSERT INTO t3(a, b) VALUES (4, 1); +REPLACE INTO t3(a, b) VALUES (5, null); +REPLACE INTO t3(a, b) VALUES (3, null); +UPDATE t3 SET b = NULL where a = 4; +************* SHOWING THE RESULT SETS ************* +SELECT * FROM t1; +a b +1 NULL +2 NULL +3 1 +SELECT * FROM t1; +a b c +1 0 0 +2 0 0 +3 1 0 +SELECT * FROM t2; +a b +1 NULL +2 NULL +3 1 +SELECT * FROM t2; +a b c +1 0 NULL +2 0 NULL +3 1 NULL +SELECT * FROM t3; +a b +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +SELECT * FROM t3; +a b c +1 0 500 +2 0 500 +3 0 500 +4 0 500 +5 0 500 +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; diff --git a/mysql-test/suite/rpl/r/rpl_not_null_myisam.result b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result new file mode 100644 index 00000000000..57a015367bb --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result @@ -0,0 +1,202 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +SET SQL_LOG_BIN= 0; +CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t3(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t4(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +SET SQL_LOG_BIN= 1; +CREATE TABLE t1(`a` INT, `b` DATE DEFAULT NULL, +`c` INT DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t2(`a` INT, `b` DATE DEFAULT NULL, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t3(`a` INT, `b` DATE DEFAULT '0000-00-00', +`c` INT DEFAULT 500, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t4(`a` INT, `b` DATE DEFAULT '0000-00-00', +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +************* EXECUTION WITH INSERTS ************* +INSERT INTO t1(a,b,c) VALUES (1, null, 1); +INSERT INTO t1(a,b,c) VALUES (2,'1111-11-11', 2); +INSERT INTO t1(a,b) VALUES (3, null); +INSERT INTO t1(a,c) VALUES (4, 4); +INSERT INTO t1(a) VALUES (5); +INSERT INTO t2(a,b) VALUES (1, null); +INSERT INTO t2(a,b) VALUES (2,'1111-11-11'); +INSERT INTO t2(a) VALUES (3); +INSERT INTO t3(a,b) VALUES (1, null); +INSERT INTO t3(a,b) VALUES (2,'1111-11-11'); +INSERT INTO t3(a) VALUES (3); +INSERT INTO t4(a,b,c) VALUES (1, null, 1); +INSERT INTO t4(a,b,c) VALUES (2,'1111-11-11', 2); +INSERT INTO t4(a,b) VALUES (3, null); +INSERT INTO t4(a,c) VALUES (4, 4); +INSERT INTO t4(a) VALUES (5); +************* SHOWING THE RESULT SETS WITH INSERTS ************* +TABLES t1 and t2 must be equal otherwise an error will be thrown. +Comparing tables master:test.t1 and slave:test.t1 +Comparing tables master:test.t2 and slave:test.t2 +TABLES t2 and t3 must be different. +SELECT * FROM t3; +a b +1 NULL +2 1111-11-11 +3 NULL +SELECT * FROM t3; +a b c +1 NULL 500 +2 1111-11-11 500 +3 NULL 500 +SELECT * FROM t4; +a b c +1 NULL 1 +2 1111-11-11 2 +3 NULL NULL +4 NULL 4 +5 NULL NULL +SELECT * FROM t4; +a b +1 NULL +2 1111-11-11 +3 NULL +4 NULL +5 NULL +************* EXECUTION WITH UPDATES and REPLACES ************* +DELETE FROM t1; +INSERT INTO t1(a,b,c) VALUES (1,'1111-11-11', 1); +REPLACE INTO t1(a,b,c) VALUES (2,'1111-11-11', 2); +UPDATE t1 set b= NULL, c= 300 where a= 1; +REPLACE INTO t1(a,b,c) VALUES (2, NULL, 300); +************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* +TABLES t1 and t2 must be equal otherwise an error will be thrown. +Comparing tables master:test.t1 and slave:test.t1 +************* CLEANING ************* +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP TABLE t4; +SET SQL_LOG_BIN= 0; +CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT NULL, `c` BIT DEFAULT NULL, +PRIMARY KEY (`a`)) ENGINE= MyISAM; +SET SQL_LOG_BIN= 1; +CREATE TABLE t1 (`a` INT, `b` BIT DEFAULT b'01', `c` BIT DEFAULT NULL, +PRIMARY KEY (`a`)) ENGINE= MyISAM; +************* EXECUTION WITH INSERTS ************* +INSERT INTO t1(a,b,c) VALUES (1, null, b'01'); +INSERT INTO t1(a,b,c) VALUES (2,b'00', b'01'); +INSERT INTO t1(a,b) VALUES (3, null); +INSERT INTO t1(a,c) VALUES (4, b'01'); +INSERT INTO t1(a) VALUES (5); +************* SHOWING THE RESULT SETS WITH INSERTS ************* +TABLES t1 and t2 must be different. +SELECT a,b+0,c+0 FROM t1; +a b+0 c+0 +1 NULL 1 +2 0 1 +3 NULL NULL +4 NULL 1 +5 NULL NULL +SELECT a,b+0,c+0 FROM t1; +a b+0 c+0 +1 NULL 1 +2 0 1 +3 NULL NULL +4 NULL 1 +5 NULL NULL +************* EXECUTION WITH UPDATES and REPLACES ************* +DELETE FROM t1; +INSERT INTO t1(a,b,c) VALUES (1,b'00', b'01'); +REPLACE INTO t1(a,b,c) VALUES (2,b'00',b'01'); +UPDATE t1 set b= NULL, c= b'00' where a= 1; +REPLACE INTO t1(a,b,c) VALUES (2, NULL, b'00'); +************* SHOWING THE RESULT SETS WITH UPDATES and REPLACES ************* +TABLES t1 and t2 must be equal otherwise an error will be thrown. +Comparing tables master:test.t1 and slave:test.t1 +DROP TABLE t1; +################################################################################ +# NULL ---> NOT NULL (STRICT MODE) +# UNCOMMENT THIS AFTER FIXING BUG#43992 +################################################################################ +################################################################################ +# NULL ---> NOT NULL (NON-STRICT MODE) +################################################################################ +SET SQL_LOG_BIN= 0; +CREATE TABLE t1(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t2(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t3(`a` INT NOT NULL, `b` INT, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +SET SQL_LOG_BIN= 1; +CREATE TABLE t1(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT NOT NULL, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t2(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +CREATE TABLE t3(`a` INT NOT NULL, `b` INT NOT NULL, +`c` INT DEFAULT 500, +PRIMARY KEY(`a`)) ENGINE=MyISAM DEFAULT CHARSET=LATIN1; +************* EXECUTION WITH INSERTS ************* +INSERT INTO t1(a) VALUES (1); +INSERT INTO t1(a, b) VALUES (2, NULL); +INSERT INTO t1(a, b) VALUES (3, 1); +INSERT INTO t2(a) VALUES (1); +INSERT INTO t2(a, b) VALUES (2, NULL); +INSERT INTO t2(a, b) VALUES (3, 1); +INSERT INTO t3(a) VALUES (1); +INSERT INTO t3(a, b) VALUES (2, NULL); +INSERT INTO t3(a, b) VALUES (3, 1); +INSERT INTO t3(a, b) VALUES (4, 1); +REPLACE INTO t3(a, b) VALUES (5, null); +REPLACE INTO t3(a, b) VALUES (3, null); +UPDATE t3 SET b = NULL where a = 4; +************* SHOWING THE RESULT SETS ************* +SELECT * FROM t1; +a b +1 NULL +2 NULL +3 1 +SELECT * FROM t1; +a b c +1 0 0 +2 0 0 +3 1 0 +SELECT * FROM t2; +a b +1 NULL +2 NULL +3 1 +SELECT * FROM t2; +a b c +1 0 NULL +2 0 NULL +3 1 NULL +SELECT * FROM t3; +a b +1 NULL +2 NULL +3 NULL +4 NULL +5 NULL +SELECT * FROM t3; +a b c +1 0 500 +2 0 500 +3 0 500 +4 0 500 +5 0 500 +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; diff --git a/mysql-test/suite/rpl/t/rpl_not_null_innodb.test b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test new file mode 100644 index 00000000000..dca0ea6589c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_not_null_innodb.test @@ -0,0 +1,19 @@ +################################################################################# +# This test checks if the replication between "null" fields to either "null" +# fields or "not null" fields works properly. In the first case, the execution +# should work fine. In the second case, it may fail according to the sql_mode +# being used. +# +# The test is devided in three main parts: +# +# 1 - NULL --> NULL (no failures) +# 2 - NULL --> NOT NULL ( sql-mode = STRICT and failures) +# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures) +# +################################################################################# +--source include/master-slave.inc +--source include/have_innodb.inc +--source include/have_binlog_format_row.inc + +let $engine=Innodb; +--source extra/rpl_tests/rpl_not_null.test diff --git a/mysql-test/suite/rpl/t/rpl_not_null_myisam.test b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test new file mode 100644 index 00000000000..0c036f5bfd7 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_not_null_myisam.test @@ -0,0 +1,18 @@ +################################################################################# +# This test checks if the replication between "null" fields to either "null" +# fields or "not null" fields works properly. In the first case, the execution +# should work fine. In the second case, it may fail according to the sql_mode +# being used. +# +# The test is devided in three main parts: +# +# 1 - NULL --> NULL (no failures) +# 2 - NULL --> NOT NULL ( sql-mode = STRICT and failures) +# 3 - NULL --> NOT NULL ( sql-mode != STRICT and no failures) +# +################################################################################# +--source include/master-slave.inc +--source include/have_binlog_format_row.inc + +let $engine=MyISAM; +--source extra/rpl_tests/rpl_not_null.test diff --git a/sql/log_event.cc b/sql/log_event.cc index d595f00bffd..eeed50f697d 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -8444,16 +8444,17 @@ Rows_log_event::write_row(const Relay_log_info *const rli, auto_afree_ptr key(NULL); /* fill table->record[0] with default values */ - + bool abort_on_warnings= (rli->sql_thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)); if ((error= prepare_record(table, m_width, table->file->ht->db_type != DB_TYPE_NDBCLUSTER, - (rli->sql_thd->variables.sql_mode & - (MODE_STRICT_TRANS_TABLES | - MODE_STRICT_ALL_TABLES))))) + abort_on_warnings, m_curr_row == m_rows_buf))) DBUG_RETURN(error); /* unpack row into table->record[0] */ - error= unpack_current_row(rli); // TODO: how to handle errors? + if ((error= unpack_current_row(rli, abort_on_warnings))) + DBUG_RETURN(error); + if (m_curr_row == m_rows_buf) { /* this is the first row to be inserted, we estimate the rows with @@ -9250,8 +9251,12 @@ Update_rows_log_event::do_exec_row(const Relay_log_info *const rli) store_record(m_table,record[1]); + bool abort_on_warnings= (rli->sql_thd->variables.sql_mode & + (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)); m_curr_row= m_curr_row_end; - error= unpack_current_row(rli); // this also updates m_curr_row_end + /* this also updates m_curr_row_end */ + if ((error= unpack_current_row(rli, abort_on_warnings))) + return error; /* Now we have the right row to update. The old row (the one we're diff --git a/sql/log_event.h b/sql/log_event.h index 8202dddcc76..bbcca76741c 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -3541,12 +3541,16 @@ protected: int write_row(const Relay_log_info *const, const bool); // Unpack the current row into m_table->record[0] - int unpack_current_row(const Relay_log_info *const rli) + int unpack_current_row(const Relay_log_info *const rli, + const bool abort_on_warning= TRUE) { DBUG_ASSERT(m_table); + + bool first_row= (m_curr_row == m_rows_buf); ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT); int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols, - &m_curr_row_end, &m_master_reclength); + &m_curr_row_end, &m_master_reclength, + abort_on_warning, first_row); if (m_curr_row_end > m_rows_end) my_error(ER_SLAVE_CORRUPT_EVENT, MYF(0)); ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT); diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index f4768e2456a..8e80620dd2c 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -180,7 +180,8 @@ int unpack_row(Relay_log_info const *rli, TABLE *table, uint const colcnt, uchar const *const row_data, MY_BITMAP const *cols, - uchar const **const row_end, ulong *const master_reclength) + uchar const **const row_end, ulong *const master_reclength, + const bool abort_on_warning, const bool first_row) { DBUG_ENTER("unpack_row"); DBUG_ASSERT(row_data); @@ -224,8 +225,35 @@ unpack_row(Relay_log_info const *rli, /* Field...::unpack() cannot return 0 */ DBUG_ASSERT(pack_ptr != NULL); - if ((null_bits & null_mask) && f->maybe_null()) - f->set_null(); + if (null_bits & null_mask) + { + if (f->maybe_null()) + { + DBUG_PRINT("debug", ("Was NULL; null mask: 0x%x; null bits: 0x%x", + null_mask, null_bits)); + f->set_null(); + } + else + { + MYSQL_ERROR::enum_warning_level error_type= + MYSQL_ERROR::WARN_LEVEL_NOTE; + if (abort_on_warning && (table->file->has_transactions() || + first_row)) + { + error = HA_ERR_ROWS_EVENT_APPLY; + error_type= MYSQL_ERROR::WARN_LEVEL_ERROR; + } + else + { + f->set_default(); + error_type= MYSQL_ERROR::WARN_LEVEL_WARN; + } + push_warning_printf(current_thd, error_type, + ER_BAD_NULL_ERROR, + ER(ER_BAD_NULL_ERROR), + f->field_name); + } + } else { f->set_notnull(); @@ -315,7 +343,7 @@ unpack_row(Relay_log_info const *rli, */ int prepare_record(TABLE *const table, const uint skip, const bool check, - const bool abort_on_warning) + const bool abort_on_warning, const bool first_row) { DBUG_ENTER("prepare_record"); @@ -343,14 +371,24 @@ int prepare_record(TABLE *const table, if ((f->flags & NO_DEFAULT_VALUE_FLAG) && (f->real_type() != MYSQL_TYPE_ENUM)) { - push_warning_printf(current_thd, abort_on_warning? - MYSQL_ERROR::WARN_LEVEL_ERROR : - MYSQL_ERROR::WARN_LEVEL_WARN, + + MYSQL_ERROR::enum_warning_level error_type= + MYSQL_ERROR::WARN_LEVEL_NOTE; + if (abort_on_warning && (table->file->has_transactions() || + first_row)) + { + error= HA_ERR_ROWS_EVENT_APPLY; + error_type= MYSQL_ERROR::WARN_LEVEL_ERROR; + } + else + { + f->set_default(); + error_type= MYSQL_ERROR::WARN_LEVEL_WARN; + } + push_warning_printf(current_thd, error_type, ER_NO_DEFAULT_FOR_FIELD, ER(ER_NO_DEFAULT_FOR_FIELD), f->field_name); - if (abort_on_warning) - error = HA_ERR_ROWS_EVENT_APPLY; } } diff --git a/sql/rpl_record.h b/sql/rpl_record.h index ab2bcd382ca..6e8838f82b3 100644 --- a/sql/rpl_record.h +++ b/sql/rpl_record.h @@ -27,11 +27,13 @@ size_t pack_row(TABLE* table, MY_BITMAP const* cols, int unpack_row(Relay_log_info const *rli, TABLE *table, uint const colcnt, uchar const *const row_data, MY_BITMAP const *cols, - uchar const **const row_end, ulong *const master_reclength); + uchar const **const row_end, ulong *const master_reclength, + const bool abort_on_warning= TRUE, const bool first_row= TRUE); // Fill table's record[0] with default values. int prepare_record(TABLE *const table, const uint skip, const bool check, - const bool abort_on_warning= FALSE); + const bool abort_on_warning= TRUE, + const bool first_row= TRUE); #endif #endif From 4e0cb6dbb7da3a8e98f6050779206d65f3096f47 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Tue, 29 Sep 2009 15:27:12 +0100 Subject: [PATCH 52/88] BUG#35542 Add option to sync master and relay log to disk after every event BUG#31665 sync_binlog should cause relay logs to be synchronized NOTE: Backporting the patch to next-mr. Add sync_relay_log option to server, this option works for relay log the same as option sync_binlog for binlog. This option also synchronize master info to disk when set to non-zero value. Original patches from Sinisa and Mark, with some modifications --- sql/log.cc | 35 +++++++++++++++++++++++------------ sql/log.h | 29 +++++++++++++++++++++++++++-- sql/mysql_priv.h | 3 ++- sql/mysqld.cc | 15 +++++++++++---- sql/rpl_mi.cc | 20 ++++++++++++++++---- sql/rpl_rli.cc | 3 ++- sql/set_var.cc | 17 +++++++++++++++++ sql/set_var.h | 21 +++++++++++++++++++++ sql/sql_repl.cc | 18 ++---------------- 9 files changed, 121 insertions(+), 40 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 1af2f3a4ddc..12e57623add 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -49,8 +49,7 @@ LOGGER logger; -MYSQL_BIN_LOG mysql_bin_log; -ulong sync_binlog_counter= 0; +MYSQL_BIN_LOG mysql_bin_log(&sync_binlog_period); static bool test_if_number(const char *str, long *res, bool allow_wildcards); @@ -2410,9 +2409,10 @@ const char *MYSQL_LOG::generate_name(const char *log_name, -MYSQL_BIN_LOG::MYSQL_BIN_LOG() +MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period) :bytes_written(0), prepared_xids(0), file_id(1), open_count(1), need_start_event(TRUE), m_table_map_version(0), + sync_period_ptr(sync_period), is_relay_log(0), description_event_for_exec(0), description_event_for_queue(0) { @@ -3643,6 +3643,8 @@ bool MYSQL_BIN_LOG::append(Log_event* ev) } bytes_written+= ev->data_written; DBUG_PRINT("info",("max_size: %lu",max_size)); + if (flush_and_sync(0)) + goto err; if ((uint) my_b_append_tell(&log_file) > max_size) new_file_without_locking(); @@ -3673,6 +3675,8 @@ bool MYSQL_BIN_LOG::appendv(const char* buf, uint len,...) bytes_written += len; } while ((buf=va_arg(args,const char*)) && (len=va_arg(args,uint))); DBUG_PRINT("info",("max_size: %lu",max_size)); + if (flush_and_sync(0)) + goto err; if ((uint) my_b_append_tell(&log_file) > max_size) new_file_without_locking(); @@ -3682,17 +3686,21 @@ err: DBUG_RETURN(error); } - -bool MYSQL_BIN_LOG::flush_and_sync() +bool MYSQL_BIN_LOG::flush_and_sync(bool *synced) { int err=0, fd=log_file.file; + if (synced) + *synced= 0; safe_mutex_assert_owner(&LOCK_log); if (flush_io_cache(&log_file)) return 1; - if (++sync_binlog_counter >= sync_binlog_period && sync_binlog_period) + uint sync_period= get_sync_period(); + if (sync_period && ++sync_counter >= sync_period) { - sync_binlog_counter= 0; + sync_counter= 0; err=my_sync(fd, MYF(MY_WME)); + if (synced) + *synced= 1; } return err; } @@ -3983,7 +3991,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd, if (file == &log_file) { - error= flush_and_sync(); + error= flush_and_sync(0); if (!error) { signal_update(); @@ -4169,7 +4177,8 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info) if (file == &log_file) // we are writing to the real log (disk) { - if (flush_and_sync()) + bool synced; + if (flush_and_sync(&synced)) goto err; signal_update(); rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED); @@ -4425,7 +4434,7 @@ int MYSQL_BIN_LOG::write_cache(IO_CACHE *cache, bool lock_log, bool sync_log) DBUG_ASSERT(carry == 0); if (sync_log) - flush_and_sync(); + return flush_and_sync(0); return 0; // All OK } @@ -4472,7 +4481,8 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd, bool lock) ev.write(&log_file); if (lock) { - if (!error && !(error= flush_and_sync())) + bool synced; + if (!error && !(error= flush_and_sync(&synced))) { signal_update(); rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED); @@ -4560,7 +4570,8 @@ bool MYSQL_BIN_LOG::write(THD *thd, IO_CACHE *cache, Log_event *commit_event, if (incident && write_incident(thd, FALSE)) goto err; - if (flush_and_sync()) + bool synced; + if (flush_and_sync(&synced)) goto err; DBUG_EXECUTE_IF("half_binlogged_transaction", abort();); if (cache->error) // Error on read diff --git a/sql/log.h b/sql/log.h index d306d6f7182..53943b649ee 100644 --- a/sql/log.h +++ b/sql/log.h @@ -269,6 +269,18 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG ulonglong m_table_map_version; + /* pointer to the sync period variable, for binlog this will be + sync_binlog_period, for relay log this will be + sync_relay_log_period + */ + uint *sync_period_ptr; + uint sync_counter; + + inline uint get_sync_period() + { + return *sync_period_ptr; + } + int write_to_file(IO_CACHE *cache); /* This is used to start writing to a new log file. The difference from @@ -296,7 +308,7 @@ public: Format_description_log_event *description_event_for_exec, *description_event_for_queue; - MYSQL_BIN_LOG(); + MYSQL_BIN_LOG(uint *sync_period); /* note that there's no destructor ~MYSQL_BIN_LOG() ! The reason is that we don't want it to be automatically called @@ -378,7 +390,20 @@ public: bool is_active(const char* log_file_name); int update_log_index(LOG_INFO* linfo, bool need_update_threads); void rotate_and_purge(uint flags); - bool flush_and_sync(); + /** + Flush binlog cache and synchronize to disk. + + This function flushes events in binlog cache to binary log file, + it will do synchronizing according to the setting of system + variable 'sync_binlog'. If file is synchronized, @c synced will + be set to 1, otherwise 0. + + @param[out] synced if not NULL, set to 1 if file is synchronized, otherwise 0 + + @retval 0 Success + @retval other Failure + */ + bool flush_and_sync(bool *synced); int purge_logs(const char *to_log, bool included, bool need_mutex, bool need_update_threads, ulonglong *decrease_log_space); diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 52cfa7934c3..669942cc691 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1868,7 +1868,8 @@ extern ulong MYSQL_PLUGIN_IMPORT specialflag; #endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */ #ifdef MYSQL_SERVER extern ulong current_pid; -extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter; +extern ulong expire_logs_days; +extern uint sync_binlog_period, sync_relaylog_period; extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size; extern ulong tc_log_page_waits; extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a57ee04081f..8febc0bb7e5 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -552,7 +552,8 @@ ulong max_prepared_stmt_count; */ ulong prepared_stmt_count=0; ulong thread_id=1L,current_pid; -ulong slow_launch_threads = 0, sync_binlog_period; +ulong slow_launch_threads = 0; +uint sync_binlog_period= 0, sync_relaylog_period= 0; ulong expire_logs_days = 0; ulong rpl_recovery_rank=0; const char *log_output_str= "FILE"; @@ -5667,7 +5668,8 @@ enum options_mysqld OPT_SLAVE_EXEC_MODE, OPT_GENERAL_LOG_FILE, OPT_SLOW_QUERY_LOG_FILE, - OPT_IGNORE_BUILTIN_INNODB + OPT_IGNORE_BUILTIN_INNODB, + OPT_SYNC_RELAY_LOG }; @@ -6921,8 +6923,13 @@ The minimum value for this variable is 4096.", {"sync-binlog", OPT_SYNC_BINLOG, "Synchronously flush binary log to disk after every #th event. " "Use 0 (default) to disable synchronous flushing.", - (uchar**) &sync_binlog_period, (uchar**) &sync_binlog_period, 0, GET_ULONG, - REQUIRED_ARG, 0, 0, ULONG_MAX, 0, 1, 0}, + (uchar**) &sync_binlog_period, (uchar**) &sync_binlog_period, 0, GET_UINT, + REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, + {"sync-relay-log", OPT_SYNC_RELAY_LOG, + "Synchronously flush relay log to disk after every #th event. " + "Use 0 (default) to disable synchronous flushing.", + (uchar**) &sync_relaylog_period, (uchar**) &sync_relaylog_period, 0, GET_UINT, + REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.", (uchar**) &opt_sync_frm, (uchar**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 5e46837e948..1bca44ac613 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -342,6 +342,7 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) { IO_CACHE* file = &mi->file; char lbuf[22]; + int err= 0; DBUG_ENTER("flush_master_info"); DBUG_PRINT("enter",("master_pos: %ld", (long) mi->master_log_pos)); @@ -358,9 +359,17 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) When we come to this place in code, relay log may or not be initialized; the caller is responsible for setting 'flush_relay_log_cache' accordingly. */ - if (flush_relay_log_cache && - flush_io_cache(mi->rli.relay_log.get_log_file())) - DBUG_RETURN(2); + if (flush_relay_log_cache) + { + IO_CACHE *log_file= mi->rli.relay_log.get_log_file(); + if (flush_io_cache(log_file)) + DBUG_RETURN(2); + + /* Sync to disk if --sync-relay-log is set */ + if (sync_relaylog_period && + my_sync(log_file->file, MY_WME)) + DBUG_RETURN(2); + } /* We flushed the relay log BEFORE the master.info file, because if we crash @@ -388,7 +397,10 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) mi->password, mi->port, mi->connect_retry, (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert, mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert); - DBUG_RETURN(-flush_io_cache(file)); + err= flush_io_cache(file); + if (sync_relaylog_period && !err) + err= my_sync(mi->fd, MYF(MY_WME)); + DBUG_RETURN(-err); } diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 18fbae9bb9d..37c0815fb8b 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -32,7 +32,8 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, Relay_log_info::Relay_log_info() :Slave_reporting_capability("SQL"), no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id), - info_fd(-1), cur_log_fd(-1), save_temporary_tables(0), + info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period), + save_temporary_tables(0), #if HAVE_purify is_fake(FALSE), #endif diff --git a/sql/set_var.cc b/sql/set_var.cc index 5025356230c..f2b5201cf8b 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1534,6 +1534,23 @@ static bool get_unsigned(THD *thd, set_var *var, ulonglong user_max, } +bool sys_var_int_ptr::check(THD *thd, set_var *var) +{ + var->save_result.ulong_value= (ulong) var->value->val_int(); + return 0; +} + +bool sys_var_int_ptr::update(THD *thd, set_var *var) +{ + *value= (uint) var->save_result.ulong_value; + return 0; +} + +void sys_var_int_ptr::set_default(THD *thd, enum_var_type type) +{ + *value= (uint) option_limits->def_value; +} + sys_var_long_ptr:: sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, ulong *value_ptr_arg, sys_after_update_func after_update_arg) diff --git a/sql/set_var.h b/sql/set_var.h index a3ed8e5be15..02c87abed88 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -175,6 +175,27 @@ public: { return (uchar*) value; } }; +/** + Unsigned int system variable class + */ +class sys_var_int_ptr :public sys_var +{ +public: + sys_var_int_ptr(sys_var_chain *chain, const char *name_arg, + uint *value_ptr_arg, + sys_after_update_func after_update_arg= NULL) + :sys_var(name_arg, after_update_arg), + value(value_ptr_arg) + { chain_sys_var(chain); } + bool check(THD *thd, set_var *var); + bool update(THD *thd, set_var *var); + void set_default(THD *thd, enum_var_type type); + SHOW_TYPE show_type() { return SHOW_INT; } + uchar *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) + { return (uchar*) value; } +private: + uint *value; +}; /* A global ulong variable that is protected by LOCK_global_system_variables diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 4d9b7410b88..425d76c8b72 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1753,15 +1753,6 @@ public: */ }; -class sys_var_sync_binlog_period :public sys_var_long_ptr -{ -public: - sys_var_sync_binlog_period(sys_var_chain *chain, const char *name_arg, - ulong *value_ptr) - :sys_var_long_ptr(chain, name_arg,value_ptr) {} - bool update(THD *thd, set_var *var); -}; - static sys_var_chain vars = { NULL, NULL }; static sys_var_const sys_log_slave_updates(&vars, "log_slave_updates", @@ -1793,7 +1784,8 @@ static sys_var_const sys_slave_skip_errors(&vars, "slave_skip_errors", (uchar*) slave_skip_error_names); static sys_var_long_ptr sys_slave_trans_retries(&vars, "slave_transaction_retries", &slave_trans_retries); -static sys_var_sync_binlog_period sys_sync_binlog_period(&vars, "sync_binlog", &sync_binlog_period); +static sys_var_int_ptr sys_sync_binlog_period(&vars, "sync_binlog", &sync_binlog_period); +static sys_var_int_ptr sys_sync_relaylog_period(&vars, "sync_relay_log", &sync_relaylog_period); static sys_var_slave_skip_counter sys_slave_skip_counter(&vars, "sql_slave_skip_counter"); @@ -1835,12 +1827,6 @@ bool sys_var_slave_skip_counter::update(THD *thd, set_var *var) } -bool sys_var_sync_binlog_period::update(THD *thd, set_var *var) -{ - sync_binlog_period= (ulong) var->save_result.ulonglong_value; - return 0; -} - int init_replication_sys_vars() { if (mysql_add_sys_var_chain(vars.first, my_long_options)) From a48ff22004594cacc0517d50a631a931f3ce06a9 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Tue, 29 Sep 2009 15:40:52 +0100 Subject: [PATCH 53/88] BUG#40337 Fsyncing master and relay log to disk after every event is too slow NOTE: Backporting the patch to next-mr. The fix proposed in BUG#35542 and BUG#31665 introduces a performance issue when fsyncing the master.info, relay.info and relay-log.bin* after #th events. Although such solution has been proposed to reduce the probability of corrupted files due to a slave-crash, the performance penalty introduced by it has made the approach impractical for highly intensive workloads. In a nutshell, the option --syn-relay-log proposed in BUG#35542 and BUG#31665 simultaneously fsyncs master.info, relay-log.info and relay-log.bin* and this is the main source of performance issues. This patch introduces new options that give more control to the user on what should be fsynced and how often: 1) (--sync-master-info, integer) which syncs the master.info after #th event; 2) (--sync-relay-log, integer) which syncs the relay-log.bin* after #th events. 3) (--sync-relay-log-info, integer) which syncs the relay.info after #th transactions. To provide both performance and increased reliability, we recommend the following setup: 1) --sync-master-info = 0 eventually the operating system will fsync it; 2) --sync-relay-log = 0 eventually the operating system will fsync it; 3) --sync-relay-log-info = 1 fsyncs it after every transaction; Notice, that the previous setup does not reduce the probability of corrupted master.info and relay-log.bin*. To overcome the issue, this patch also introduces a recovery mechanism that right after restart throws away relay-log.bin* retrieved from a master and updates the master.info based on the relay.info: 4) (--relay-log-recovery, boolean) which enables a recovery mechanism that throws away relay-log.bin* after a crash. However, it can only recover the incorrect binlog file and position in master.info, if other informations (host, port password, etc) are corrupted or incorrect, then this recovery mechanism will fail to work. --- .../suite/rpl/r/rpl_flushlog_loop.result | 1 + mysql-test/suite/rpl/r/rpl_sync.result | 40 +++++ mysql-test/suite/rpl/t/rpl_sync-slave.opt | 1 + mysql-test/suite/rpl/t/rpl_sync.test | 148 ++++++++++++++++++ sql/mysql_priv.h | 4 +- sql/mysqld.cc | 26 ++- sql/rpl_mi.cc | 17 +- sql/rpl_mi.h | 9 +- sql/rpl_rli.cc | 8 +- sql/rpl_rli.h | 15 +- sql/set_var.cc | 8 +- sql/set_var.h | 4 +- sql/slave.cc | 100 +++++++++++- sql/sql_binlog.cc | 2 +- sql/sql_repl.cc | 12 +- 15 files changed, 364 insertions(+), 31 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_sync.result create mode 100644 mysql-test/suite/rpl/t/rpl_sync-slave.opt create mode 100644 mysql-test/suite/rpl/t/rpl_sync.test diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result index 600ac44fc86..529d1db6cd6 100644 --- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result @@ -10,6 +10,7 @@ relay_log MYSQLD_DATADIR/relay-log relay_log_index relay_log_info_file relay-log.info relay_log_purge ON +relay_log_recovery OFF relay_log_space_limit 0 stop slave; change master to master_host='127.0.0.1',master_user='root', diff --git a/mysql-test/suite/rpl/r/rpl_sync.result b/mysql-test/suite/rpl/r/rpl_sync.result new file mode 100644 index 00000000000..edc20c46140 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_sync.result @@ -0,0 +1,40 @@ +=====Configuring the enviroment=======; +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +call mtr.add_suppression('Attempting backtrace'); +call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); +CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; +insert into t1(a) values(1); +insert into t1(a) values(2); +insert into t1(a) values(3); +=====Inserting data on the master but without the SQL Thread being running=======; +stop slave SQL_THREAD; +insert into t1(a) values(4); +insert into t1(a) values(5); +insert into t1(a) values(6); +=====Removing relay log files and crashing/recoverying the slave=======; +stop slave IO_THREAD; +SET SESSION debug="d,crash_before_rotate_relaylog"; +FLUSH LOGS; +ERROR HY000: Lost connection to MySQL server during query +=====Dumping and comparing tables=======; +start slave; +Comparing tables master:test.t1 and slave:test.t1 +=====Corrupting the master.info=======; +stop slave; +FLUSH LOGS; +insert into t1(a) values(7); +insert into t1(a) values(8); +insert into t1(a) values(9); +SET SESSION debug="d,crash_before_rotate_relaylog"; +FLUSH LOGS; +ERROR HY000: Lost connection to MySQL server during query +=====Dumping and comparing tables=======; +start slave; +Comparing tables master:test.t1 and slave:test.t1 +=====Clean up=======; +drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_sync-slave.opt b/mysql-test/suite/rpl/t/rpl_sync-slave.opt new file mode 100644 index 00000000000..77809a42c43 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_sync-slave.opt @@ -0,0 +1 @@ +--sync-relay-log-info=1 --relay-log-recovery=1 diff --git a/mysql-test/suite/rpl/t/rpl_sync.test b/mysql-test/suite/rpl/t/rpl_sync.test new file mode 100644 index 00000000000..80b6a144187 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_sync.test @@ -0,0 +1,148 @@ +######################################################################################## +# This test verifies the options --sync-relay-log-info and --relay-log-recovery by +# crashing the slave in two different situations: +# (case-1) - Corrupt the relay log with changes which were not processed by +# the SQL Thread and crashes it. +# (case-2) - Corrupt the master.info with wrong coordinates and crashes it. +# +# Case 1: +# 1 - Stops the SQL Thread +# 2 - Inserts new records into the master. +# 3 - Corrupts the relay-log.bin* which most likely has such changes. +# 4 - Crashes the slave +# 5 - Verifies if the slave is sync with the master which means that the information +# loss was circumvented by the recovery process. +# +# Case 2: +# 1 - Stops the SQL/IO Threads +# 2 - Inserts new records into the master. +# 3 - Corrupts the master.info with wrong coordinates. +# 4 - Crashes the slave +# 5 - Verifies if the slave is sync with the master which means that the information +# loss was circumvented by the recovery process. +######################################################################################## + +######################################################################################## +# Configuring the environment +######################################################################################## +--echo =====Configuring the enviroment=======; +--source include/master-slave.inc +--source include/not_embedded.inc +--source include/not_valgrind.inc +--source include/have_debug.inc +--source include/have_innodb.inc + +call mtr.add_suppression('Attempting backtrace'); +call mtr.add_suppression("Recovery from master pos .* and file master-bin.000001"); +CREATE TABLE t1(a INT, PRIMARY KEY(a)) engine=innodb; + +insert into t1(a) values(1); +insert into t1(a) values(2); +insert into t1(a) values(3); + +######################################################################################## +# Case 1: Corrupt a relay-log.bin* +######################################################################################## +--echo =====Inserting data on the master but without the SQL Thread being running=======; +sync_slave_with_master; + +connection slave; +let $MYSQLD_SLAVE_DATADIR= `select @@datadir`; +--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR +--copy_file $MYSQLD_SLAVE_DATADIR/master.info $MYSQLD_SLAVE_DATADIR/master.backup +stop slave SQL_THREAD; +source include/wait_for_slave_sql_to_stop.inc; + +connection master; +insert into t1(a) values(4); +insert into t1(a) values(5); +insert into t1(a) values(6); + +--echo =====Removing relay log files and crashing/recoverying the slave=======; +connection slave; +stop slave IO_THREAD; +source include/wait_for_slave_io_to_stop.inc; + +let $file= query_get_value("SHOW SLAVE STATUS", Relay_Log_File, 1); +--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR +--exec echo "failure" > $MYSQLD_SLAVE_DATADIR/$file + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +SET SESSION debug="d,crash_before_rotate_relaylog"; +--error 2013 +FLUSH LOGS; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +--echo =====Dumping and comparing tables=======; +start slave; +source include/wait_for_slave_to_start.inc; + +connection master; +sync_slave_with_master; + +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +######################################################################################## +# Case 2: Corrupt a master.info +######################################################################################## +--echo =====Corrupting the master.info=======; +connection slave; +stop slave; +source include/wait_for_slave_to_stop.inc; + +connection master; +FLUSH LOGS; + +insert into t1(a) values(7); +insert into t1(a) values(8); +insert into t1(a) values(9); + +connection slave; +--replace_result $MYSQLD_SLAVE_DATADIR MYSQLD_SLAVE_DATADIR +--exec cat $MYSQLD_SLAVE_DATADIR/master.backup > $MYSQLD_SLAVE_DATADIR/master.info + +let MYSQLD_SLAVE_DATADIR=`select @@datadir`; + +--perl +use strict; +use warnings; +my $src= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.backup"; +my $dst= "$ENV{'MYSQLD_SLAVE_DATADIR'}/master.info"; +open(FILE, "<", $src) or die; +my @content= ; +close FILE; +open(FILE, ">", $dst) or die; +binmode FILE; +print FILE @content; +close FILE; +EOF + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +SET SESSION debug="d,crash_before_rotate_relaylog"; +--error 2013 +FLUSH LOGS; + +--enable_reconnect +--source include/wait_until_connected_again.inc + +--echo =====Dumping and comparing tables=======; +start slave; +source include/wait_for_slave_to_start.inc; + +connection master; +sync_slave_with_master; + +let $diff_table_1=master:test.t1; +let $diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +######################################################################################## +# Clean up +######################################################################################## +--echo =====Clean up=======; +connection master; +drop table t1; diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 669942cc691..435513832d0 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -1869,10 +1869,12 @@ extern ulong MYSQL_PLUGIN_IMPORT specialflag; #ifdef MYSQL_SERVER extern ulong current_pid; extern ulong expire_logs_days; -extern uint sync_binlog_period, sync_relaylog_period; +extern uint sync_binlog_period, sync_relaylog_period, + sync_relayloginfo_period, sync_masterinfo_period; extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size; extern ulong tc_log_page_waits; extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb; +extern my_bool relay_log_recovery; extern uint test_flags,select_errors,ha_open_options; extern uint protocol_version, mysqld_port, dropping_tables; extern uint delay_key_write_options; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 8febc0bb7e5..b8d09fd4e5a 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -477,6 +477,7 @@ extern const char *opt_ndb_distribution; extern enum ndb_distribution opt_ndb_distribution_id; #endif my_bool opt_readonly, use_temp_pool, relay_log_purge; +my_bool relay_log_recovery; my_bool opt_sync_frm, opt_allow_suspicious_udfs; my_bool opt_secure_auth= 0; char* opt_secure_file_priv= 0; @@ -553,7 +554,8 @@ ulong max_prepared_stmt_count; ulong prepared_stmt_count=0; ulong thread_id=1L,current_pid; ulong slow_launch_threads = 0; -uint sync_binlog_period= 0, sync_relaylog_period= 0; +uint sync_binlog_period= 0, sync_relaylog_period= 0, + sync_relayloginfo_period= 0, sync_masterinfo_period= 0; ulong expire_logs_days = 0; ulong rpl_recovery_rank=0; const char *log_output_str= "FILE"; @@ -5605,6 +5607,7 @@ enum options_mysqld OPT_QUERY_CACHE_TYPE, OPT_QUERY_CACHE_WLOCK_INVALIDATE, OPT_RECORD_BUFFER, OPT_RECORD_RND_BUFFER, OPT_DIV_PRECINCREMENT, OPT_RELAY_LOG_SPACE_LIMIT, OPT_RELAY_LOG_PURGE, + OPT_RELAY_LOG_RECOVERY, OPT_SLAVE_NET_TIMEOUT, OPT_SLAVE_COMPRESSED_PROTOCOL, OPT_SLOW_LAUNCH_TIME, OPT_SLAVE_TRANS_RETRIES, OPT_READONLY, OPT_DEBUGGING, OPT_SORT_BUFFER, OPT_TABLE_OPEN_CACHE, OPT_TABLE_DEF_CACHE, @@ -5669,7 +5672,9 @@ enum options_mysqld OPT_GENERAL_LOG_FILE, OPT_SLOW_QUERY_LOG_FILE, OPT_IGNORE_BUILTIN_INNODB, - OPT_SYNC_RELAY_LOG + OPT_SYNC_RELAY_LOG, + OPT_SYNC_RELAY_LOG_INFO, + OPT_SYNC_MASTER_INFO }; @@ -6889,6 +6894,13 @@ The minimum value for this variable is 4096.", (uchar**) &relay_log_purge, (uchar**) &relay_log_purge, 0, GET_BOOL, NO_ARG, 1, 0, 1, 0, 1, 0}, + {"relay_log_recovery", OPT_RELAY_LOG_RECOVERY, + "Enables automatic relay log recovery right after the database startup, " + "which means that the IO Thread starts re-fetching from the master " + "right after the last transaction processed.", + (uchar**) &relay_log_recovery, + (uchar**) &relay_log_recovery, 0, GET_BOOL, NO_ARG, + 0, 0, 1, 0, 1, 0}, {"relay_log_space_limit", OPT_RELAY_LOG_SPACE_LIMIT, "Maximum space to use for all relay logs.", (uchar**) &relay_log_space_limit, @@ -6930,6 +6942,16 @@ The minimum value for this variable is 4096.", "Use 0 (default) to disable synchronous flushing.", (uchar**) &sync_relaylog_period, (uchar**) &sync_relaylog_period, 0, GET_UINT, REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, + {"sync-relay-log-info", OPT_SYNC_RELAY_LOG_INFO, + "Synchronously flush relay log info to disk after #th transaction. " + "Use 0 (default) to disable synchronous flushing.", + (uchar**) &sync_relayloginfo_period, (uchar**) &sync_relayloginfo_period, 0, GET_UINT, + REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, + {"sync-master-info", OPT_SYNC_MASTER_INFO, + "Synchronously flush master info to disk after every #th event. " + "Use 0 (default) to disable synchronous flushing.", + (uchar**) &sync_masterinfo_period, (uchar**) &sync_masterinfo_period, 0, GET_UINT, + REQUIRED_ARG, 0, 0, (longlong) UINT_MAX, 0, 1, 0}, {"sync-frm", OPT_SYNC_FRM, "Sync .frm to disk on create. Enabled by default.", (uchar**) &opt_sync_frm, (uchar**) &opt_sync_frm, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 1bca44ac613..cec2eabdd20 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -27,11 +27,11 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, const char *default_val); -Master_info::Master_info() +Master_info::Master_info(bool is_slave_recovery) :Slave_reporting_capability("I/O"), ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0), inited(0), - abort_slave(0),slave_running(0), - slave_run_id(0) + rli(is_slave_recovery), abort_slave(0), slave_running(0), + slave_run_id(0), sync_counter(0) { host[0] = 0; user[0] = 0; password[0] = 0; ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0; @@ -364,11 +364,6 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) IO_CACHE *log_file= mi->rli.relay_log.get_log_file(); if (flush_io_cache(log_file)) DBUG_RETURN(2); - - /* Sync to disk if --sync-relay-log is set */ - if (sync_relaylog_period && - my_sync(log_file->file, MY_WME)) - DBUG_RETURN(2); } /* @@ -398,8 +393,12 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert, mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert); err= flush_io_cache(file); - if (sync_relaylog_period && !err) + if (sync_masterinfo_period && !err && + ++(mi->sync_counter) >= sync_masterinfo_period) + { err= my_sync(mi->fd, MYF(MY_WME)); + mi->sync_counter= 0; + } DBUG_RETURN(-err); } diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 93fb0a98198..c59dffefb7c 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -58,7 +58,7 @@ class Master_info : public Slave_reporting_capability { public: - Master_info(); + Master_info(bool is_slave_recovery); ~Master_info(); /* the variables below are needed because we can change masters on the fly */ @@ -100,6 +100,13 @@ class Master_info : public Slave_reporting_capability */ long clock_diff_with_master; + + /* + Keeps track of the number of events before fsyncing. + The option --sync-master-info determines how many + events should happen before fsyncing. + */ + uint sync_counter; }; void init_master_info_with_options(Master_info* mi); diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 37c0815fb8b..3a12164a1cf 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -28,11 +28,11 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, const char *default_val); - -Relay_log_info::Relay_log_info() +Relay_log_info::Relay_log_info(bool is_slave_recovery) :Slave_reporting_capability("SQL"), no_storage(FALSE), replicate_same_server_id(::replicate_same_server_id), info_fd(-1), cur_log_fd(-1), relay_log(&sync_relaylog_period), + sync_counter(0), is_relay_log_recovery(is_slave_recovery), save_temporary_tables(0), #if HAVE_purify is_fake(FALSE), @@ -259,7 +259,8 @@ Failed to open the existing relay log info file '%s' (errno %d)", rli->group_relay_log_pos= rli->event_relay_log_pos= relay_log_pos; rli->group_master_log_pos= master_log_pos; - if (init_relay_log_pos(rli, + if (!rli->is_relay_log_recovery && + init_relay_log_pos(rli, rli->group_relay_log_name, rli->group_relay_log_pos, 0 /* no data lock*/, @@ -274,6 +275,7 @@ Failed to open the existing relay log info file '%s' (errno %d)", } #ifndef DBUG_OFF + if (!rli->is_relay_log_recovery) { char llbuf1[22], llbuf2[22]; DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s", diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index 171778d9675..a5410dd0c79 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -96,6 +96,19 @@ public: LOG_INFO linfo; IO_CACHE cache_buf,*cur_log; + /* + Keeps track of the number of transactions that commits + before fsyncing. The option --sync-relay-log-info determines + how many transactions should commit before fsyncing. + */ + uint sync_counter; + + /* + Identifies when the recovery process is going on. + See sql/slave.cc:init_recovery for further details. + */ + bool is_relay_log_recovery; + /* The following variables are safe to read any time */ /* IO_CACHE of the info file - set only during init or end */ @@ -267,7 +280,7 @@ public: char slave_patternload_file[FN_REFLEN]; size_t slave_patternload_file_size; - Relay_log_info(); + Relay_log_info(bool is_slave_recovery); ~Relay_log_info(); /* diff --git a/sql/set_var.cc b/sql/set_var.cc index f2b5201cf8b..dcc3954ff1e 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1534,19 +1534,19 @@ static bool get_unsigned(THD *thd, set_var *var, ulonglong user_max, } -bool sys_var_int_ptr::check(THD *thd, set_var *var) +bool sys_var_uint_ptr::check(THD *thd, set_var *var) { - var->save_result.ulong_value= (ulong) var->value->val_int(); + var->save_result.ulong_value= (ulong) var->value->val_uint(); return 0; } -bool sys_var_int_ptr::update(THD *thd, set_var *var) +bool sys_var_uint_ptr::update(THD *thd, set_var *var) { *value= (uint) var->save_result.ulong_value; return 0; } -void sys_var_int_ptr::set_default(THD *thd, enum_var_type type) +void sys_var_uint_ptr::set_default(THD *thd, enum_var_type type) { *value= (uint) option_limits->def_value; } diff --git a/sql/set_var.h b/sql/set_var.h index 02c87abed88..0202a15836d 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -178,10 +178,10 @@ public: /** Unsigned int system variable class */ -class sys_var_int_ptr :public sys_var +class sys_var_uint_ptr :public sys_var { public: - sys_var_int_ptr(sys_var_chain *chain, const char *name_arg, + sys_var_uint_ptr(sys_var_chain *chain, const char *name_arg, uint *value_ptr_arg, sys_after_update_func after_update_arg= NULL) :sys_var(name_arg, after_update_arg), diff --git a/sql/slave.cc b/sql/slave.cc index fac9ee214c5..5edb47df8b5 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -129,6 +129,7 @@ static bool wait_for_relay_log_space(Relay_log_info* rli); static inline bool io_slave_killed(THD* thd,Master_info* mi); static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli); static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type); +static int init_recovery(Master_info* mi); static void print_slave_skip_errors(void); static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi); static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi, @@ -220,6 +221,7 @@ void unlock_slave_threads(Master_info* mi) int init_slave() { DBUG_ENTER("init_slave"); + int error= 0; /* This is called when mysqld starts. Before client connections are @@ -231,7 +233,7 @@ int init_slave() TODO: re-write this to interate through the list of files for multi-master */ - active_mi= new Master_info; + active_mi= new Master_info(relay_log_recovery); /* If --slave-skip-errors=... was not used, the string value for the @@ -250,6 +252,7 @@ int init_slave() if (!active_mi) { sql_print_error("Failed to allocate memory for the master info structure"); + error= 1; goto err; } @@ -257,6 +260,13 @@ int init_slave() !master_host, (SLAVE_IO | SLAVE_SQL))) { sql_print_error("Failed to initialize the master info structure"); + error= 1; + goto err; + } + + if (active_mi->rli.is_relay_log_recovery && init_recovery(active_mi)) + { + error= 1; goto err; } @@ -275,18 +285,89 @@ int init_slave() SLAVE_IO | SLAVE_SQL)) { sql_print_error("Failed to create slave threads"); + error= 1; goto err; } } - pthread_mutex_unlock(&LOCK_active_mi); - DBUG_RETURN(0); err: + active_mi->rli.is_relay_log_recovery= FALSE; pthread_mutex_unlock(&LOCK_active_mi); - DBUG_RETURN(1); + DBUG_RETURN(error); } +/* + Updates the master info based on the information stored in the + relay info and ignores relay logs previously retrieved by the IO + thread, which thus starts fetching again based on to the + group_master_log_pos and group_master_log_name. Eventually, the old + relay logs will be purged by the normal purge mechanism. + In the feature, we should improve this routine in order to avoid throwing + away logs that are safely stored in the disk. Note also that this recovery + routine relies on the correctness of the relay-log.info and only tolerates + coordinate problems in master.info. + + In this function, there is no need for a mutex as the caller + (i.e. init_slave) already has one acquired. + + Specifically, the following structures are updated: + + 1 - mi->master_log_pos <-- rli->group_master_log_pos + 2 - mi->master_log_name <-- rli->group_master_log_name + 3 - It moves the relay log to the new relay log file, by + rli->group_relay_log_pos <-- BIN_LOG_HEADER_SIZE; + rli->event_relay_log_pos <-- BIN_LOG_HEADER_SIZE; + rli->group_relay_log_name <-- rli->relay_log.get_log_fname(); + rli->event_relay_log_name <-- rli->relay_log.get_log_fname(); + + If there is an error, it returns (1), otherwise returns (0). + */ +static int init_recovery(Master_info* mi) +{ + const char *errmsg= 0; + DBUG_ENTER("init_recovery"); + + Relay_log_info *rli= &mi->rli; + if (rli->group_master_log_name[0]) + { + mi->master_log_pos= max(BIN_LOG_HEADER_SIZE, + rli->group_master_log_pos); + strmake(mi->master_log_name, rli->group_master_log_name, + sizeof(mi->master_log_name)-1); + + sql_print_warning("Recovery from master pos %ld and file %s.", + (ulong) mi->master_log_pos, mi->master_log_name); + + strmake(rli->group_relay_log_name, rli->relay_log.get_log_fname(), + sizeof(rli->group_relay_log_name)-1); + strmake(rli->event_relay_log_name, rli->relay_log.get_log_fname(), + sizeof(mi->rli.event_relay_log_name)-1); + + rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE; + + if (init_relay_log_pos(rli, + rli->group_relay_log_name, + rli->group_relay_log_pos, + 0 /*no data lock*/, + &errmsg, 0)) + DBUG_RETURN(1); + + if (flush_master_info(mi, 0)) + { + sql_print_error("Failed to flush master info file"); + DBUG_RETURN(1); + } + if (flush_relay_log_info(rli)) + { + sql_print_error("Failed to flush relay info file"); + DBUG_RETURN(1); + } + } + + DBUG_RETURN(0); +} + /** Convert slave skip errors bitmap into a printable string. */ @@ -3959,7 +4040,14 @@ bool flush_relay_log_info(Relay_log_info* rli) error=1; if (flush_io_cache(file)) error=1; - + if (sync_relayloginfo_period && + !error && + ++(rli->sync_counter) >= sync_relayloginfo_period) + { + if (my_sync(rli->info_fd, MYF(MY_WME))) + error=1; + rli->sync_counter= 0; + } /* Flushing the relay log is done by the slave I/O thread */ DBUG_RETURN(error); } @@ -4366,6 +4454,8 @@ void rotate_relay_log(Master_info* mi) DBUG_ENTER("rotate_relay_log"); Relay_log_info* rli= &mi->rli; + DBUG_EXECUTE_IF("crash_before_rotate_relaylog", abort();); + /* We don't lock rli->run_lock. This would lead to deadlocks. */ pthread_mutex_lock(&mi->run_lock); diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc index 96e99b57e3c..531242f64d1 100644 --- a/sql/sql_binlog.cc +++ b/sql/sql_binlog.cc @@ -58,7 +58,7 @@ void mysql_client_binlog_statement(THD* thd) my_bool have_fd_event= TRUE; if (!thd->rli_fake) { - thd->rli_fake= new Relay_log_info; + thd->rli_fake= new Relay_log_info(FALSE); #ifdef HAVE_purify thd->rli_fake->is_fake= TRUE; #endif diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 425d76c8b72..6295dbb0e79 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1769,6 +1769,16 @@ static sys_var_const sys_relay_log_info_file(&vars, "relay_log_info_file", (uchar*) &relay_log_info_file); static sys_var_bool_ptr sys_relay_log_purge(&vars, "relay_log_purge", &relay_log_purge); +static sys_var_bool_ptr sys_relay_log_recovery(&vars, "relay_log_recovery", + &relay_log_recovery); +static sys_var_uint_ptr sys_sync_binlog_period(&vars, "sync_binlog", + &sync_binlog_period); +static sys_var_uint_ptr sys_sync_relaylog_period(&vars, "sync_relay_log", + &sync_relaylog_period); +static sys_var_uint_ptr sys_sync_relayloginfo_period(&vars, "sync_relay_log_info", + &sync_relayloginfo_period); +static sys_var_uint_ptr sys_sync_masterinfo_period(&vars, "sync_master_info", + &sync_masterinfo_period); static sys_var_const sys_relay_log_space_limit(&vars, "relay_log_space_limit", OPT_GLOBAL, SHOW_LONGLONG, @@ -1784,8 +1794,6 @@ static sys_var_const sys_slave_skip_errors(&vars, "slave_skip_errors", (uchar*) slave_skip_error_names); static sys_var_long_ptr sys_slave_trans_retries(&vars, "slave_transaction_retries", &slave_trans_retries); -static sys_var_int_ptr sys_sync_binlog_period(&vars, "sync_binlog", &sync_binlog_period); -static sys_var_int_ptr sys_sync_relaylog_period(&vars, "sync_relay_log", &sync_relaylog_period); static sys_var_slave_skip_counter sys_slave_skip_counter(&vars, "sql_slave_skip_counter"); From 7771b90295d13af201e6adb5dd16d4e871b8c3cb Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Wed, 30 Sep 2009 16:09:31 +0800 Subject: [PATCH 54/88] Back porting the test case for semi-sync --- mysql-test/include/have_semisync_plugin.inc | 15 + mysql-test/suite/rpl/r/rpl_semi_sync.result | 398 ++++++++++++++ .../suite/rpl/t/rpl_semi_sync-master.opt | 1 + .../suite/rpl/t/rpl_semi_sync-slave.opt | 1 + mysql-test/suite/rpl/t/rpl_semi_sync.test | 517 ++++++++++++++++++ 5 files changed, 932 insertions(+) create mode 100644 mysql-test/include/have_semisync_plugin.inc create mode 100644 mysql-test/suite/rpl/r/rpl_semi_sync.result create mode 100644 mysql-test/suite/rpl/t/rpl_semi_sync-master.opt create mode 100644 mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt create mode 100644 mysql-test/suite/rpl/t/rpl_semi_sync.test diff --git a/mysql-test/include/have_semisync_plugin.inc b/mysql-test/include/have_semisync_plugin.inc new file mode 100644 index 00000000000..38e2fcd6115 --- /dev/null +++ b/mysql-test/include/have_semisync_plugin.inc @@ -0,0 +1,15 @@ +# +# Check if dynamic loading is supported +# +--require r/have_dynamic_loading.require +disable_query_log; +show variables like 'have_dynamic_loading'; +enable_query_log; + +# +# Check if the variable SEMISYNC_MASTER_PLUGIN is set +# +if (`select LENGTH('$SEMISYNC_MASTER_PLUGIN') = 0`) +{ + skip Need semisync plugins; +} diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result new file mode 100644 index 00000000000..d6f2a3aceff --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -0,0 +1,398 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +# +# Uninstall semi-sync plugins on master and slave +# +include/stop_slave.inc +reset slave; +UNINSTALL PLUGIN rpl_semi_sync_slave; +UNINSTALL PLUGIN rpl_semi_sync_master; +reset master; +set sql_log_bin=0; +UNINSTALL PLUGIN rpl_semi_sync_slave; +UNINSTALL PLUGIN rpl_semi_sync_master; +set sql_log_bin=1; +# +# Main test of semi-sync replication start here +# +[ on master ] +[ default state of semi-sync on master should be OFF ] +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled OFF +[ enable semi-sync on master ] +set global rpl_semi_sync_master_enabled = 1; +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled ON +[ status of semi-sync on master should be OFF without any semi-sync slaves ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 0 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +# +# BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed +# BUG#45673 Semisynch reports correct operation even if no slave is connected +# +[ status of semi-sync on master should be OFF ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 0 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +# +# INSTALL PLUGIN semi-sync on slave +# +[ on slave ] +[ default state of semi-sync on slave should be OFF ] +show variables like 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled OFF +[ enable semi-sync on slave ] +set global rpl_semi_sync_slave_enabled = 1; +show variables like 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled ON +include/start_slave.inc +[ on master ] +[ initial master state after the semi-sync slave connected ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +create table t1(n int) engine = ENGINE_TYPE; +[ master state after CREATE TABLE statement ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 1 +[ insert records to table ] +[ master status after inserts ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 301 +[ on slave ] +[ slave status after replicated inserts ] +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +select count(distinct n) from t1; +count(distinct n) +300 +select min(n) from t1; +min(n) +1 +select max(n) from t1; +max(n) +300 +include/stop_slave.inc +[ on master ] +[ master status should be ON ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 301 +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +[ semi-sync replication of these transactions will fail ] +insert into t1 values (500); +delete from t1 where n < 500; +insert into t1 values (100); +[ master status should be OFF ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 3 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 301 +[ on slave ] +[ slave status should be OFF ] +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +include/start_slave.inc +[ slave status should be ON ] +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +select count(distinct n) from t1; +count(distinct n) +2 +select min(n) from t1; +min(n) +100 +select max(n) from t1; +max(n) +500 +[ on master ] +[ do something to activate semi-sync ] +drop table t1; +[ master status should be ON again ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 3 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 302 +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +[ on slave ] +include/stop_slave.inc +[ on master ] +show master logs; +Log_name master-bin.000001 +File_size # +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled ON +[ disable semi-sync on the fly ] +set global rpl_semi_sync_master_enabled=0; +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled OFF +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +[ enable semi-sync on the fly ] +set global rpl_semi_sync_master_enabled=1; +show variables like 'rpl_semi_sync_master_enabled'; +Variable_name Value +rpl_semi_sync_master_enabled ON +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +[ on slave ] +include/start_slave.inc +[ on master ] +create table t1 (a int) engine = ENGINE_TYPE; +drop table t1; +show status like 'Rpl_relay%'; +Variable_name Value +[ test reset master ] +[ on master] +reset master; +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +[ on slave ] +include/stop_slave.inc +reset slave; +include/start_slave.inc +[ on master ] +create table t1 (a int) engine = ENGINE_TYPE; +insert into t1 values (1); +insert into t1 values (2), (3); +[ on slave ] +select * from t1; +a +1 +2 +3 +[ on master ] +[ master semi-sync status should be ON ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 3 +# +# Start semi-sync replication without SUPER privilege +# +include/stop_slave.inc +reset slave; +[ on master ] +reset master; +set sql_log_bin=0; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +flush privileges; +set sql_log_bin=1; +[ on slave ] +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +flush privileges; +change master to master_user='rpl',master_password='rpl'; +include/start_slave.inc +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status ON +[ on master ] +[ master semi-sync should be ON ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 +insert into t1 values (4); +insert into t1 values (5); +[ master semi-sync should be ON ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 1 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status ON +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 2 +# +# Test semi-sync slave connect to non-semi-sync master +# +[ on slave ] +include/stop_slave.inc +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +[ on master ] +[ Semi-sync status on master should be ON ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 0 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +set global rpl_semi_sync_master_enabled= 0; +[ on slave ] +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled ON +include/start_slave.inc +[ on master ] +insert into t1 values (8); +[ master semi-sync clients should be 0, status should be OFF ] +show status like 'Rpl_semi_sync_master_clients'; +Variable_name Value +Rpl_semi_sync_master_clients 0 +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +[ on slave ] +show status like 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +include/stop_slave.inc +[ on master ] +set sql_log_bin=0; +UNINSTALL PLUGIN rpl_semi_sync_master; +set sql_log_bin=1; +SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled'; +Variable_name Value +[ on slave ] +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled ON +include/start_slave.inc +[ on master ] +insert into t1 values (10); +[ on slave ] +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +# +# Test non-semi-sync slave connect to semi-sync master +# +set sql_log_bin=0; +INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so'; +set global rpl_semi_sync_master_timeout= 5000; +/* 5s */ +set sql_log_bin=1; +set global rpl_semi_sync_master_enabled= 1; +[ on slave ] +include/stop_slave.inc +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +[ uninstall semi-sync slave plugin ] +UNINSTALL PLUGIN rpl_semi_sync_slave; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +Variable_name Value +include/start_slave.inc +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +include/stop_slave.inc +[ reinstall semi-sync slave plugin and disable semi-sync ] +INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so'; +set global rpl_semi_sync_slave_enabled= 0; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +Variable_name Value +rpl_semi_sync_slave_enabled OFF +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +include/start_slave.inc +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +Variable_name Value +Rpl_semi_sync_slave_status OFF +# +# Clean up +# +include/stop_slave.inc +UNINSTALL PLUGIN rpl_semi_sync_slave; +UNINSTALL PLUGIN rpl_semi_sync_master; +include/start_slave.inc +drop table t1; +drop user rpl@127.0.0.1; +flush privileges; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt new file mode 100644 index 00000000000..58029d28ace --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_semi_sync-master.opt @@ -0,0 +1 @@ +$SEMISYNC_PLUGIN_OPT diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt b/mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt new file mode 100644 index 00000000000..58029d28ace --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_semi_sync-slave.opt @@ -0,0 +1 @@ +$SEMISYNC_PLUGIN_OPT diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test new file mode 100644 index 00000000000..9798ffdb642 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -0,0 +1,517 @@ +source include/have_semisync_plugin.inc; +source include/not_embedded.inc; +source include/not_windows.inc; +source include/have_innodb.inc; +source include/master-slave.inc; + +let $engine_type= InnoDB; +#let $engine_type= MyISAM; + +# Suppress warnings that might be generated during the test +disable_query_log; +connection master; +call mtr.add_suppression("Timeout waiting for reply of binlog"); +connection slave; +call mtr.add_suppression("Master server does not support"); +# These will be removed after fix bug#45852 +call mtr.add_suppression("Set 'rpl_semi_sync_master_reply_log_file_pos' on master failed"); +call mtr.add_suppression("Slave I/O: Fatal error: Failed to run 'after_queue_event' hook, Error_code: 1593"); +enable_query_log; + +--echo # +--echo # Uninstall semi-sync plugins on master and slave +--echo # +connection slave; +disable_query_log; +source include/stop_slave.inc; +reset slave; +disable_warnings; +error 0,1305; +UNINSTALL PLUGIN rpl_semi_sync_slave; +error 0,1305; +UNINSTALL PLUGIN rpl_semi_sync_master; +enable_warnings; + +connection master; +reset master; +set sql_log_bin=0; +disable_warnings; +error 0,1305; +UNINSTALL PLUGIN rpl_semi_sync_slave; +error 0,1305; +UNINSTALL PLUGIN rpl_semi_sync_master; +enable_warnings; +set sql_log_bin=1; +enable_query_log; + +--echo # +--echo # Main test of semi-sync replication start here +--echo # + +connection master; +echo [ on master ]; + +disable_query_log; +let $value = query_get_value(show variables like 'rpl_semi_sync_master_enabled', Value, 1); +if (`select '$value' = 'No such row'`) +{ + set sql_log_bin=0; + INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so'; + set global rpl_semi_sync_master_timeout= 5000; /* 5s */ + set sql_log_bin=1; +} +enable_query_log; + +echo [ default state of semi-sync on master should be OFF ]; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ enable semi-sync on master ]; +set global rpl_semi_sync_master_enabled = 1; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ status of semi-sync on master should be OFF without any semi-sync slaves ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # BUG#45672 Semisync repl: ActiveTranx:insert_tranx_node: transaction node allocation failed +--echo # BUG#45673 Semisynch reports correct operation even if no slave is connected +--echo # + +# BUG#45672 When semi-sync is enabled on master, it would allocate +# transaction node even without semi-sync slave connected, and would +# finally result in transaction node allocation error. +# +# Semi-sync master will pre-allocate 'max_connections' transaction +# nodes, so here we do more than that much transactions to check if it +# will fail or not. +# select @@global.max_connections + 1; +let $i= `select @@global.max_connections + 1`; +disable_query_log; +eval create table t1 (a int) engine=$engine_type; +while ($i) +{ + eval insert into t1 values ($i); + dec $i; +} +drop table t1; +enable_query_log; + +# BUG#45673 +echo [ status of semi-sync on master should be OFF ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +disable_query_log; +# reset master to make sure the following test will start with a clean environment +reset master; +enable_query_log; + +--echo # +--echo # INSTALL PLUGIN semi-sync on slave +--echo # + +connection slave; +echo [ on slave ]; + +disable_query_log; +let $value= query_get_value(show variables like 'rpl_semi_sync_slave_enabled', Value, 1); +if (`select '$value' = 'No such row'`) +{ + set sql_log_bin=0; + INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so'; + set sql_log_bin=1; +} +enable_query_log; + +echo [ default state of semi-sync on slave should be OFF ]; +show variables like 'rpl_semi_sync_slave_enabled'; + +echo [ enable semi-sync on slave ]; +set global rpl_semi_sync_slave_enabled = 1; +show variables like 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; + +connection master; +echo [ on master ]; + +# NOTE: Rpl_semi_sync_master_client will only be updated when +# semi-sync slave has started binlog dump request +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; + +echo [ initial master state after the semi-sync slave connected ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1(n int) engine = $engine_type; + +echo [ master state after CREATE TABLE statement ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +let $i=300; +echo [ insert records to table ]; +disable_query_log; +while ($i) +{ + eval insert into t1 values ($i); + dec $i; +} +enable_query_log; + +echo [ master status after inserts ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +sync_slave_with_master; +echo [ on slave ]; + +echo [ slave status after replicated inserts ]; +show status like 'Rpl_semi_sync_slave_status'; + +select count(distinct n) from t1; +select min(n) from t1; +select max(n) from t1; + +source include/stop_slave.inc; + +connection master; +echo [ on master ]; + +# The first semi-sync check should be on because after slave stop, +# there are no transactions on the master. +echo [ master status should be ON ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; +show status like 'Rpl_semi_sync_master_clients'; + +echo [ semi-sync replication of these transactions will fail ]; +insert into t1 values (500); +delete from t1 where n < 500; +insert into t1 values (100); + +# The second semi-sync check should be off because one transaction +# times out during waiting. +echo [ master status should be OFF ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +# Save the master position for later use. +save_master_pos; + +connection slave; +echo [ on slave ]; + +echo [ slave status should be OFF ]; +show status like 'Rpl_semi_sync_slave_status'; +source include/start_slave.inc; +sync_with_master; + +echo [ slave status should be ON ]; +show status like 'Rpl_semi_sync_slave_status'; + +select count(distinct n) from t1; +select min(n) from t1; +select max(n) from t1; + +connection master; +echo [ on master ]; + +echo [ do something to activate semi-sync ]; +drop table t1; + +# The third semi-sync check should be on again. +echo [ master status should be ON again ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; +show status like 'Rpl_semi_sync_master_clients'; + +sync_slave_with_master; +echo [ on slave ]; + +source include/stop_slave.inc; + +connection master; +echo [ on master ]; + +source include/show_master_logs.inc; +show variables like 'rpl_semi_sync_master_enabled'; + +echo [ disable semi-sync on the fly ]; +set global rpl_semi_sync_master_enabled=0; +show variables like 'rpl_semi_sync_master_enabled'; +show status like 'Rpl_semi_sync_master_status'; + +echo [ enable semi-sync on the fly ]; +set global rpl_semi_sync_master_enabled=1; +show variables like 'rpl_semi_sync_master_enabled'; +show status like 'Rpl_semi_sync_master_status'; + +connection slave; +echo [ on slave ]; + +source include/start_slave.inc; + +connection master; +echo [ on master ]; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1 (a int) engine = $engine_type; +drop table t1; + +##show status like 'Rpl_semi_sync_master_status'; + +sync_slave_with_master; +--replace_column 2 # +show status like 'Rpl_relay%'; + +echo [ test reset master ]; +connection master; +echo [ on master]; + +reset master; + +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +connection slave; +echo [ on slave ]; + +source include/stop_slave.inc; +reset slave; + +# Kill the dump thread on master for previous slave connection and +# wait for it to exit +connection master; +let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; +if ($_tid) +{ + disable_query_log; + eval kill query $_tid; + enable_query_log; + + # After dump thread exit, Rpl_semi_sync_master_clients will be 0 + let $status_var= Rpl_semi_sync_master_clients; + let $status_var_value= 0; + source include/wait_for_status_var.inc; +} + +connection slave; +source include/start_slave.inc; + +connection master; +echo [ on master ]; + +# Wait for dump thread to start, Rpl_semi_sync_master_clients will be +# 1 after dump thread started. +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; + +replace_result $engine_type ENGINE_TYPE; +eval create table t1 (a int) engine = $engine_type; +insert into t1 values (1); +insert into t1 values (2), (3); + +sync_slave_with_master; +echo [ on slave ]; + +select * from t1; + +connection master; +echo [ on master ]; + +echo [ master semi-sync status should be ON ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Start semi-sync replication without SUPER privilege +--echo # +connection slave; +source include/stop_slave.inc; +reset slave; +connection master; +echo [ on master ]; +reset master; + +# Kill the dump thread on master for previous slave connection and wait for it to exit +let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; +if ($_tid) +{ + disable_query_log; + eval kill query $_tid; + enable_query_log; + + # After dump thread exit, Rpl_semi_sync_master_clients will be 0 + let $status_var= Rpl_semi_sync_master_clients; + let $status_var_value= 0; + source include/wait_for_status_var.inc; +} + +# Do not binlog the following statement because it will generate +# different events for ROW and STATEMENT format +set sql_log_bin=0; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +flush privileges; +set sql_log_bin=1; +connection slave; +echo [ on slave ]; +grant replication slave on *.* to rpl@127.0.0.1 identified by 'rpl'; +flush privileges; +change master to master_user='rpl',master_password='rpl'; +source include/start_slave.inc; +show status like 'Rpl_semi_sync_slave_status'; +connection master; +echo [ on master ]; + +# Wait for the semi-sync binlog dump thread to start +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; +echo [ master semi-sync should be ON ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; +insert into t1 values (4); +insert into t1 values (5); +echo [ master semi-sync should be ON ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Test semi-sync slave connect to non-semi-sync master +--echo # + +# Disable semi-sync on master +connection slave; +echo [ on slave ]; +source include/stop_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +connection master; +echo [ on master ]; + +# Kill the dump thread on master for previous slave connection and wait for it to exit +let $_tid= `select id from information_schema.processlist where command = 'Binlog Dump' limit 1`; +if ($_tid) +{ + disable_query_log; + eval kill query $_tid; + enable_query_log; + + # After dump thread exit, Rpl_semi_sync_master_clients will be 0 + let $status_var= Rpl_semi_sync_master_clients; + let $status_var_value= 0; + source include/wait_for_status_var.inc; +} + +echo [ Semi-sync status on master should be ON ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +set global rpl_semi_sync_master_enabled= 0; + +connection slave; +echo [ on slave ]; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; +connection master; +echo [ on master ]; +insert into t1 values (8); +echo [ master semi-sync clients should be 0, status should be OFF ]; +show status like 'Rpl_semi_sync_master_clients'; +show status like 'Rpl_semi_sync_master_status'; +sync_slave_with_master; +echo [ on slave ]; +show status like 'Rpl_semi_sync_slave_status'; + +# Uninstall semi-sync plugin on master +connection slave; +source include/stop_slave.inc; +connection master; +echo [ on master ]; +set sql_log_bin=0; +UNINSTALL PLUGIN rpl_semi_sync_master; +set sql_log_bin=1; +enable_query_log; +SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled'; + +connection slave; +echo [ on slave ]; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; + +connection master; +echo [ on master ]; +insert into t1 values (10); +sync_slave_with_master; +echo [ on slave ]; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +--echo # +--echo # Test non-semi-sync slave connect to semi-sync master +--echo # + +connection master; +set sql_log_bin=0; +INSTALL PLUGIN rpl_semi_sync_master SONAME 'libsemisync_master.so'; +set global rpl_semi_sync_master_timeout= 5000; /* 5s */ +set sql_log_bin=1; +set global rpl_semi_sync_master_enabled= 1; + +connection slave; +echo [ on slave ]; +source include/stop_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +echo [ uninstall semi-sync slave plugin ]; +UNINSTALL PLUGIN rpl_semi_sync_slave; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +source include/start_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +source include/stop_slave.inc; + +echo [ reinstall semi-sync slave plugin and disable semi-sync ]; +INSTALL PLUGIN rpl_semi_sync_slave SONAME 'libsemisync_slave.so'; +set global rpl_semi_sync_slave_enabled= 0; +SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; +source include/start_slave.inc; +SHOW STATUS LIKE 'Rpl_semi_sync_slave_status'; + +--echo # +--echo # Clean up +--echo # + +connection slave; +source include/stop_slave.inc; +UNINSTALL PLUGIN rpl_semi_sync_slave; + +connection master; +UNINSTALL PLUGIN rpl_semi_sync_master; + +connection slave; +source include/start_slave.inc; + +connection master; +drop table t1; +drop user rpl@127.0.0.1; +flush privileges; +sync_slave_with_master; From b3ece14b3a36ab1ec3f935271bce108bd3e6ef1b Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Wed, 30 Sep 2009 19:36:35 +0800 Subject: [PATCH 55/88] Backporting BUG#40244 Optimized build of mysqld crashes when built with Sun Studio on SPARC --- sql/rpl_handler.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index aea838928b9..da7aade5b99 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -88,11 +88,11 @@ int get_user_var_str(const char *name, char *value, int delegates_init() { - static unsigned char trans_mem[sizeof(Trans_delegate)]; - static unsigned char storage_mem[sizeof(Binlog_storage_delegate)]; + static unsigned long trans_mem[sizeof(Trans_delegate) / sizeof(unsigned long) + 1]; + static unsigned long storage_mem[sizeof(Binlog_storage_delegate) / sizeof(unsigned long) + 1]; #ifdef HAVE_REPLICATION - static unsigned char transmit_mem[sizeof(Binlog_transmit_delegate)]; - static unsigned char relay_io_mem[sizeof(Binlog_relay_IO_delegate)]; + static unsigned long transmit_mem[sizeof(Binlog_transmit_delegate) / sizeof(unsigned long) + 1]; + static unsigned long relay_io_mem[sizeof(Binlog_relay_IO_delegate)/ sizeof(unsigned long) + 1]; #endif if (!(transaction_delegate= new (trans_mem) Trans_delegate) From 47599b5db2e7bab305d0ee29ffc7774bb7714ff9 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Wed, 30 Sep 2009 15:17:15 +0100 Subject: [PATCH 56/88] Post-fix for BUG#43789 NOTE: Backporting the patch to next-mr. --- mysql-test/collections/default.experimental | 1 + mysql-test/extra/rpl_tests/rpl_not_null.test | 36 +++++++++---------- .../suite/rpl/r/rpl_not_null_innodb.result | 24 ++++++------- .../suite/rpl/r/rpl_not_null_myisam.result | 24 ++++++------- 4 files changed, 43 insertions(+), 42 deletions(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 416bf7d9e67..dc51d0cc697 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -6,3 +6,4 @@ rpl.rpl_row_create_table* # Bug#45576: rpl_row_create_table fails rpl_ndb.rpl_ndb_log # Bug#38998 rpl.rpl_innodb_bug28430* @solaris # Bug#46029 rpl.rpl_get_master_version_and_clock* # Bug#46931 2009-08-26 alik rpl.rpl_get_master_version_and_clock fails on hpux11.31 +rpl_ndb.rpl_ndb_extraCol* # BUG#41369 2008-12-10 alik, BUG#47741 2009-09-30 alfranio diff --git a/mysql-test/extra/rpl_tests/rpl_not_null.test b/mysql-test/extra/rpl_tests/rpl_not_null.test index 88f37f9a95e..58dbd9ce29f 100644 --- a/mysql-test/extra/rpl_tests/rpl_not_null.test +++ b/mysql-test/extra/rpl_tests/rpl_not_null.test @@ -81,13 +81,13 @@ source include/diff_tables.inc; --echo TABLES t2 and t3 must be different. connection master; -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; connection slave; -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; connection master; -SELECT * FROM t4; +SELECT * FROM t4 ORDER BY a; connection slave; -SELECT * FROM t4; +SELECT * FROM t4 ORDER BY a; --echo ************* EXECUTION WITH UPDATES and REPLACES ************* connection master; @@ -139,9 +139,9 @@ INSERT INTO t1(a) VALUES (5); --echo TABLES t1 and t2 must be different. sync_slave_with_master; connection master; -SELECT a,b+0,c+0 FROM t1; +SELECT a,b+0,c+0 FROM t1 ORDER BY a; connection slave; -SELECT a,b+0,c+0 FROM t1; +SELECT a,b+0,c+0 FROM t1 ORDER BY a; --echo ************* EXECUTION WITH UPDATES and REPLACES ************* connection master; @@ -262,17 +262,17 @@ sync_slave_with_master; # connection slave; # --source include/wait_for_slave_sql_to_stop.inc # connection master; -# SELECT * FROM t1; +# SELECT * FROM t1 ORDER BY a; # connection slave; -# SELECT * FROM t1; +# SELECT * FROM t1 ORDER BY a; # connection master; -# SELECT * FROM t2; +# SELECT * FROM t2 ORDER BY a; # connection slave; -# SELECT * FROM t2; +# SELECT * FROM t2 ORDER BY a; # connection master; -# SELECT * FROM t3; +# SELECT * FROM t3 ORDER BY a; # connection slave; -# SELECT * FROM t3; +# SELECT * FROM t3 ORDER BY a; # --source include/reset_master_and_slave.inc # # connection master; @@ -343,17 +343,17 @@ connection master; sync_slave_with_master; connection master; -SELECT * FROM t1; +SELECT * FROM t1 ORDER BY a; connection slave; -SELECT * FROM t1; +SELECT * FROM t1 ORDER BY a; connection master; -SELECT * FROM t2; +SELECT * FROM t2 ORDER BY a; connection slave; -SELECT * FROM t2; +SELECT * FROM t2 ORDER BY a; connection master; -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; connection slave; -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; connection master; diff --git a/mysql-test/suite/rpl/r/rpl_not_null_innodb.result b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result index 7717beb0a47..b09fbab905a 100644 --- a/mysql-test/suite/rpl/r/rpl_not_null_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_not_null_innodb.result @@ -48,24 +48,24 @@ TABLES t1 and t2 must be equal otherwise an error will be thrown. Comparing tables master:test.t1 and slave:test.t1 Comparing tables master:test.t2 and slave:test.t2 TABLES t2 and t3 must be different. -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; a b 1 NULL 2 1111-11-11 3 NULL -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; a b c 1 NULL 500 2 1111-11-11 500 3 NULL 500 -SELECT * FROM t4; +SELECT * FROM t4 ORDER BY a; a b c 1 NULL 1 2 1111-11-11 2 3 NULL NULL 4 NULL 4 5 NULL NULL -SELECT * FROM t4; +SELECT * FROM t4 ORDER BY a; a b 1 NULL 2 1111-11-11 @@ -100,14 +100,14 @@ INSERT INTO t1(a,c) VALUES (4, b'01'); INSERT INTO t1(a) VALUES (5); ************* SHOWING THE RESULT SETS WITH INSERTS ************* TABLES t1 and t2 must be different. -SELECT a,b+0,c+0 FROM t1; +SELECT a,b+0,c+0 FROM t1 ORDER BY a; a b+0 c+0 1 NULL 1 2 0 1 3 NULL NULL 4 NULL 1 5 NULL NULL -SELECT a,b+0,c+0 FROM t1; +SELECT a,b+0,c+0 FROM t1 ORDER BY a; a b+0 c+0 1 NULL 1 2 0 1 @@ -163,34 +163,34 @@ REPLACE INTO t3(a, b) VALUES (5, null); REPLACE INTO t3(a, b) VALUES (3, null); UPDATE t3 SET b = NULL where a = 4; ************* SHOWING THE RESULT SETS ************* -SELECT * FROM t1; +SELECT * FROM t1 ORDER BY a; a b 1 NULL 2 NULL 3 1 -SELECT * FROM t1; +SELECT * FROM t1 ORDER BY a; a b c 1 0 0 2 0 0 3 1 0 -SELECT * FROM t2; +SELECT * FROM t2 ORDER BY a; a b 1 NULL 2 NULL 3 1 -SELECT * FROM t2; +SELECT * FROM t2 ORDER BY a; a b c 1 0 NULL 2 0 NULL 3 1 NULL -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; a b 1 NULL 2 NULL 3 NULL 4 NULL 5 NULL -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; a b c 1 0 500 2 0 500 diff --git a/mysql-test/suite/rpl/r/rpl_not_null_myisam.result b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result index 57a015367bb..09611dc6480 100644 --- a/mysql-test/suite/rpl/r/rpl_not_null_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_not_null_myisam.result @@ -48,24 +48,24 @@ TABLES t1 and t2 must be equal otherwise an error will be thrown. Comparing tables master:test.t1 and slave:test.t1 Comparing tables master:test.t2 and slave:test.t2 TABLES t2 and t3 must be different. -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; a b 1 NULL 2 1111-11-11 3 NULL -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; a b c 1 NULL 500 2 1111-11-11 500 3 NULL 500 -SELECT * FROM t4; +SELECT * FROM t4 ORDER BY a; a b c 1 NULL 1 2 1111-11-11 2 3 NULL NULL 4 NULL 4 5 NULL NULL -SELECT * FROM t4; +SELECT * FROM t4 ORDER BY a; a b 1 NULL 2 1111-11-11 @@ -100,14 +100,14 @@ INSERT INTO t1(a,c) VALUES (4, b'01'); INSERT INTO t1(a) VALUES (5); ************* SHOWING THE RESULT SETS WITH INSERTS ************* TABLES t1 and t2 must be different. -SELECT a,b+0,c+0 FROM t1; +SELECT a,b+0,c+0 FROM t1 ORDER BY a; a b+0 c+0 1 NULL 1 2 0 1 3 NULL NULL 4 NULL 1 5 NULL NULL -SELECT a,b+0,c+0 FROM t1; +SELECT a,b+0,c+0 FROM t1 ORDER BY a; a b+0 c+0 1 NULL 1 2 0 1 @@ -163,34 +163,34 @@ REPLACE INTO t3(a, b) VALUES (5, null); REPLACE INTO t3(a, b) VALUES (3, null); UPDATE t3 SET b = NULL where a = 4; ************* SHOWING THE RESULT SETS ************* -SELECT * FROM t1; +SELECT * FROM t1 ORDER BY a; a b 1 NULL 2 NULL 3 1 -SELECT * FROM t1; +SELECT * FROM t1 ORDER BY a; a b c 1 0 0 2 0 0 3 1 0 -SELECT * FROM t2; +SELECT * FROM t2 ORDER BY a; a b 1 NULL 2 NULL 3 1 -SELECT * FROM t2; +SELECT * FROM t2 ORDER BY a; a b c 1 0 NULL 2 0 NULL 3 1 NULL -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; a b 1 NULL 2 NULL 3 NULL 4 NULL 5 NULL -SELECT * FROM t3; +SELECT * FROM t3 ORDER BY a; a b c 1 0 500 2 0 500 From 2108eea5624b2dcc1cfebc38e86b9585cf4893ff Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Wed, 30 Sep 2009 16:25:01 +0100 Subject: [PATCH 57/88] BUG#47741 rpl_ndb_extraCol fails in next-mr (mysql-5.1-rep+2) in RBR This is a temporary fix. NOTE: Backporting the patch to next-mr. --- .../extra/rpl_tests/rpl_extraSlave_Col.test | 75 ++++++++++--------- .../suite/rpl_ndb/r/rpl_ndb_extraCol.result | 56 -------------- 2 files changed, 39 insertions(+), 92 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test index 1eaefa661f9..46168d6b97a 100644 --- a/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test +++ b/mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test @@ -410,51 +410,54 @@ sync_slave_with_master; ############################################################### # Error reaction is up to sql_mode of the slave sql (bug#38173) #--echo *** Create t9 on slave *** -STOP SLAVE; -RESET SLAVE; -eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), - d TIMESTAMP, - e INT NOT NULL, - f text not null, - g text, - h blob not null, - i blob) ENGINE=$engine_type; +# Please, check BUG#47741 to see why you are not testing NDB. +if (`SELECT $engine_type != 'NDB'`) +{ + STOP SLAVE; + RESET SLAVE; + eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), + d TIMESTAMP, + e INT NOT NULL, + f text not null, + g text, + h blob not null, + i blob) ENGINE=$engine_type; ---echo *** Create t9 on Master *** -connection master; -eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) + --echo *** Create t9 on Master *** + connection master; + eval CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) ) ENGINE=$engine_type; -RESET MASTER; + RESET MASTER; ---echo *** Start Slave *** -connection slave; -START SLAVE; + --echo *** Start Slave *** + connection slave; + START SLAVE; ---echo *** Master Data Insert *** -connection master; -set @b1 = 'b1b1b1b1'; -set @b1 = concat(@b1,@b1); -INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); + --echo *** Master Data Insert *** + connection master; + set @b1 = 'b1b1b1b1'; -# the test would stop slave if @@sql_mode for the sql thread -# was set to strict. Otherwise, as with this tests setup, -# the implicit defaults will be inserted into fields even though -# they are declared without DEFAULT clause. + set @b1 = concat(@b1,@b1); + INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); -sync_slave_with_master; -select * from t9; + # the test would stop slave if @@sql_mode for the sql thread + # was set to strict. Otherwise, as with this tests setup, + # the implicit defaults will be inserted into fields even though + # they are declared without DEFAULT clause. -# todo: fix Bug #43992 slave sql thread can't tune own sql_mode ... -# and add/restore waiting for stop test - -#--source include/wait_for_slave_sql_to_stop.inc -#--replace_result $MASTER_MYPORT MASTER_PORT -#--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # -#--query_vertical SHOW SLAVE STATUS -#SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -#START SLAVE; + sync_slave_with_master; + select * from t9; + # todo: fix Bug #43992 slave sql thread can't tune own sql_mode ... + # and add/restore waiting for stop test + #--source include/wait_for_slave_sql_to_stop.inc + #--replace_result $MASTER_MYPORT MASTER_PORT + #--replace_column 1 # 4 # 7 # 8 # 9 # 16 # 22 # 23 # 33 # 35 # 36 # + #--query_vertical SHOW SLAVE STATUS + #SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; + #START SLAVE; +} #--echo *** Drop t9 *** #connection master; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result index f812509de6f..f514bf7a75b 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result @@ -400,62 +400,6 @@ set @b1 = concat(@b1,@b1); INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); *** Drop t8 *** DROP TABLE t8; -STOP SLAVE; -RESET SLAVE; -CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5), -d TIMESTAMP, -e INT NOT NULL) ENGINE='NDB'; -*** Create t9 on Master *** -CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5) -) ENGINE='NDB'; -RESET MASTER; -*** Start Slave *** -START SLAVE; -*** Master Data Insert *** -set @b1 = 'b1b1b1b1'; -set @b1 = concat(@b1,@b1); -INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA'); -SHOW SLAVE STATUS; -Slave_IO_State # -Master_Host 127.0.0.1 -Master_User root -Master_Port # -Connect_Retry 1 -Master_Log_File master-bin.000001 -Read_Master_Log_Pos # -Relay_Log_File # -Relay_Log_Pos # -Relay_Master_Log_File master-bin.000001 -Slave_IO_Running Yes -Slave_SQL_Running No -Replicate_Do_DB -Replicate_Ignore_DB -Replicate_Do_Table -Replicate_Ignore_Table # -Replicate_Wild_Do_Table -Replicate_Wild_Ignore_Table -Last_Errno 1364 -Last_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 447 -Skip_Counter 0 -Exec_Master_Log_Pos # -Relay_Log_Space # -Until_Condition None -Until_Log_File -Until_Log_Pos 0 -Master_SSL_Allowed No -Master_SSL_CA_File -Master_SSL_CA_Path -Master_SSL_Cert -Master_SSL_Cipher -Master_SSL_Key -Seconds_Behind_Master # -Master_SSL_Verify_Server_Cert No -Last_IO_Errno # -Last_IO_Error # -Last_SQL_Errno 1364 -Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 447 -SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; -START SLAVE; *** Create t10 on slave *** STOP SLAVE; RESET SLAVE; From 9581d6280e4261c6246f53d44a7357a96e98c19e Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 30 Sep 2009 17:42:25 +0100 Subject: [PATCH 58/88] BUG#47749: rpl_slave_skip fails sporadically on PB2 (mysql-5.1-rep+2 tree). rpl_slave_skip fails randomly on PB2. This patch fixes the failure by setting explicit wait for SQL thread to stop, instead of the wait_for_slave_to_stop mysqltest command, after a start until command is executed. --- mysql-test/suite/rpl/t/rpl_slave_skip.test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test index f4cb0f69e93..6336e775af1 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_skip.test +++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test @@ -27,7 +27,7 @@ connection slave; # Stop when reaching the the first table map event. START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=762; -wait_for_slave_to_stop; +-- source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT --replace_column 1 # 8 # 9 # 23 # 33 # 35 # 36 # query_vertical SHOW SLAVE STATUS; @@ -59,7 +59,7 @@ source include/show_binlog_events.inc; connection slave; START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=106; -wait_for_slave_to_stop; +-- source include/wait_for_slave_sql_to_stop.inc SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; sync_with_master; From 9682ff8a26cef6dc2252b6a520f841dcfa62ee20 Mon Sep 17 00:00:00 2001 From: Alfranio Correia Date: Wed, 30 Sep 2009 22:41:05 +0100 Subject: [PATCH 59/88] BUG#43075 rpl.rpl_sync fails sporadically on pushbuild NOTE: Backporting the patch to next-mr. The slave was crashing while failing to execute the init_slave() function. The issue stems from two different reasons: 1 - A failure while allocating the master info structure generated a segfault due to a NULL pointer. 2 - A failure while recovering generated a segfault due to a non-initialized relay log file. In other words, the mi->init and rli->init were both set to true before executing the recovery process thus creating an inconsistent state as the relay log file was not initialized. To circumvent such problems, we refactored the recovery process which is now executed while initializing the relay log. It is ensured that the master info structure is created before accessing it and any error is propagated thus avoiding to set mi->init and rli->init to true when for instance the relay log is not initialized or the relay info is not flushed. The changes related to the refactory are described below: 1 - Removed call to init_recovery from init_slave. 2 - Changed the signature of the function init_recovery. 3 - Removed flushes. They are called while initializing the relay log and master info. 4 - Made sure that if the relay info is not flushed the mi-init and rli-init are not set to true. In this patch, we also replaced the exit(1) in the fault injection by DBUG_ABORT() to make it compliant with the code guidelines. --- sql/rpl_mi.cc | 1 + sql/rpl_rli.cc | 12 ++++++++---- sql/slave.cc | 31 ++----------------------------- sql/slave.h | 1 + 4 files changed, 12 insertions(+), 33 deletions(-) diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index cec2eabdd20..fe005bdb2a3 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -310,6 +310,7 @@ file '%s')", fname); goto err; mi->inited = 1; + mi->rli.is_relay_log_recovery= FALSE; // now change cache READ -> WRITE - must do this before flush_master_info reinit_io_cache(&mi->file, WRITE_CACHE, 0L, 0, 1); if ((error=test(flush_master_info(mi, 1)))) diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index 3a12164a1cf..b3a1bbc31d2 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -259,8 +259,10 @@ Failed to open the existing relay log info file '%s' (errno %d)", rli->group_relay_log_pos= rli->event_relay_log_pos= relay_log_pos; rli->group_master_log_pos= master_log_pos; - if (!rli->is_relay_log_recovery && - init_relay_log_pos(rli, + if (rli->is_relay_log_recovery && init_recovery(rli->mi, &msg)) + goto err; + + if (init_relay_log_pos(rli, rli->group_relay_log_name, rli->group_relay_log_pos, 0 /* no data lock*/, @@ -275,7 +277,6 @@ Failed to open the existing relay log info file '%s' (errno %d)", } #ifndef DBUG_OFF - if (!rli->is_relay_log_recovery) { char llbuf1[22], llbuf2[22]; DBUG_PRINT("info", ("my_b_tell(rli->cur_log)=%s rli->event_relay_log_pos=%s", @@ -292,7 +293,10 @@ Failed to open the existing relay log info file '%s' (errno %d)", */ reinit_io_cache(&rli->info_file, WRITE_CACHE,0L,0,1); if ((error= flush_relay_log_info(rli))) - sql_print_error("Failed to flush relay log info file"); + { + msg= "Failed to flush relay log info file"; + goto err; + } if (count_relay_log_space(rli)) { msg="Error counting relay log space"; diff --git a/sql/slave.cc b/sql/slave.cc index 5edb47df8b5..a1097d67052 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -129,7 +129,6 @@ static bool wait_for_relay_log_space(Relay_log_info* rli); static inline bool io_slave_killed(THD* thd,Master_info* mi); static inline bool sql_slave_killed(THD* thd,Relay_log_info* rli); static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type); -static int init_recovery(Master_info* mi); static void print_slave_skip_errors(void); static int safe_connect(THD* thd, MYSQL* mysql, Master_info* mi); static int safe_reconnect(THD* thd, MYSQL* mysql, Master_info* mi, @@ -264,12 +263,6 @@ int init_slave() goto err; } - if (active_mi->rli.is_relay_log_recovery && init_recovery(active_mi)) - { - error= 1; - goto err; - } - if (server_id && !master_host && active_mi->host[0]) master_host= active_mi->host; @@ -291,7 +284,6 @@ int init_slave() } err: - active_mi->rli.is_relay_log_recovery= FALSE; pthread_mutex_unlock(&LOCK_active_mi); DBUG_RETURN(error); } @@ -323,9 +315,8 @@ err: If there is an error, it returns (1), otherwise returns (0). */ -static int init_recovery(Master_info* mi) +int init_recovery(Master_info* mi, const char** errmsg) { - const char *errmsg= 0; DBUG_ENTER("init_recovery"); Relay_log_info *rli= &mi->rli; @@ -345,26 +336,8 @@ static int init_recovery(Master_info* mi) sizeof(mi->rli.event_relay_log_name)-1); rli->group_relay_log_pos= rli->event_relay_log_pos= BIN_LOG_HEADER_SIZE; - - if (init_relay_log_pos(rli, - rli->group_relay_log_name, - rli->group_relay_log_pos, - 0 /*no data lock*/, - &errmsg, 0)) - DBUG_RETURN(1); - - if (flush_master_info(mi, 0)) - { - sql_print_error("Failed to flush master info file"); - DBUG_RETURN(1); - } - if (flush_relay_log_info(rli)) - { - sql_print_error("Failed to flush relay info file"); - DBUG_RETURN(1); - } } - + DBUG_RETURN(0); } diff --git a/sql/slave.h b/sql/slave.h index a44a7eed83e..86b28931f21 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -134,6 +134,7 @@ extern ulonglong relay_log_space_limit; #define SLAVE_FORCE_ALL 4 int init_slave(); +int init_recovery(Master_info* mi, const char** errmsg); void init_slave_skip_errors(const char* arg); bool flush_relay_log_info(Relay_log_info* rli); int register_slave_on_master(MYSQL* mysql); From 266d53b5d24a18ef1e8b696feee6fc8953bbec44 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Thu, 1 Oct 2009 00:32:15 +0100 Subject: [PATCH 60/88] Partial backport for BUG#41399, more precisely, the changes to wait_until_disconnected.inc. --- mysql-test/include/wait_until_disconnected.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc index a4362e52d01..8a989becc18 100644 --- a/mysql-test/include/wait_until_disconnected.inc +++ b/mysql-test/include/wait_until_disconnected.inc @@ -7,7 +7,7 @@ let $counter= 500; let $mysql_errno= 0; while (!$mysql_errno) { - --error 0,1053,2002,2006,2013 + --error 0,1040,1053,2002,2003,2006,2013 show status; dec $counter; From f68119a74541479ec38164be788dbc7ace664564 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Thu, 1 Oct 2009 19:44:53 +0300 Subject: [PATCH 61/88] backporting bug@27808 fixes --- mysql-test/include/master-slave.inc | 2 + mysql-test/r/ctype_cp932_binlog_stm.result | 14 +- .../r/flush_block_commit_notembedded.result | 4 +- mysql-test/r/multi_update.result | 4 +- mysql-test/r/outfile_loaddata.result | 20 +- mysql-test/r/strict.result | 2 +- .../suite/binlog/r/binlog_row_binlog.result | 37 +- .../suite/binlog/r/binlog_stm_binlog.result | 844 +++++++++--------- .../suite/binlog/t/binlog_incident.test | 4 +- mysql-test/suite/rpl/r/rpl_000015.result | 6 + mysql-test/suite/rpl/r/rpl_bug33931.result | 2 + .../suite/rpl/r/rpl_change_master.result | 4 + .../suite/rpl/r/rpl_deadlock_innodb.result | 6 + .../suite/rpl/r/rpl_extraCol_innodb.result | 20 + .../suite/rpl/r/rpl_extraCol_myisam.result | 20 + .../rpl/r/rpl_extraColmaster_innodb.result | 42 + .../rpl/r/rpl_extraColmaster_myisam.result | 42 + .../suite/rpl/r/rpl_flushlog_loop.result | 2 + mysql-test/suite/rpl/r/rpl_grant.result | 2 + mysql-test/suite/rpl/r/rpl_heartbeat.result | 4 + mysql-test/suite/rpl/r/rpl_incident.result | 4 + .../rpl/r/rpl_known_bugs_detection.result | 4 + mysql-test/suite/rpl/r/rpl_loaddata.result | 6 + .../suite/rpl/r/rpl_loaddata_fatal.result | 4 + mysql-test/suite/rpl/r/rpl_log_pos.result | 4 + mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result | 2 + .../suite/rpl/r/rpl_replicate_do.result | 2 + mysql-test/suite/rpl/r/rpl_rotate_logs.result | 6 + mysql-test/suite/rpl/r/rpl_row_colSize.result | 26 + mysql-test/suite/rpl/r/rpl_row_log.result | 2 + .../suite/rpl/r/rpl_row_log_innodb.result | 2 + .../suite/rpl/r/rpl_row_max_relay_size.result | 12 + .../suite/rpl/r/rpl_row_reset_slave.result | 8 + .../rpl/r/rpl_row_tabledefs_2myisam.result | 12 + .../rpl/r/rpl_row_tabledefs_3innodb.result | 12 + mysql-test/suite/rpl/r/rpl_row_until.result | 8 + mysql-test/suite/rpl/r/rpl_skip_error.result | 4 + .../r/rpl_slave_load_remove_tmpfile.result | 2 + mysql-test/suite/rpl/r/rpl_slave_skip.result | 4 + mysql-test/suite/rpl/r/rpl_ssl.result | 4 + mysql-test/suite/rpl/r/rpl_ssl1.result | 6 + mysql-test/suite/rpl/r/rpl_stm_log.result | 2 + .../suite/rpl/r/rpl_stm_max_relay_size.result | 12 + .../suite/rpl/r/rpl_stm_reset_slave.result | 8 + mysql-test/suite/rpl/r/rpl_stm_until.result | 8 + .../suite/rpl/r/rpl_temporary_errors.result | 2 + .../suite/rpl_ndb/r/rpl_ndb_basic.result | 2 + .../suite/rpl_ndb/r/rpl_ndb_circular.result | 4 + .../rpl_ndb/r/rpl_ndb_circular_simplex.result | 4 + .../suite/rpl_ndb/r/rpl_ndb_extraCol.result | 20 + .../suite/rpl_ndb/r/rpl_ndb_idempotent.result | 12 +- .../suite/rpl_ndb/r/rpl_ndb_sync.result | 2 + mysql-test/t/ctype_cp932_binlog_stm.test | 2 +- mysql-test/t/mysqlbinlog.test | 2 +- sql/lex.h | 1 + sql/rpl_mi.cc | 88 +- sql/rpl_mi.h | 9 +- sql/share/errmsg.txt | 3 + sql/slave.cc | 160 +++- sql/sql_lex.h | 3 +- sql/sql_repl.cc | 58 +- sql/sql_yacc.yy | 23 + 62 files changed, 1127 insertions(+), 513 deletions(-) diff --git a/mysql-test/include/master-slave.inc b/mysql-test/include/master-slave.inc index e0eb87f02f7..25e0150dd0a 100644 --- a/mysql-test/include/master-slave.inc +++ b/mysql-test/include/master-slave.inc @@ -8,5 +8,7 @@ connect (slave1,127.0.0.1,root,,test,$SLAVE_MYPORT,); -- source include/master-slave-reset.inc +connection master; +sync_slave_with_master; # Set the default connection to 'master' connection master; diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result index 044885d1ea7..bb971e5453b 100644 --- a/mysql-test/r/ctype_cp932_binlog_stm.result +++ b/mysql-test/r/ctype_cp932_binlog_stm.result @@ -29,22 +29,22 @@ HEX(s1) HEX(s2) d 466F6F2773206120426172 ED40ED41ED42 47.93 DROP PROCEDURE bug18293| DROP TABLE t4| -SHOW BINLOG EVENTS FROM 370| +SHOW BINLOG EVENTS FROM 371| Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 370 Query 1 536 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1, +master-bin.000001 371 Query 1 537 use `test`; CREATE TABLE t4 (s1 CHAR(50) CHARACTER SET latin1, s2 CHAR(50) CHARACTER SET cp932, d DECIMAL(10,2)) -master-bin.000001 536 Query 1 785 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50), +master-bin.000001 537 Query 1 786 use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `bug18293`(IN ins1 CHAR(50), IN ins2 CHAR(50) CHARACTER SET cp932, IN ind DECIMAL(10,2)) BEGIN INSERT INTO t4 VALUES (ins1, ins2, ind); END -master-bin.000001 785 Query 1 1049 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93)) -master-bin.000001 1049 Query 1 1138 use `test`; DROP PROCEDURE bug18293 -master-bin.000001 1138 Query 1 1217 use `test`; DROP TABLE t4 +master-bin.000001 786 Query 1 1050 use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93)) +master-bin.000001 1050 Query 1 1139 use `test`; DROP PROCEDURE bug18293 +master-bin.000001 1139 Query 1 1218 use `test`; DROP TABLE t4 End of 5.0 tests -SHOW BINLOG EVENTS FROM 365; +SHOW BINLOG EVENTS FROM 366; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment. CREATE TABLE t1 (a varchar(16)) character set cp932; diff --git a/mysql-test/r/flush_block_commit_notembedded.result b/mysql-test/r/flush_block_commit_notembedded.result index c7fd7a11877..4348dbd67e5 100644 --- a/mysql-test/r/flush_block_commit_notembedded.result +++ b/mysql-test/r/flush_block_commit_notembedded.result @@ -9,13 +9,13 @@ INSERT t1 VALUES (1); FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 106 +master-bin.000001 107 # Switch to connection con1 COMMIT; # Switch to connection con2 SHOW MASTER STATUS; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 106 +master-bin.000001 107 UNLOCK TABLES; # Switch to connection con1 DROP TABLE t1; diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 449333a4ae6..4f22029814c 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -604,7 +604,7 @@ a b 4 4 show master status /* there must be the UPDATE query event */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 206 +master-bin.000001 207 delete from t1; delete from t2; insert into t1 values (1,2),(3,4),(4,4); @@ -614,7 +614,7 @@ UPDATE t2,t1 SET t2.a=t2.b where t2.a=t1.a; ERROR 23000: Duplicate entry '4' for key 'PRIMARY' show master status /* there must be the UPDATE query event */; File Position Binlog_Do_DB Binlog_Ignore_DB -master-bin.000001 221 +master-bin.000001 222 drop table t1, t2; set @@session.binlog_format= @sav_binlog_format; drop table if exists t1, t2, t3; diff --git a/mysql-test/r/outfile_loaddata.result b/mysql-test/r/outfile_loaddata.result index 453e3adb54c..66ff28298ba 100644 --- a/mysql-test/r/outfile_loaddata.result +++ b/mysql-test/r/outfile_loaddata.result @@ -92,14 +92,14 @@ HEX(c1) C3 SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' FIELDS ENCLOSED BY 0xC3 FROM t1; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported TRUNCATE t1; SELECT HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt')); HEX(LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug32533.txt')) C35CC3C30A LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug32533.txt' INTO TABLE t1 FIELDS ENCLOSED BY 0xC3; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported SELECT HEX(c1) FROM t1; HEX(c1) C3 @@ -124,17 +124,17 @@ ERROR 42000: Field separator argument is not what is expected; check the manual # LOAD DATA rises error or has unpredictable result -- to be fixed later SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ENCLOSED BY 'ÑŠ'; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ÑŠ'; ERROR 42000: Field separator argument is not what is expected; check the manual SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS ESCAPED BY 'ÑŠ'; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ÑŠ'; ERROR 42000: Field separator argument is not what is expected; check the manual SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' FIELDS TERMINATED BY 'ÑŠ'; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported ################################################## 1ÑŠABC-áâ÷ÑŠDEF-ÂÃÄ 2ÑŠ\NÑŠ\N @@ -142,7 +142,7 @@ Warning 1638 Non-ASCII separator arguments are not fully supported TRUNCATE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary FIELDS TERMINATED BY 'ÑŠ'; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported Warning 1265 Data truncated for column 'a' at row 1 Warning 1261 Row 1 doesn't contain data for all columns Warning 1261 Row 1 doesn't contain data for all columns @@ -156,7 +156,7 @@ a b c 2 NULL NULL SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES STARTING BY 'ÑŠ'; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported ################################################## ÑŠ1 ABC-áâ÷ DEF-ÂÃÄ ÑŠ2 \N \N @@ -164,20 +164,20 @@ Warning 1638 Non-ASCII separator arguments are not fully supported TRUNCATE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary LINES STARTING BY 'ÑŠ'; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; a b c 1 ABC-ÐБВ DEF-ÂÃÄ 2 NULL NULL SELECT * FROM t1 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' LINES TERMINATED BY 'ÑŠ'; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported ################################################## 1 ABC-áâ÷ DEF-ÂÃÄÑŠ2 \N \NÑŠ################################################## TRUNCATE t2; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' INTO TABLE t2 CHARACTER SET binary LINES TERMINATED BY 'ÑŠ'; Warnings: -Warning 1638 Non-ASCII separator arguments are not fully supported +Warning 1639 Non-ASCII separator arguments are not fully supported SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; a b c 1 ABC-ÐБВ DEF-ÂÃÄ diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 241f4198bf7..b11f60792ef 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1327,7 +1327,7 @@ create table t1 123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*'); Warnings: -Warning 1629 Comment for field 'i' is too long (max = 255) +Warning 1630 Comment for field 'i' is too long (max = 255) select column_name, column_comment from information_schema.columns where table_schema = 'test' and table_name = 't1'; column_name column_comment diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index d2d702b12a0..d6d6c99f00a 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -247,25 +247,8 @@ commit; drop table t1; show binlog events from 0; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 -master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb -master-bin.000001 205 Query 1 273 BEGIN -master-bin.000001 273 Table_map 1 314 table_id: # (test.t1) -master-bin.000001 314 Write_rows 1 348 table_id: # flags: STMT_END_F -master-bin.000001 348 Table_map 1 389 table_id: # (test.t1) -master-bin.000001 389 Write_rows 1 423 table_id: # flags: STMT_END_F -master-bin.000001 423 Table_map 1 464 table_id: # (test.t1) -master-bin.000001 464 Write_rows 1 498 table_id: # flags: STMT_END_F -master-bin.000001 498 Xid 1 525 COMMIT /* XID */ -master-bin.000001 525 Query 1 601 use `test`; drop table t1 -set @bcs = @@binlog_cache_size; -set global binlog_cache_size=4096; -reset master; -create table t1 (a int) engine=innodb; -show binlog events from 0; -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 -master-bin.000001 106 Query 1 206 use `test`; create table t1 (a int) engine=innodb +master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4 +master-bin.000001 107 Query 1 206 use `test`; create table t1(n int) engine=innodb master-bin.000001 206 Query 1 274 BEGIN master-bin.000001 274 Table_map 1 315 table_id: # (test.t1) master-bin.000001 315 Write_rows 1 349 table_id: # flags: STMT_END_F @@ -283,7 +266,7 @@ show binlog events from 0; Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4 master-bin.000001 107 Query 1 207 use `test`; create table t1 (a int) engine=innodb -master-bin.000001 207 Query 1 275 use `test`; BEGIN +master-bin.000001 207 Query 1 275 BEGIN master-bin.000001 275 Table_map 1 316 table_id: # (test.t1) master-bin.000001 316 Write_rows 1 350 table_id: # flags: STMT_END_F master-bin.000001 350 Table_map 1 391 table_id: # (test.t1) @@ -1100,13 +1083,13 @@ deallocate prepare stmt; drop table t1; show binlog events from 0; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 -master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned) -master-bin.000001 227 Query 1 295 BEGIN -master-bin.000001 295 Table_map 1 337 table_id: # (test.t1) -master-bin.000001 337 Write_rows 1 383 table_id: # flags: STMT_END_F -master-bin.000001 383 Query 1 452 COMMIT -master-bin.000001 452 Query 1 528 use `test`; drop table t1 +master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4 +master-bin.000001 107 Query 1 228 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned) +master-bin.000001 228 Query 1 296 BEGIN +master-bin.000001 296 Table_map 1 338 table_id: # (test.t1) +master-bin.000001 338 Write_rows 1 384 table_id: # flags: STMT_END_F +master-bin.000001 384 Query 1 453 COMMIT +master-bin.000001 453 Query 1 529 use `test`; drop table t1 reset master; CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; USE bug39182; diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index 9df4164b138..c0a87be191b 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -4,11 +4,11 @@ insert into t1 values (1,2); commit; show binlog events; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server ver: #, Binlog ver: # -master-bin.000001 106 Query 1 213 use `test`; create table t1 (a int, b int) engine=innodb -master-bin.000001 213 Query 1 281 BEGIN -master-bin.000001 281 Query 1 371 use `test`; insert into t1 values (1,2) -master-bin.000001 371 Xid 1 398 COMMIT /* XID */ +master-bin.000001 4 Format_desc 1 107 Server ver: #, Binlog ver: # +master-bin.000001 107 Query 1 214 use `test`; create table t1 (a int, b int) engine=innodb +master-bin.000001 214 Query 1 282 BEGIN +master-bin.000001 282 Query 1 372 use `test`; insert into t1 values (1,2) +master-bin.000001 372 Xid 1 399 COMMIT /* XID */ drop table t1; drop table if exists t1, t2; reset master; @@ -157,425 +157,425 @@ commit; drop table t1; show binlog events from 0; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 -master-bin.000001 106 Query 1 205 use `test`; create table t1(n int) engine=innodb -master-bin.000001 205 Query 1 273 BEGIN -master-bin.000001 273 Query 1 361 use `test`; insert into t1 values (1) -master-bin.000001 361 Query 1 449 use `test`; insert into t1 values (2) -master-bin.000001 449 Query 1 537 use `test`; insert into t1 values (3) -master-bin.000001 537 Xid 1 564 COMMIT /* XID */ -master-bin.000001 564 Query 1 640 use `test`; drop table t1 +master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4 +master-bin.000001 107 Query 1 206 use `test`; create table t1(n int) engine=innodb +master-bin.000001 206 Query 1 274 BEGIN +master-bin.000001 274 Query 1 362 use `test`; insert into t1 values (1) +master-bin.000001 362 Query 1 450 use `test`; insert into t1 values (2) +master-bin.000001 450 Query 1 538 use `test`; insert into t1 values (3) +master-bin.000001 538 Xid 1 565 COMMIT /* XID */ +master-bin.000001 565 Query 1 641 use `test`; drop table t1 set @bcs = @@binlog_cache_size; set global binlog_cache_size=4096; reset master; create table t1 (a int) engine=innodb; show binlog events from 0; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 -master-bin.000001 106 Query 1 206 use `test`; create table t1 (a int) engine=innodb -master-bin.000001 206 Query 1 274 BEGIN -master-bin.000001 274 Query 1 365 use `test`; insert into t1 values( 400 ) -master-bin.000001 365 Query 1 456 use `test`; insert into t1 values( 399 ) -master-bin.000001 456 Query 1 547 use `test`; insert into t1 values( 398 ) -master-bin.000001 547 Query 1 638 use `test`; insert into t1 values( 397 ) -master-bin.000001 638 Query 1 729 use `test`; insert into t1 values( 396 ) -master-bin.000001 729 Query 1 820 use `test`; insert into t1 values( 395 ) -master-bin.000001 820 Query 1 911 use `test`; insert into t1 values( 394 ) -master-bin.000001 911 Query 1 1002 use `test`; insert into t1 values( 393 ) -master-bin.000001 1002 Query 1 1093 use `test`; insert into t1 values( 392 ) -master-bin.000001 1093 Query 1 1184 use `test`; insert into t1 values( 391 ) -master-bin.000001 1184 Query 1 1275 use `test`; insert into t1 values( 390 ) -master-bin.000001 1275 Query 1 1366 use `test`; insert into t1 values( 389 ) -master-bin.000001 1366 Query 1 1457 use `test`; insert into t1 values( 388 ) -master-bin.000001 1457 Query 1 1548 use `test`; insert into t1 values( 387 ) -master-bin.000001 1548 Query 1 1639 use `test`; insert into t1 values( 386 ) -master-bin.000001 1639 Query 1 1730 use `test`; insert into t1 values( 385 ) -master-bin.000001 1730 Query 1 1821 use `test`; insert into t1 values( 384 ) -master-bin.000001 1821 Query 1 1912 use `test`; insert into t1 values( 383 ) -master-bin.000001 1912 Query 1 2003 use `test`; insert into t1 values( 382 ) -master-bin.000001 2003 Query 1 2094 use `test`; insert into t1 values( 381 ) -master-bin.000001 2094 Query 1 2185 use `test`; insert into t1 values( 380 ) -master-bin.000001 2185 Query 1 2276 use `test`; insert into t1 values( 379 ) -master-bin.000001 2276 Query 1 2367 use `test`; insert into t1 values( 378 ) -master-bin.000001 2367 Query 1 2458 use `test`; insert into t1 values( 377 ) -master-bin.000001 2458 Query 1 2549 use `test`; insert into t1 values( 376 ) -master-bin.000001 2549 Query 1 2640 use `test`; insert into t1 values( 375 ) -master-bin.000001 2640 Query 1 2731 use `test`; insert into t1 values( 374 ) -master-bin.000001 2731 Query 1 2822 use `test`; insert into t1 values( 373 ) -master-bin.000001 2822 Query 1 2913 use `test`; insert into t1 values( 372 ) -master-bin.000001 2913 Query 1 3004 use `test`; insert into t1 values( 371 ) -master-bin.000001 3004 Query 1 3095 use `test`; insert into t1 values( 370 ) -master-bin.000001 3095 Query 1 3186 use `test`; insert into t1 values( 369 ) -master-bin.000001 3186 Query 1 3277 use `test`; insert into t1 values( 368 ) -master-bin.000001 3277 Query 1 3368 use `test`; insert into t1 values( 367 ) -master-bin.000001 3368 Query 1 3459 use `test`; insert into t1 values( 366 ) -master-bin.000001 3459 Query 1 3550 use `test`; insert into t1 values( 365 ) -master-bin.000001 3550 Query 1 3641 use `test`; insert into t1 values( 364 ) -master-bin.000001 3641 Query 1 3732 use `test`; insert into t1 values( 363 ) -master-bin.000001 3732 Query 1 3823 use `test`; insert into t1 values( 362 ) -master-bin.000001 3823 Query 1 3914 use `test`; insert into t1 values( 361 ) -master-bin.000001 3914 Query 1 4005 use `test`; insert into t1 values( 360 ) -master-bin.000001 4005 Query 1 4096 use `test`; insert into t1 values( 359 ) -master-bin.000001 4096 Query 1 4187 use `test`; insert into t1 values( 358 ) -master-bin.000001 4187 Query 1 4278 use `test`; insert into t1 values( 357 ) -master-bin.000001 4278 Query 1 4369 use `test`; insert into t1 values( 356 ) -master-bin.000001 4369 Query 1 4460 use `test`; insert into t1 values( 355 ) -master-bin.000001 4460 Query 1 4551 use `test`; insert into t1 values( 354 ) -master-bin.000001 4551 Query 1 4642 use `test`; insert into t1 values( 353 ) -master-bin.000001 4642 Query 1 4733 use `test`; insert into t1 values( 352 ) -master-bin.000001 4733 Query 1 4824 use `test`; insert into t1 values( 351 ) -master-bin.000001 4824 Query 1 4915 use `test`; insert into t1 values( 350 ) -master-bin.000001 4915 Query 1 5006 use `test`; insert into t1 values( 349 ) -master-bin.000001 5006 Query 1 5097 use `test`; insert into t1 values( 348 ) -master-bin.000001 5097 Query 1 5188 use `test`; insert into t1 values( 347 ) -master-bin.000001 5188 Query 1 5279 use `test`; insert into t1 values( 346 ) -master-bin.000001 5279 Query 1 5370 use `test`; insert into t1 values( 345 ) -master-bin.000001 5370 Query 1 5461 use `test`; insert into t1 values( 344 ) -master-bin.000001 5461 Query 1 5552 use `test`; insert into t1 values( 343 ) -master-bin.000001 5552 Query 1 5643 use `test`; insert into t1 values( 342 ) -master-bin.000001 5643 Query 1 5734 use `test`; insert into t1 values( 341 ) -master-bin.000001 5734 Query 1 5825 use `test`; insert into t1 values( 340 ) -master-bin.000001 5825 Query 1 5916 use `test`; insert into t1 values( 339 ) -master-bin.000001 5916 Query 1 6007 use `test`; insert into t1 values( 338 ) -master-bin.000001 6007 Query 1 6098 use `test`; insert into t1 values( 337 ) -master-bin.000001 6098 Query 1 6189 use `test`; insert into t1 values( 336 ) -master-bin.000001 6189 Query 1 6280 use `test`; insert into t1 values( 335 ) -master-bin.000001 6280 Query 1 6371 use `test`; insert into t1 values( 334 ) -master-bin.000001 6371 Query 1 6462 use `test`; insert into t1 values( 333 ) -master-bin.000001 6462 Query 1 6553 use `test`; insert into t1 values( 332 ) -master-bin.000001 6553 Query 1 6644 use `test`; insert into t1 values( 331 ) -master-bin.000001 6644 Query 1 6735 use `test`; insert into t1 values( 330 ) -master-bin.000001 6735 Query 1 6826 use `test`; insert into t1 values( 329 ) -master-bin.000001 6826 Query 1 6917 use `test`; insert into t1 values( 328 ) -master-bin.000001 6917 Query 1 7008 use `test`; insert into t1 values( 327 ) -master-bin.000001 7008 Query 1 7099 use `test`; insert into t1 values( 326 ) -master-bin.000001 7099 Query 1 7190 use `test`; insert into t1 values( 325 ) -master-bin.000001 7190 Query 1 7281 use `test`; insert into t1 values( 324 ) -master-bin.000001 7281 Query 1 7372 use `test`; insert into t1 values( 323 ) -master-bin.000001 7372 Query 1 7463 use `test`; insert into t1 values( 322 ) -master-bin.000001 7463 Query 1 7554 use `test`; insert into t1 values( 321 ) -master-bin.000001 7554 Query 1 7645 use `test`; insert into t1 values( 320 ) -master-bin.000001 7645 Query 1 7736 use `test`; insert into t1 values( 319 ) -master-bin.000001 7736 Query 1 7827 use `test`; insert into t1 values( 318 ) -master-bin.000001 7827 Query 1 7918 use `test`; insert into t1 values( 317 ) -master-bin.000001 7918 Query 1 8009 use `test`; insert into t1 values( 316 ) -master-bin.000001 8009 Query 1 8100 use `test`; insert into t1 values( 315 ) -master-bin.000001 8100 Query 1 8191 use `test`; insert into t1 values( 314 ) -master-bin.000001 8191 Query 1 8282 use `test`; insert into t1 values( 313 ) -master-bin.000001 8282 Query 1 8373 use `test`; insert into t1 values( 312 ) -master-bin.000001 8373 Query 1 8464 use `test`; insert into t1 values( 311 ) -master-bin.000001 8464 Query 1 8555 use `test`; insert into t1 values( 310 ) -master-bin.000001 8555 Query 1 8646 use `test`; insert into t1 values( 309 ) -master-bin.000001 8646 Query 1 8737 use `test`; insert into t1 values( 308 ) -master-bin.000001 8737 Query 1 8828 use `test`; insert into t1 values( 307 ) -master-bin.000001 8828 Query 1 8919 use `test`; insert into t1 values( 306 ) -master-bin.000001 8919 Query 1 9010 use `test`; insert into t1 values( 305 ) -master-bin.000001 9010 Query 1 9101 use `test`; insert into t1 values( 304 ) -master-bin.000001 9101 Query 1 9192 use `test`; insert into t1 values( 303 ) -master-bin.000001 9192 Query 1 9283 use `test`; insert into t1 values( 302 ) -master-bin.000001 9283 Query 1 9374 use `test`; insert into t1 values( 301 ) -master-bin.000001 9374 Query 1 9465 use `test`; insert into t1 values( 300 ) -master-bin.000001 9465 Query 1 9556 use `test`; insert into t1 values( 299 ) -master-bin.000001 9556 Query 1 9647 use `test`; insert into t1 values( 298 ) -master-bin.000001 9647 Query 1 9738 use `test`; insert into t1 values( 297 ) -master-bin.000001 9738 Query 1 9829 use `test`; insert into t1 values( 296 ) -master-bin.000001 9829 Query 1 9920 use `test`; insert into t1 values( 295 ) -master-bin.000001 9920 Query 1 10011 use `test`; insert into t1 values( 294 ) -master-bin.000001 10011 Query 1 10102 use `test`; insert into t1 values( 293 ) -master-bin.000001 10102 Query 1 10193 use `test`; insert into t1 values( 292 ) -master-bin.000001 10193 Query 1 10284 use `test`; insert into t1 values( 291 ) -master-bin.000001 10284 Query 1 10375 use `test`; insert into t1 values( 290 ) -master-bin.000001 10375 Query 1 10466 use `test`; insert into t1 values( 289 ) -master-bin.000001 10466 Query 1 10557 use `test`; insert into t1 values( 288 ) -master-bin.000001 10557 Query 1 10648 use `test`; insert into t1 values( 287 ) -master-bin.000001 10648 Query 1 10739 use `test`; insert into t1 values( 286 ) -master-bin.000001 10739 Query 1 10830 use `test`; insert into t1 values( 285 ) -master-bin.000001 10830 Query 1 10921 use `test`; insert into t1 values( 284 ) -master-bin.000001 10921 Query 1 11012 use `test`; insert into t1 values( 283 ) -master-bin.000001 11012 Query 1 11103 use `test`; insert into t1 values( 282 ) -master-bin.000001 11103 Query 1 11194 use `test`; insert into t1 values( 281 ) -master-bin.000001 11194 Query 1 11285 use `test`; insert into t1 values( 280 ) -master-bin.000001 11285 Query 1 11376 use `test`; insert into t1 values( 279 ) -master-bin.000001 11376 Query 1 11467 use `test`; insert into t1 values( 278 ) -master-bin.000001 11467 Query 1 11558 use `test`; insert into t1 values( 277 ) -master-bin.000001 11558 Query 1 11649 use `test`; insert into t1 values( 276 ) -master-bin.000001 11649 Query 1 11740 use `test`; insert into t1 values( 275 ) -master-bin.000001 11740 Query 1 11831 use `test`; insert into t1 values( 274 ) -master-bin.000001 11831 Query 1 11922 use `test`; insert into t1 values( 273 ) -master-bin.000001 11922 Query 1 12013 use `test`; insert into t1 values( 272 ) -master-bin.000001 12013 Query 1 12104 use `test`; insert into t1 values( 271 ) -master-bin.000001 12104 Query 1 12195 use `test`; insert into t1 values( 270 ) -master-bin.000001 12195 Query 1 12286 use `test`; insert into t1 values( 269 ) -master-bin.000001 12286 Query 1 12377 use `test`; insert into t1 values( 268 ) -master-bin.000001 12377 Query 1 12468 use `test`; insert into t1 values( 267 ) -master-bin.000001 12468 Query 1 12559 use `test`; insert into t1 values( 266 ) -master-bin.000001 12559 Query 1 12650 use `test`; insert into t1 values( 265 ) -master-bin.000001 12650 Query 1 12741 use `test`; insert into t1 values( 264 ) -master-bin.000001 12741 Query 1 12832 use `test`; insert into t1 values( 263 ) -master-bin.000001 12832 Query 1 12923 use `test`; insert into t1 values( 262 ) -master-bin.000001 12923 Query 1 13014 use `test`; insert into t1 values( 261 ) -master-bin.000001 13014 Query 1 13105 use `test`; insert into t1 values( 260 ) -master-bin.000001 13105 Query 1 13196 use `test`; insert into t1 values( 259 ) -master-bin.000001 13196 Query 1 13287 use `test`; insert into t1 values( 258 ) -master-bin.000001 13287 Query 1 13378 use `test`; insert into t1 values( 257 ) -master-bin.000001 13378 Query 1 13469 use `test`; insert into t1 values( 256 ) -master-bin.000001 13469 Query 1 13560 use `test`; insert into t1 values( 255 ) -master-bin.000001 13560 Query 1 13651 use `test`; insert into t1 values( 254 ) -master-bin.000001 13651 Query 1 13742 use `test`; insert into t1 values( 253 ) -master-bin.000001 13742 Query 1 13833 use `test`; insert into t1 values( 252 ) -master-bin.000001 13833 Query 1 13924 use `test`; insert into t1 values( 251 ) -master-bin.000001 13924 Query 1 14015 use `test`; insert into t1 values( 250 ) -master-bin.000001 14015 Query 1 14106 use `test`; insert into t1 values( 249 ) -master-bin.000001 14106 Query 1 14197 use `test`; insert into t1 values( 248 ) -master-bin.000001 14197 Query 1 14288 use `test`; insert into t1 values( 247 ) -master-bin.000001 14288 Query 1 14379 use `test`; insert into t1 values( 246 ) -master-bin.000001 14379 Query 1 14470 use `test`; insert into t1 values( 245 ) -master-bin.000001 14470 Query 1 14561 use `test`; insert into t1 values( 244 ) -master-bin.000001 14561 Query 1 14652 use `test`; insert into t1 values( 243 ) -master-bin.000001 14652 Query 1 14743 use `test`; insert into t1 values( 242 ) -master-bin.000001 14743 Query 1 14834 use `test`; insert into t1 values( 241 ) -master-bin.000001 14834 Query 1 14925 use `test`; insert into t1 values( 240 ) -master-bin.000001 14925 Query 1 15016 use `test`; insert into t1 values( 239 ) -master-bin.000001 15016 Query 1 15107 use `test`; insert into t1 values( 238 ) -master-bin.000001 15107 Query 1 15198 use `test`; insert into t1 values( 237 ) -master-bin.000001 15198 Query 1 15289 use `test`; insert into t1 values( 236 ) -master-bin.000001 15289 Query 1 15380 use `test`; insert into t1 values( 235 ) -master-bin.000001 15380 Query 1 15471 use `test`; insert into t1 values( 234 ) -master-bin.000001 15471 Query 1 15562 use `test`; insert into t1 values( 233 ) -master-bin.000001 15562 Query 1 15653 use `test`; insert into t1 values( 232 ) -master-bin.000001 15653 Query 1 15744 use `test`; insert into t1 values( 231 ) -master-bin.000001 15744 Query 1 15835 use `test`; insert into t1 values( 230 ) -master-bin.000001 15835 Query 1 15926 use `test`; insert into t1 values( 229 ) -master-bin.000001 15926 Query 1 16017 use `test`; insert into t1 values( 228 ) -master-bin.000001 16017 Query 1 16108 use `test`; insert into t1 values( 227 ) -master-bin.000001 16108 Query 1 16199 use `test`; insert into t1 values( 226 ) -master-bin.000001 16199 Query 1 16290 use `test`; insert into t1 values( 225 ) -master-bin.000001 16290 Query 1 16381 use `test`; insert into t1 values( 224 ) -master-bin.000001 16381 Query 1 16472 use `test`; insert into t1 values( 223 ) -master-bin.000001 16472 Query 1 16563 use `test`; insert into t1 values( 222 ) -master-bin.000001 16563 Query 1 16654 use `test`; insert into t1 values( 221 ) -master-bin.000001 16654 Query 1 16745 use `test`; insert into t1 values( 220 ) -master-bin.000001 16745 Query 1 16836 use `test`; insert into t1 values( 219 ) -master-bin.000001 16836 Query 1 16927 use `test`; insert into t1 values( 218 ) -master-bin.000001 16927 Query 1 17018 use `test`; insert into t1 values( 217 ) -master-bin.000001 17018 Query 1 17109 use `test`; insert into t1 values( 216 ) -master-bin.000001 17109 Query 1 17200 use `test`; insert into t1 values( 215 ) -master-bin.000001 17200 Query 1 17291 use `test`; insert into t1 values( 214 ) -master-bin.000001 17291 Query 1 17382 use `test`; insert into t1 values( 213 ) -master-bin.000001 17382 Query 1 17473 use `test`; insert into t1 values( 212 ) -master-bin.000001 17473 Query 1 17564 use `test`; insert into t1 values( 211 ) -master-bin.000001 17564 Query 1 17655 use `test`; insert into t1 values( 210 ) -master-bin.000001 17655 Query 1 17746 use `test`; insert into t1 values( 209 ) -master-bin.000001 17746 Query 1 17837 use `test`; insert into t1 values( 208 ) -master-bin.000001 17837 Query 1 17928 use `test`; insert into t1 values( 207 ) -master-bin.000001 17928 Query 1 18019 use `test`; insert into t1 values( 206 ) -master-bin.000001 18019 Query 1 18110 use `test`; insert into t1 values( 205 ) -master-bin.000001 18110 Query 1 18201 use `test`; insert into t1 values( 204 ) -master-bin.000001 18201 Query 1 18292 use `test`; insert into t1 values( 203 ) -master-bin.000001 18292 Query 1 18383 use `test`; insert into t1 values( 202 ) -master-bin.000001 18383 Query 1 18474 use `test`; insert into t1 values( 201 ) -master-bin.000001 18474 Query 1 18565 use `test`; insert into t1 values( 200 ) -master-bin.000001 18565 Query 1 18656 use `test`; insert into t1 values( 199 ) -master-bin.000001 18656 Query 1 18747 use `test`; insert into t1 values( 198 ) -master-bin.000001 18747 Query 1 18838 use `test`; insert into t1 values( 197 ) -master-bin.000001 18838 Query 1 18929 use `test`; insert into t1 values( 196 ) -master-bin.000001 18929 Query 1 19020 use `test`; insert into t1 values( 195 ) -master-bin.000001 19020 Query 1 19111 use `test`; insert into t1 values( 194 ) -master-bin.000001 19111 Query 1 19202 use `test`; insert into t1 values( 193 ) -master-bin.000001 19202 Query 1 19293 use `test`; insert into t1 values( 192 ) -master-bin.000001 19293 Query 1 19384 use `test`; insert into t1 values( 191 ) -master-bin.000001 19384 Query 1 19475 use `test`; insert into t1 values( 190 ) -master-bin.000001 19475 Query 1 19566 use `test`; insert into t1 values( 189 ) -master-bin.000001 19566 Query 1 19657 use `test`; insert into t1 values( 188 ) -master-bin.000001 19657 Query 1 19748 use `test`; insert into t1 values( 187 ) -master-bin.000001 19748 Query 1 19839 use `test`; insert into t1 values( 186 ) -master-bin.000001 19839 Query 1 19930 use `test`; insert into t1 values( 185 ) -master-bin.000001 19930 Query 1 20021 use `test`; insert into t1 values( 184 ) -master-bin.000001 20021 Query 1 20112 use `test`; insert into t1 values( 183 ) -master-bin.000001 20112 Query 1 20203 use `test`; insert into t1 values( 182 ) -master-bin.000001 20203 Query 1 20294 use `test`; insert into t1 values( 181 ) -master-bin.000001 20294 Query 1 20385 use `test`; insert into t1 values( 180 ) -master-bin.000001 20385 Query 1 20476 use `test`; insert into t1 values( 179 ) -master-bin.000001 20476 Query 1 20567 use `test`; insert into t1 values( 178 ) -master-bin.000001 20567 Query 1 20658 use `test`; insert into t1 values( 177 ) -master-bin.000001 20658 Query 1 20749 use `test`; insert into t1 values( 176 ) -master-bin.000001 20749 Query 1 20840 use `test`; insert into t1 values( 175 ) -master-bin.000001 20840 Query 1 20931 use `test`; insert into t1 values( 174 ) -master-bin.000001 20931 Query 1 21022 use `test`; insert into t1 values( 173 ) -master-bin.000001 21022 Query 1 21113 use `test`; insert into t1 values( 172 ) -master-bin.000001 21113 Query 1 21204 use `test`; insert into t1 values( 171 ) -master-bin.000001 21204 Query 1 21295 use `test`; insert into t1 values( 170 ) -master-bin.000001 21295 Query 1 21386 use `test`; insert into t1 values( 169 ) -master-bin.000001 21386 Query 1 21477 use `test`; insert into t1 values( 168 ) -master-bin.000001 21477 Query 1 21568 use `test`; insert into t1 values( 167 ) -master-bin.000001 21568 Query 1 21659 use `test`; insert into t1 values( 166 ) -master-bin.000001 21659 Query 1 21750 use `test`; insert into t1 values( 165 ) -master-bin.000001 21750 Query 1 21841 use `test`; insert into t1 values( 164 ) -master-bin.000001 21841 Query 1 21932 use `test`; insert into t1 values( 163 ) -master-bin.000001 21932 Query 1 22023 use `test`; insert into t1 values( 162 ) -master-bin.000001 22023 Query 1 22114 use `test`; insert into t1 values( 161 ) -master-bin.000001 22114 Query 1 22205 use `test`; insert into t1 values( 160 ) -master-bin.000001 22205 Query 1 22296 use `test`; insert into t1 values( 159 ) -master-bin.000001 22296 Query 1 22387 use `test`; insert into t1 values( 158 ) -master-bin.000001 22387 Query 1 22478 use `test`; insert into t1 values( 157 ) -master-bin.000001 22478 Query 1 22569 use `test`; insert into t1 values( 156 ) -master-bin.000001 22569 Query 1 22660 use `test`; insert into t1 values( 155 ) -master-bin.000001 22660 Query 1 22751 use `test`; insert into t1 values( 154 ) -master-bin.000001 22751 Query 1 22842 use `test`; insert into t1 values( 153 ) -master-bin.000001 22842 Query 1 22933 use `test`; insert into t1 values( 152 ) -master-bin.000001 22933 Query 1 23024 use `test`; insert into t1 values( 151 ) -master-bin.000001 23024 Query 1 23115 use `test`; insert into t1 values( 150 ) -master-bin.000001 23115 Query 1 23206 use `test`; insert into t1 values( 149 ) -master-bin.000001 23206 Query 1 23297 use `test`; insert into t1 values( 148 ) -master-bin.000001 23297 Query 1 23388 use `test`; insert into t1 values( 147 ) -master-bin.000001 23388 Query 1 23479 use `test`; insert into t1 values( 146 ) -master-bin.000001 23479 Query 1 23570 use `test`; insert into t1 values( 145 ) -master-bin.000001 23570 Query 1 23661 use `test`; insert into t1 values( 144 ) -master-bin.000001 23661 Query 1 23752 use `test`; insert into t1 values( 143 ) -master-bin.000001 23752 Query 1 23843 use `test`; insert into t1 values( 142 ) -master-bin.000001 23843 Query 1 23934 use `test`; insert into t1 values( 141 ) -master-bin.000001 23934 Query 1 24025 use `test`; insert into t1 values( 140 ) -master-bin.000001 24025 Query 1 24116 use `test`; insert into t1 values( 139 ) -master-bin.000001 24116 Query 1 24207 use `test`; insert into t1 values( 138 ) -master-bin.000001 24207 Query 1 24298 use `test`; insert into t1 values( 137 ) -master-bin.000001 24298 Query 1 24389 use `test`; insert into t1 values( 136 ) -master-bin.000001 24389 Query 1 24480 use `test`; insert into t1 values( 135 ) -master-bin.000001 24480 Query 1 24571 use `test`; insert into t1 values( 134 ) -master-bin.000001 24571 Query 1 24662 use `test`; insert into t1 values( 133 ) -master-bin.000001 24662 Query 1 24753 use `test`; insert into t1 values( 132 ) -master-bin.000001 24753 Query 1 24844 use `test`; insert into t1 values( 131 ) -master-bin.000001 24844 Query 1 24935 use `test`; insert into t1 values( 130 ) -master-bin.000001 24935 Query 1 25026 use `test`; insert into t1 values( 129 ) -master-bin.000001 25026 Query 1 25117 use `test`; insert into t1 values( 128 ) -master-bin.000001 25117 Query 1 25208 use `test`; insert into t1 values( 127 ) -master-bin.000001 25208 Query 1 25299 use `test`; insert into t1 values( 126 ) -master-bin.000001 25299 Query 1 25390 use `test`; insert into t1 values( 125 ) -master-bin.000001 25390 Query 1 25481 use `test`; insert into t1 values( 124 ) -master-bin.000001 25481 Query 1 25572 use `test`; insert into t1 values( 123 ) -master-bin.000001 25572 Query 1 25663 use `test`; insert into t1 values( 122 ) -master-bin.000001 25663 Query 1 25754 use `test`; insert into t1 values( 121 ) -master-bin.000001 25754 Query 1 25845 use `test`; insert into t1 values( 120 ) -master-bin.000001 25845 Query 1 25936 use `test`; insert into t1 values( 119 ) -master-bin.000001 25936 Query 1 26027 use `test`; insert into t1 values( 118 ) -master-bin.000001 26027 Query 1 26118 use `test`; insert into t1 values( 117 ) -master-bin.000001 26118 Query 1 26209 use `test`; insert into t1 values( 116 ) -master-bin.000001 26209 Query 1 26300 use `test`; insert into t1 values( 115 ) -master-bin.000001 26300 Query 1 26391 use `test`; insert into t1 values( 114 ) -master-bin.000001 26391 Query 1 26482 use `test`; insert into t1 values( 113 ) -master-bin.000001 26482 Query 1 26573 use `test`; insert into t1 values( 112 ) -master-bin.000001 26573 Query 1 26664 use `test`; insert into t1 values( 111 ) -master-bin.000001 26664 Query 1 26755 use `test`; insert into t1 values( 110 ) -master-bin.000001 26755 Query 1 26846 use `test`; insert into t1 values( 109 ) -master-bin.000001 26846 Query 1 26937 use `test`; insert into t1 values( 108 ) -master-bin.000001 26937 Query 1 27028 use `test`; insert into t1 values( 107 ) -master-bin.000001 27028 Query 1 27119 use `test`; insert into t1 values( 106 ) -master-bin.000001 27119 Query 1 27210 use `test`; insert into t1 values( 105 ) -master-bin.000001 27210 Query 1 27301 use `test`; insert into t1 values( 104 ) -master-bin.000001 27301 Query 1 27392 use `test`; insert into t1 values( 103 ) -master-bin.000001 27392 Query 1 27483 use `test`; insert into t1 values( 102 ) -master-bin.000001 27483 Query 1 27574 use `test`; insert into t1 values( 101 ) -master-bin.000001 27574 Query 1 27665 use `test`; insert into t1 values( 100 ) -master-bin.000001 27665 Query 1 27755 use `test`; insert into t1 values( 99 ) -master-bin.000001 27755 Query 1 27845 use `test`; insert into t1 values( 98 ) -master-bin.000001 27845 Query 1 27935 use `test`; insert into t1 values( 97 ) -master-bin.000001 27935 Query 1 28025 use `test`; insert into t1 values( 96 ) -master-bin.000001 28025 Query 1 28115 use `test`; insert into t1 values( 95 ) -master-bin.000001 28115 Query 1 28205 use `test`; insert into t1 values( 94 ) -master-bin.000001 28205 Query 1 28295 use `test`; insert into t1 values( 93 ) -master-bin.000001 28295 Query 1 28385 use `test`; insert into t1 values( 92 ) -master-bin.000001 28385 Query 1 28475 use `test`; insert into t1 values( 91 ) -master-bin.000001 28475 Query 1 28565 use `test`; insert into t1 values( 90 ) -master-bin.000001 28565 Query 1 28655 use `test`; insert into t1 values( 89 ) -master-bin.000001 28655 Query 1 28745 use `test`; insert into t1 values( 88 ) -master-bin.000001 28745 Query 1 28835 use `test`; insert into t1 values( 87 ) -master-bin.000001 28835 Query 1 28925 use `test`; insert into t1 values( 86 ) -master-bin.000001 28925 Query 1 29015 use `test`; insert into t1 values( 85 ) -master-bin.000001 29015 Query 1 29105 use `test`; insert into t1 values( 84 ) -master-bin.000001 29105 Query 1 29195 use `test`; insert into t1 values( 83 ) -master-bin.000001 29195 Query 1 29285 use `test`; insert into t1 values( 82 ) -master-bin.000001 29285 Query 1 29375 use `test`; insert into t1 values( 81 ) -master-bin.000001 29375 Query 1 29465 use `test`; insert into t1 values( 80 ) -master-bin.000001 29465 Query 1 29555 use `test`; insert into t1 values( 79 ) -master-bin.000001 29555 Query 1 29645 use `test`; insert into t1 values( 78 ) -master-bin.000001 29645 Query 1 29735 use `test`; insert into t1 values( 77 ) -master-bin.000001 29735 Query 1 29825 use `test`; insert into t1 values( 76 ) -master-bin.000001 29825 Query 1 29915 use `test`; insert into t1 values( 75 ) -master-bin.000001 29915 Query 1 30005 use `test`; insert into t1 values( 74 ) -master-bin.000001 30005 Query 1 30095 use `test`; insert into t1 values( 73 ) -master-bin.000001 30095 Query 1 30185 use `test`; insert into t1 values( 72 ) -master-bin.000001 30185 Query 1 30275 use `test`; insert into t1 values( 71 ) -master-bin.000001 30275 Query 1 30365 use `test`; insert into t1 values( 70 ) -master-bin.000001 30365 Query 1 30455 use `test`; insert into t1 values( 69 ) -master-bin.000001 30455 Query 1 30545 use `test`; insert into t1 values( 68 ) -master-bin.000001 30545 Query 1 30635 use `test`; insert into t1 values( 67 ) -master-bin.000001 30635 Query 1 30725 use `test`; insert into t1 values( 66 ) -master-bin.000001 30725 Query 1 30815 use `test`; insert into t1 values( 65 ) -master-bin.000001 30815 Query 1 30905 use `test`; insert into t1 values( 64 ) -master-bin.000001 30905 Query 1 30995 use `test`; insert into t1 values( 63 ) -master-bin.000001 30995 Query 1 31085 use `test`; insert into t1 values( 62 ) -master-bin.000001 31085 Query 1 31175 use `test`; insert into t1 values( 61 ) -master-bin.000001 31175 Query 1 31265 use `test`; insert into t1 values( 60 ) -master-bin.000001 31265 Query 1 31355 use `test`; insert into t1 values( 59 ) -master-bin.000001 31355 Query 1 31445 use `test`; insert into t1 values( 58 ) -master-bin.000001 31445 Query 1 31535 use `test`; insert into t1 values( 57 ) -master-bin.000001 31535 Query 1 31625 use `test`; insert into t1 values( 56 ) -master-bin.000001 31625 Query 1 31715 use `test`; insert into t1 values( 55 ) -master-bin.000001 31715 Query 1 31805 use `test`; insert into t1 values( 54 ) -master-bin.000001 31805 Query 1 31895 use `test`; insert into t1 values( 53 ) -master-bin.000001 31895 Query 1 31985 use `test`; insert into t1 values( 52 ) -master-bin.000001 31985 Query 1 32075 use `test`; insert into t1 values( 51 ) -master-bin.000001 32075 Query 1 32165 use `test`; insert into t1 values( 50 ) -master-bin.000001 32165 Query 1 32255 use `test`; insert into t1 values( 49 ) -master-bin.000001 32255 Query 1 32345 use `test`; insert into t1 values( 48 ) -master-bin.000001 32345 Query 1 32435 use `test`; insert into t1 values( 47 ) -master-bin.000001 32435 Query 1 32525 use `test`; insert into t1 values( 46 ) -master-bin.000001 32525 Query 1 32615 use `test`; insert into t1 values( 45 ) -master-bin.000001 32615 Query 1 32705 use `test`; insert into t1 values( 44 ) -master-bin.000001 32705 Query 1 32795 use `test`; insert into t1 values( 43 ) -master-bin.000001 32795 Query 1 32885 use `test`; insert into t1 values( 42 ) -master-bin.000001 32885 Query 1 32975 use `test`; insert into t1 values( 41 ) -master-bin.000001 32975 Query 1 33065 use `test`; insert into t1 values( 40 ) -master-bin.000001 33065 Query 1 33155 use `test`; insert into t1 values( 39 ) -master-bin.000001 33155 Query 1 33245 use `test`; insert into t1 values( 38 ) -master-bin.000001 33245 Query 1 33335 use `test`; insert into t1 values( 37 ) -master-bin.000001 33335 Query 1 33425 use `test`; insert into t1 values( 36 ) -master-bin.000001 33425 Query 1 33515 use `test`; insert into t1 values( 35 ) -master-bin.000001 33515 Query 1 33605 use `test`; insert into t1 values( 34 ) -master-bin.000001 33605 Query 1 33695 use `test`; insert into t1 values( 33 ) -master-bin.000001 33695 Query 1 33785 use `test`; insert into t1 values( 32 ) -master-bin.000001 33785 Query 1 33875 use `test`; insert into t1 values( 31 ) -master-bin.000001 33875 Query 1 33965 use `test`; insert into t1 values( 30 ) -master-bin.000001 33965 Query 1 34055 use `test`; insert into t1 values( 29 ) -master-bin.000001 34055 Query 1 34145 use `test`; insert into t1 values( 28 ) -master-bin.000001 34145 Query 1 34235 use `test`; insert into t1 values( 27 ) -master-bin.000001 34235 Query 1 34325 use `test`; insert into t1 values( 26 ) -master-bin.000001 34325 Query 1 34415 use `test`; insert into t1 values( 25 ) -master-bin.000001 34415 Query 1 34505 use `test`; insert into t1 values( 24 ) -master-bin.000001 34505 Query 1 34595 use `test`; insert into t1 values( 23 ) -master-bin.000001 34595 Query 1 34685 use `test`; insert into t1 values( 22 ) -master-bin.000001 34685 Query 1 34775 use `test`; insert into t1 values( 21 ) -master-bin.000001 34775 Query 1 34865 use `test`; insert into t1 values( 20 ) -master-bin.000001 34865 Query 1 34955 use `test`; insert into t1 values( 19 ) -master-bin.000001 34955 Query 1 35045 use `test`; insert into t1 values( 18 ) -master-bin.000001 35045 Query 1 35135 use `test`; insert into t1 values( 17 ) -master-bin.000001 35135 Query 1 35225 use `test`; insert into t1 values( 16 ) -master-bin.000001 35225 Query 1 35315 use `test`; insert into t1 values( 15 ) -master-bin.000001 35315 Query 1 35405 use `test`; insert into t1 values( 14 ) -master-bin.000001 35405 Query 1 35495 use `test`; insert into t1 values( 13 ) -master-bin.000001 35495 Query 1 35585 use `test`; insert into t1 values( 12 ) -master-bin.000001 35585 Query 1 35675 use `test`; insert into t1 values( 11 ) -master-bin.000001 35675 Query 1 35765 use `test`; insert into t1 values( 10 ) -master-bin.000001 35765 Query 1 35854 use `test`; insert into t1 values( 9 ) -master-bin.000001 35854 Query 1 35943 use `test`; insert into t1 values( 8 ) -master-bin.000001 35943 Query 1 36032 use `test`; insert into t1 values( 7 ) -master-bin.000001 36032 Query 1 36121 use `test`; insert into t1 values( 6 ) -master-bin.000001 36121 Query 1 36210 use `test`; insert into t1 values( 5 ) -master-bin.000001 36210 Query 1 36299 use `test`; insert into t1 values( 4 ) -master-bin.000001 36299 Query 1 36388 use `test`; insert into t1 values( 3 ) -master-bin.000001 36388 Query 1 36477 use `test`; insert into t1 values( 2 ) -master-bin.000001 36477 Query 1 36566 use `test`; insert into t1 values( 1 ) -master-bin.000001 36566 Xid 1 36593 COMMIT /* XID */ -master-bin.000001 36593 Rotate 1 36637 master-bin.000002;pos=4 +master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4 +master-bin.000001 107 Query 1 207 use `test`; create table t1 (a int) engine=innodb +master-bin.000001 207 Query 1 275 BEGIN +master-bin.000001 275 Query 1 366 use `test`; insert into t1 values( 400 ) +master-bin.000001 366 Query 1 457 use `test`; insert into t1 values( 399 ) +master-bin.000001 457 Query 1 548 use `test`; insert into t1 values( 398 ) +master-bin.000001 548 Query 1 639 use `test`; insert into t1 values( 397 ) +master-bin.000001 639 Query 1 730 use `test`; insert into t1 values( 396 ) +master-bin.000001 730 Query 1 821 use `test`; insert into t1 values( 395 ) +master-bin.000001 821 Query 1 912 use `test`; insert into t1 values( 394 ) +master-bin.000001 912 Query 1 1003 use `test`; insert into t1 values( 393 ) +master-bin.000001 1003 Query 1 1094 use `test`; insert into t1 values( 392 ) +master-bin.000001 1094 Query 1 1185 use `test`; insert into t1 values( 391 ) +master-bin.000001 1185 Query 1 1276 use `test`; insert into t1 values( 390 ) +master-bin.000001 1276 Query 1 1367 use `test`; insert into t1 values( 389 ) +master-bin.000001 1367 Query 1 1458 use `test`; insert into t1 values( 388 ) +master-bin.000001 1458 Query 1 1549 use `test`; insert into t1 values( 387 ) +master-bin.000001 1549 Query 1 1640 use `test`; insert into t1 values( 386 ) +master-bin.000001 1640 Query 1 1731 use `test`; insert into t1 values( 385 ) +master-bin.000001 1731 Query 1 1822 use `test`; insert into t1 values( 384 ) +master-bin.000001 1822 Query 1 1913 use `test`; insert into t1 values( 383 ) +master-bin.000001 1913 Query 1 2004 use `test`; insert into t1 values( 382 ) +master-bin.000001 2004 Query 1 2095 use `test`; insert into t1 values( 381 ) +master-bin.000001 2095 Query 1 2186 use `test`; insert into t1 values( 380 ) +master-bin.000001 2186 Query 1 2277 use `test`; insert into t1 values( 379 ) +master-bin.000001 2277 Query 1 2368 use `test`; insert into t1 values( 378 ) +master-bin.000001 2368 Query 1 2459 use `test`; insert into t1 values( 377 ) +master-bin.000001 2459 Query 1 2550 use `test`; insert into t1 values( 376 ) +master-bin.000001 2550 Query 1 2641 use `test`; insert into t1 values( 375 ) +master-bin.000001 2641 Query 1 2732 use `test`; insert into t1 values( 374 ) +master-bin.000001 2732 Query 1 2823 use `test`; insert into t1 values( 373 ) +master-bin.000001 2823 Query 1 2914 use `test`; insert into t1 values( 372 ) +master-bin.000001 2914 Query 1 3005 use `test`; insert into t1 values( 371 ) +master-bin.000001 3005 Query 1 3096 use `test`; insert into t1 values( 370 ) +master-bin.000001 3096 Query 1 3187 use `test`; insert into t1 values( 369 ) +master-bin.000001 3187 Query 1 3278 use `test`; insert into t1 values( 368 ) +master-bin.000001 3278 Query 1 3369 use `test`; insert into t1 values( 367 ) +master-bin.000001 3369 Query 1 3460 use `test`; insert into t1 values( 366 ) +master-bin.000001 3460 Query 1 3551 use `test`; insert into t1 values( 365 ) +master-bin.000001 3551 Query 1 3642 use `test`; insert into t1 values( 364 ) +master-bin.000001 3642 Query 1 3733 use `test`; insert into t1 values( 363 ) +master-bin.000001 3733 Query 1 3824 use `test`; insert into t1 values( 362 ) +master-bin.000001 3824 Query 1 3915 use `test`; insert into t1 values( 361 ) +master-bin.000001 3915 Query 1 4006 use `test`; insert into t1 values( 360 ) +master-bin.000001 4006 Query 1 4097 use `test`; insert into t1 values( 359 ) +master-bin.000001 4097 Query 1 4188 use `test`; insert into t1 values( 358 ) +master-bin.000001 4188 Query 1 4279 use `test`; insert into t1 values( 357 ) +master-bin.000001 4279 Query 1 4370 use `test`; insert into t1 values( 356 ) +master-bin.000001 4370 Query 1 4461 use `test`; insert into t1 values( 355 ) +master-bin.000001 4461 Query 1 4552 use `test`; insert into t1 values( 354 ) +master-bin.000001 4552 Query 1 4643 use `test`; insert into t1 values( 353 ) +master-bin.000001 4643 Query 1 4734 use `test`; insert into t1 values( 352 ) +master-bin.000001 4734 Query 1 4825 use `test`; insert into t1 values( 351 ) +master-bin.000001 4825 Query 1 4916 use `test`; insert into t1 values( 350 ) +master-bin.000001 4916 Query 1 5007 use `test`; insert into t1 values( 349 ) +master-bin.000001 5007 Query 1 5098 use `test`; insert into t1 values( 348 ) +master-bin.000001 5098 Query 1 5189 use `test`; insert into t1 values( 347 ) +master-bin.000001 5189 Query 1 5280 use `test`; insert into t1 values( 346 ) +master-bin.000001 5280 Query 1 5371 use `test`; insert into t1 values( 345 ) +master-bin.000001 5371 Query 1 5462 use `test`; insert into t1 values( 344 ) +master-bin.000001 5462 Query 1 5553 use `test`; insert into t1 values( 343 ) +master-bin.000001 5553 Query 1 5644 use `test`; insert into t1 values( 342 ) +master-bin.000001 5644 Query 1 5735 use `test`; insert into t1 values( 341 ) +master-bin.000001 5735 Query 1 5826 use `test`; insert into t1 values( 340 ) +master-bin.000001 5826 Query 1 5917 use `test`; insert into t1 values( 339 ) +master-bin.000001 5917 Query 1 6008 use `test`; insert into t1 values( 338 ) +master-bin.000001 6008 Query 1 6099 use `test`; insert into t1 values( 337 ) +master-bin.000001 6099 Query 1 6190 use `test`; insert into t1 values( 336 ) +master-bin.000001 6190 Query 1 6281 use `test`; insert into t1 values( 335 ) +master-bin.000001 6281 Query 1 6372 use `test`; insert into t1 values( 334 ) +master-bin.000001 6372 Query 1 6463 use `test`; insert into t1 values( 333 ) +master-bin.000001 6463 Query 1 6554 use `test`; insert into t1 values( 332 ) +master-bin.000001 6554 Query 1 6645 use `test`; insert into t1 values( 331 ) +master-bin.000001 6645 Query 1 6736 use `test`; insert into t1 values( 330 ) +master-bin.000001 6736 Query 1 6827 use `test`; insert into t1 values( 329 ) +master-bin.000001 6827 Query 1 6918 use `test`; insert into t1 values( 328 ) +master-bin.000001 6918 Query 1 7009 use `test`; insert into t1 values( 327 ) +master-bin.000001 7009 Query 1 7100 use `test`; insert into t1 values( 326 ) +master-bin.000001 7100 Query 1 7191 use `test`; insert into t1 values( 325 ) +master-bin.000001 7191 Query 1 7282 use `test`; insert into t1 values( 324 ) +master-bin.000001 7282 Query 1 7373 use `test`; insert into t1 values( 323 ) +master-bin.000001 7373 Query 1 7464 use `test`; insert into t1 values( 322 ) +master-bin.000001 7464 Query 1 7555 use `test`; insert into t1 values( 321 ) +master-bin.000001 7555 Query 1 7646 use `test`; insert into t1 values( 320 ) +master-bin.000001 7646 Query 1 7737 use `test`; insert into t1 values( 319 ) +master-bin.000001 7737 Query 1 7828 use `test`; insert into t1 values( 318 ) +master-bin.000001 7828 Query 1 7919 use `test`; insert into t1 values( 317 ) +master-bin.000001 7919 Query 1 8010 use `test`; insert into t1 values( 316 ) +master-bin.000001 8010 Query 1 8101 use `test`; insert into t1 values( 315 ) +master-bin.000001 8101 Query 1 8192 use `test`; insert into t1 values( 314 ) +master-bin.000001 8192 Query 1 8283 use `test`; insert into t1 values( 313 ) +master-bin.000001 8283 Query 1 8374 use `test`; insert into t1 values( 312 ) +master-bin.000001 8374 Query 1 8465 use `test`; insert into t1 values( 311 ) +master-bin.000001 8465 Query 1 8556 use `test`; insert into t1 values( 310 ) +master-bin.000001 8556 Query 1 8647 use `test`; insert into t1 values( 309 ) +master-bin.000001 8647 Query 1 8738 use `test`; insert into t1 values( 308 ) +master-bin.000001 8738 Query 1 8829 use `test`; insert into t1 values( 307 ) +master-bin.000001 8829 Query 1 8920 use `test`; insert into t1 values( 306 ) +master-bin.000001 8920 Query 1 9011 use `test`; insert into t1 values( 305 ) +master-bin.000001 9011 Query 1 9102 use `test`; insert into t1 values( 304 ) +master-bin.000001 9102 Query 1 9193 use `test`; insert into t1 values( 303 ) +master-bin.000001 9193 Query 1 9284 use `test`; insert into t1 values( 302 ) +master-bin.000001 9284 Query 1 9375 use `test`; insert into t1 values( 301 ) +master-bin.000001 9375 Query 1 9466 use `test`; insert into t1 values( 300 ) +master-bin.000001 9466 Query 1 9557 use `test`; insert into t1 values( 299 ) +master-bin.000001 9557 Query 1 9648 use `test`; insert into t1 values( 298 ) +master-bin.000001 9648 Query 1 9739 use `test`; insert into t1 values( 297 ) +master-bin.000001 9739 Query 1 9830 use `test`; insert into t1 values( 296 ) +master-bin.000001 9830 Query 1 9921 use `test`; insert into t1 values( 295 ) +master-bin.000001 9921 Query 1 10012 use `test`; insert into t1 values( 294 ) +master-bin.000001 10012 Query 1 10103 use `test`; insert into t1 values( 293 ) +master-bin.000001 10103 Query 1 10194 use `test`; insert into t1 values( 292 ) +master-bin.000001 10194 Query 1 10285 use `test`; insert into t1 values( 291 ) +master-bin.000001 10285 Query 1 10376 use `test`; insert into t1 values( 290 ) +master-bin.000001 10376 Query 1 10467 use `test`; insert into t1 values( 289 ) +master-bin.000001 10467 Query 1 10558 use `test`; insert into t1 values( 288 ) +master-bin.000001 10558 Query 1 10649 use `test`; insert into t1 values( 287 ) +master-bin.000001 10649 Query 1 10740 use `test`; insert into t1 values( 286 ) +master-bin.000001 10740 Query 1 10831 use `test`; insert into t1 values( 285 ) +master-bin.000001 10831 Query 1 10922 use `test`; insert into t1 values( 284 ) +master-bin.000001 10922 Query 1 11013 use `test`; insert into t1 values( 283 ) +master-bin.000001 11013 Query 1 11104 use `test`; insert into t1 values( 282 ) +master-bin.000001 11104 Query 1 11195 use `test`; insert into t1 values( 281 ) +master-bin.000001 11195 Query 1 11286 use `test`; insert into t1 values( 280 ) +master-bin.000001 11286 Query 1 11377 use `test`; insert into t1 values( 279 ) +master-bin.000001 11377 Query 1 11468 use `test`; insert into t1 values( 278 ) +master-bin.000001 11468 Query 1 11559 use `test`; insert into t1 values( 277 ) +master-bin.000001 11559 Query 1 11650 use `test`; insert into t1 values( 276 ) +master-bin.000001 11650 Query 1 11741 use `test`; insert into t1 values( 275 ) +master-bin.000001 11741 Query 1 11832 use `test`; insert into t1 values( 274 ) +master-bin.000001 11832 Query 1 11923 use `test`; insert into t1 values( 273 ) +master-bin.000001 11923 Query 1 12014 use `test`; insert into t1 values( 272 ) +master-bin.000001 12014 Query 1 12105 use `test`; insert into t1 values( 271 ) +master-bin.000001 12105 Query 1 12196 use `test`; insert into t1 values( 270 ) +master-bin.000001 12196 Query 1 12287 use `test`; insert into t1 values( 269 ) +master-bin.000001 12287 Query 1 12378 use `test`; insert into t1 values( 268 ) +master-bin.000001 12378 Query 1 12469 use `test`; insert into t1 values( 267 ) +master-bin.000001 12469 Query 1 12560 use `test`; insert into t1 values( 266 ) +master-bin.000001 12560 Query 1 12651 use `test`; insert into t1 values( 265 ) +master-bin.000001 12651 Query 1 12742 use `test`; insert into t1 values( 264 ) +master-bin.000001 12742 Query 1 12833 use `test`; insert into t1 values( 263 ) +master-bin.000001 12833 Query 1 12924 use `test`; insert into t1 values( 262 ) +master-bin.000001 12924 Query 1 13015 use `test`; insert into t1 values( 261 ) +master-bin.000001 13015 Query 1 13106 use `test`; insert into t1 values( 260 ) +master-bin.000001 13106 Query 1 13197 use `test`; insert into t1 values( 259 ) +master-bin.000001 13197 Query 1 13288 use `test`; insert into t1 values( 258 ) +master-bin.000001 13288 Query 1 13379 use `test`; insert into t1 values( 257 ) +master-bin.000001 13379 Query 1 13470 use `test`; insert into t1 values( 256 ) +master-bin.000001 13470 Query 1 13561 use `test`; insert into t1 values( 255 ) +master-bin.000001 13561 Query 1 13652 use `test`; insert into t1 values( 254 ) +master-bin.000001 13652 Query 1 13743 use `test`; insert into t1 values( 253 ) +master-bin.000001 13743 Query 1 13834 use `test`; insert into t1 values( 252 ) +master-bin.000001 13834 Query 1 13925 use `test`; insert into t1 values( 251 ) +master-bin.000001 13925 Query 1 14016 use `test`; insert into t1 values( 250 ) +master-bin.000001 14016 Query 1 14107 use `test`; insert into t1 values( 249 ) +master-bin.000001 14107 Query 1 14198 use `test`; insert into t1 values( 248 ) +master-bin.000001 14198 Query 1 14289 use `test`; insert into t1 values( 247 ) +master-bin.000001 14289 Query 1 14380 use `test`; insert into t1 values( 246 ) +master-bin.000001 14380 Query 1 14471 use `test`; insert into t1 values( 245 ) +master-bin.000001 14471 Query 1 14562 use `test`; insert into t1 values( 244 ) +master-bin.000001 14562 Query 1 14653 use `test`; insert into t1 values( 243 ) +master-bin.000001 14653 Query 1 14744 use `test`; insert into t1 values( 242 ) +master-bin.000001 14744 Query 1 14835 use `test`; insert into t1 values( 241 ) +master-bin.000001 14835 Query 1 14926 use `test`; insert into t1 values( 240 ) +master-bin.000001 14926 Query 1 15017 use `test`; insert into t1 values( 239 ) +master-bin.000001 15017 Query 1 15108 use `test`; insert into t1 values( 238 ) +master-bin.000001 15108 Query 1 15199 use `test`; insert into t1 values( 237 ) +master-bin.000001 15199 Query 1 15290 use `test`; insert into t1 values( 236 ) +master-bin.000001 15290 Query 1 15381 use `test`; insert into t1 values( 235 ) +master-bin.000001 15381 Query 1 15472 use `test`; insert into t1 values( 234 ) +master-bin.000001 15472 Query 1 15563 use `test`; insert into t1 values( 233 ) +master-bin.000001 15563 Query 1 15654 use `test`; insert into t1 values( 232 ) +master-bin.000001 15654 Query 1 15745 use `test`; insert into t1 values( 231 ) +master-bin.000001 15745 Query 1 15836 use `test`; insert into t1 values( 230 ) +master-bin.000001 15836 Query 1 15927 use `test`; insert into t1 values( 229 ) +master-bin.000001 15927 Query 1 16018 use `test`; insert into t1 values( 228 ) +master-bin.000001 16018 Query 1 16109 use `test`; insert into t1 values( 227 ) +master-bin.000001 16109 Query 1 16200 use `test`; insert into t1 values( 226 ) +master-bin.000001 16200 Query 1 16291 use `test`; insert into t1 values( 225 ) +master-bin.000001 16291 Query 1 16382 use `test`; insert into t1 values( 224 ) +master-bin.000001 16382 Query 1 16473 use `test`; insert into t1 values( 223 ) +master-bin.000001 16473 Query 1 16564 use `test`; insert into t1 values( 222 ) +master-bin.000001 16564 Query 1 16655 use `test`; insert into t1 values( 221 ) +master-bin.000001 16655 Query 1 16746 use `test`; insert into t1 values( 220 ) +master-bin.000001 16746 Query 1 16837 use `test`; insert into t1 values( 219 ) +master-bin.000001 16837 Query 1 16928 use `test`; insert into t1 values( 218 ) +master-bin.000001 16928 Query 1 17019 use `test`; insert into t1 values( 217 ) +master-bin.000001 17019 Query 1 17110 use `test`; insert into t1 values( 216 ) +master-bin.000001 17110 Query 1 17201 use `test`; insert into t1 values( 215 ) +master-bin.000001 17201 Query 1 17292 use `test`; insert into t1 values( 214 ) +master-bin.000001 17292 Query 1 17383 use `test`; insert into t1 values( 213 ) +master-bin.000001 17383 Query 1 17474 use `test`; insert into t1 values( 212 ) +master-bin.000001 17474 Query 1 17565 use `test`; insert into t1 values( 211 ) +master-bin.000001 17565 Query 1 17656 use `test`; insert into t1 values( 210 ) +master-bin.000001 17656 Query 1 17747 use `test`; insert into t1 values( 209 ) +master-bin.000001 17747 Query 1 17838 use `test`; insert into t1 values( 208 ) +master-bin.000001 17838 Query 1 17929 use `test`; insert into t1 values( 207 ) +master-bin.000001 17929 Query 1 18020 use `test`; insert into t1 values( 206 ) +master-bin.000001 18020 Query 1 18111 use `test`; insert into t1 values( 205 ) +master-bin.000001 18111 Query 1 18202 use `test`; insert into t1 values( 204 ) +master-bin.000001 18202 Query 1 18293 use `test`; insert into t1 values( 203 ) +master-bin.000001 18293 Query 1 18384 use `test`; insert into t1 values( 202 ) +master-bin.000001 18384 Query 1 18475 use `test`; insert into t1 values( 201 ) +master-bin.000001 18475 Query 1 18566 use `test`; insert into t1 values( 200 ) +master-bin.000001 18566 Query 1 18657 use `test`; insert into t1 values( 199 ) +master-bin.000001 18657 Query 1 18748 use `test`; insert into t1 values( 198 ) +master-bin.000001 18748 Query 1 18839 use `test`; insert into t1 values( 197 ) +master-bin.000001 18839 Query 1 18930 use `test`; insert into t1 values( 196 ) +master-bin.000001 18930 Query 1 19021 use `test`; insert into t1 values( 195 ) +master-bin.000001 19021 Query 1 19112 use `test`; insert into t1 values( 194 ) +master-bin.000001 19112 Query 1 19203 use `test`; insert into t1 values( 193 ) +master-bin.000001 19203 Query 1 19294 use `test`; insert into t1 values( 192 ) +master-bin.000001 19294 Query 1 19385 use `test`; insert into t1 values( 191 ) +master-bin.000001 19385 Query 1 19476 use `test`; insert into t1 values( 190 ) +master-bin.000001 19476 Query 1 19567 use `test`; insert into t1 values( 189 ) +master-bin.000001 19567 Query 1 19658 use `test`; insert into t1 values( 188 ) +master-bin.000001 19658 Query 1 19749 use `test`; insert into t1 values( 187 ) +master-bin.000001 19749 Query 1 19840 use `test`; insert into t1 values( 186 ) +master-bin.000001 19840 Query 1 19931 use `test`; insert into t1 values( 185 ) +master-bin.000001 19931 Query 1 20022 use `test`; insert into t1 values( 184 ) +master-bin.000001 20022 Query 1 20113 use `test`; insert into t1 values( 183 ) +master-bin.000001 20113 Query 1 20204 use `test`; insert into t1 values( 182 ) +master-bin.000001 20204 Query 1 20295 use `test`; insert into t1 values( 181 ) +master-bin.000001 20295 Query 1 20386 use `test`; insert into t1 values( 180 ) +master-bin.000001 20386 Query 1 20477 use `test`; insert into t1 values( 179 ) +master-bin.000001 20477 Query 1 20568 use `test`; insert into t1 values( 178 ) +master-bin.000001 20568 Query 1 20659 use `test`; insert into t1 values( 177 ) +master-bin.000001 20659 Query 1 20750 use `test`; insert into t1 values( 176 ) +master-bin.000001 20750 Query 1 20841 use `test`; insert into t1 values( 175 ) +master-bin.000001 20841 Query 1 20932 use `test`; insert into t1 values( 174 ) +master-bin.000001 20932 Query 1 21023 use `test`; insert into t1 values( 173 ) +master-bin.000001 21023 Query 1 21114 use `test`; insert into t1 values( 172 ) +master-bin.000001 21114 Query 1 21205 use `test`; insert into t1 values( 171 ) +master-bin.000001 21205 Query 1 21296 use `test`; insert into t1 values( 170 ) +master-bin.000001 21296 Query 1 21387 use `test`; insert into t1 values( 169 ) +master-bin.000001 21387 Query 1 21478 use `test`; insert into t1 values( 168 ) +master-bin.000001 21478 Query 1 21569 use `test`; insert into t1 values( 167 ) +master-bin.000001 21569 Query 1 21660 use `test`; insert into t1 values( 166 ) +master-bin.000001 21660 Query 1 21751 use `test`; insert into t1 values( 165 ) +master-bin.000001 21751 Query 1 21842 use `test`; insert into t1 values( 164 ) +master-bin.000001 21842 Query 1 21933 use `test`; insert into t1 values( 163 ) +master-bin.000001 21933 Query 1 22024 use `test`; insert into t1 values( 162 ) +master-bin.000001 22024 Query 1 22115 use `test`; insert into t1 values( 161 ) +master-bin.000001 22115 Query 1 22206 use `test`; insert into t1 values( 160 ) +master-bin.000001 22206 Query 1 22297 use `test`; insert into t1 values( 159 ) +master-bin.000001 22297 Query 1 22388 use `test`; insert into t1 values( 158 ) +master-bin.000001 22388 Query 1 22479 use `test`; insert into t1 values( 157 ) +master-bin.000001 22479 Query 1 22570 use `test`; insert into t1 values( 156 ) +master-bin.000001 22570 Query 1 22661 use `test`; insert into t1 values( 155 ) +master-bin.000001 22661 Query 1 22752 use `test`; insert into t1 values( 154 ) +master-bin.000001 22752 Query 1 22843 use `test`; insert into t1 values( 153 ) +master-bin.000001 22843 Query 1 22934 use `test`; insert into t1 values( 152 ) +master-bin.000001 22934 Query 1 23025 use `test`; insert into t1 values( 151 ) +master-bin.000001 23025 Query 1 23116 use `test`; insert into t1 values( 150 ) +master-bin.000001 23116 Query 1 23207 use `test`; insert into t1 values( 149 ) +master-bin.000001 23207 Query 1 23298 use `test`; insert into t1 values( 148 ) +master-bin.000001 23298 Query 1 23389 use `test`; insert into t1 values( 147 ) +master-bin.000001 23389 Query 1 23480 use `test`; insert into t1 values( 146 ) +master-bin.000001 23480 Query 1 23571 use `test`; insert into t1 values( 145 ) +master-bin.000001 23571 Query 1 23662 use `test`; insert into t1 values( 144 ) +master-bin.000001 23662 Query 1 23753 use `test`; insert into t1 values( 143 ) +master-bin.000001 23753 Query 1 23844 use `test`; insert into t1 values( 142 ) +master-bin.000001 23844 Query 1 23935 use `test`; insert into t1 values( 141 ) +master-bin.000001 23935 Query 1 24026 use `test`; insert into t1 values( 140 ) +master-bin.000001 24026 Query 1 24117 use `test`; insert into t1 values( 139 ) +master-bin.000001 24117 Query 1 24208 use `test`; insert into t1 values( 138 ) +master-bin.000001 24208 Query 1 24299 use `test`; insert into t1 values( 137 ) +master-bin.000001 24299 Query 1 24390 use `test`; insert into t1 values( 136 ) +master-bin.000001 24390 Query 1 24481 use `test`; insert into t1 values( 135 ) +master-bin.000001 24481 Query 1 24572 use `test`; insert into t1 values( 134 ) +master-bin.000001 24572 Query 1 24663 use `test`; insert into t1 values( 133 ) +master-bin.000001 24663 Query 1 24754 use `test`; insert into t1 values( 132 ) +master-bin.000001 24754 Query 1 24845 use `test`; insert into t1 values( 131 ) +master-bin.000001 24845 Query 1 24936 use `test`; insert into t1 values( 130 ) +master-bin.000001 24936 Query 1 25027 use `test`; insert into t1 values( 129 ) +master-bin.000001 25027 Query 1 25118 use `test`; insert into t1 values( 128 ) +master-bin.000001 25118 Query 1 25209 use `test`; insert into t1 values( 127 ) +master-bin.000001 25209 Query 1 25300 use `test`; insert into t1 values( 126 ) +master-bin.000001 25300 Query 1 25391 use `test`; insert into t1 values( 125 ) +master-bin.000001 25391 Query 1 25482 use `test`; insert into t1 values( 124 ) +master-bin.000001 25482 Query 1 25573 use `test`; insert into t1 values( 123 ) +master-bin.000001 25573 Query 1 25664 use `test`; insert into t1 values( 122 ) +master-bin.000001 25664 Query 1 25755 use `test`; insert into t1 values( 121 ) +master-bin.000001 25755 Query 1 25846 use `test`; insert into t1 values( 120 ) +master-bin.000001 25846 Query 1 25937 use `test`; insert into t1 values( 119 ) +master-bin.000001 25937 Query 1 26028 use `test`; insert into t1 values( 118 ) +master-bin.000001 26028 Query 1 26119 use `test`; insert into t1 values( 117 ) +master-bin.000001 26119 Query 1 26210 use `test`; insert into t1 values( 116 ) +master-bin.000001 26210 Query 1 26301 use `test`; insert into t1 values( 115 ) +master-bin.000001 26301 Query 1 26392 use `test`; insert into t1 values( 114 ) +master-bin.000001 26392 Query 1 26483 use `test`; insert into t1 values( 113 ) +master-bin.000001 26483 Query 1 26574 use `test`; insert into t1 values( 112 ) +master-bin.000001 26574 Query 1 26665 use `test`; insert into t1 values( 111 ) +master-bin.000001 26665 Query 1 26756 use `test`; insert into t1 values( 110 ) +master-bin.000001 26756 Query 1 26847 use `test`; insert into t1 values( 109 ) +master-bin.000001 26847 Query 1 26938 use `test`; insert into t1 values( 108 ) +master-bin.000001 26938 Query 1 27029 use `test`; insert into t1 values( 107 ) +master-bin.000001 27029 Query 1 27120 use `test`; insert into t1 values( 106 ) +master-bin.000001 27120 Query 1 27211 use `test`; insert into t1 values( 105 ) +master-bin.000001 27211 Query 1 27302 use `test`; insert into t1 values( 104 ) +master-bin.000001 27302 Query 1 27393 use `test`; insert into t1 values( 103 ) +master-bin.000001 27393 Query 1 27484 use `test`; insert into t1 values( 102 ) +master-bin.000001 27484 Query 1 27575 use `test`; insert into t1 values( 101 ) +master-bin.000001 27575 Query 1 27666 use `test`; insert into t1 values( 100 ) +master-bin.000001 27666 Query 1 27756 use `test`; insert into t1 values( 99 ) +master-bin.000001 27756 Query 1 27846 use `test`; insert into t1 values( 98 ) +master-bin.000001 27846 Query 1 27936 use `test`; insert into t1 values( 97 ) +master-bin.000001 27936 Query 1 28026 use `test`; insert into t1 values( 96 ) +master-bin.000001 28026 Query 1 28116 use `test`; insert into t1 values( 95 ) +master-bin.000001 28116 Query 1 28206 use `test`; insert into t1 values( 94 ) +master-bin.000001 28206 Query 1 28296 use `test`; insert into t1 values( 93 ) +master-bin.000001 28296 Query 1 28386 use `test`; insert into t1 values( 92 ) +master-bin.000001 28386 Query 1 28476 use `test`; insert into t1 values( 91 ) +master-bin.000001 28476 Query 1 28566 use `test`; insert into t1 values( 90 ) +master-bin.000001 28566 Query 1 28656 use `test`; insert into t1 values( 89 ) +master-bin.000001 28656 Query 1 28746 use `test`; insert into t1 values( 88 ) +master-bin.000001 28746 Query 1 28836 use `test`; insert into t1 values( 87 ) +master-bin.000001 28836 Query 1 28926 use `test`; insert into t1 values( 86 ) +master-bin.000001 28926 Query 1 29016 use `test`; insert into t1 values( 85 ) +master-bin.000001 29016 Query 1 29106 use `test`; insert into t1 values( 84 ) +master-bin.000001 29106 Query 1 29196 use `test`; insert into t1 values( 83 ) +master-bin.000001 29196 Query 1 29286 use `test`; insert into t1 values( 82 ) +master-bin.000001 29286 Query 1 29376 use `test`; insert into t1 values( 81 ) +master-bin.000001 29376 Query 1 29466 use `test`; insert into t1 values( 80 ) +master-bin.000001 29466 Query 1 29556 use `test`; insert into t1 values( 79 ) +master-bin.000001 29556 Query 1 29646 use `test`; insert into t1 values( 78 ) +master-bin.000001 29646 Query 1 29736 use `test`; insert into t1 values( 77 ) +master-bin.000001 29736 Query 1 29826 use `test`; insert into t1 values( 76 ) +master-bin.000001 29826 Query 1 29916 use `test`; insert into t1 values( 75 ) +master-bin.000001 29916 Query 1 30006 use `test`; insert into t1 values( 74 ) +master-bin.000001 30006 Query 1 30096 use `test`; insert into t1 values( 73 ) +master-bin.000001 30096 Query 1 30186 use `test`; insert into t1 values( 72 ) +master-bin.000001 30186 Query 1 30276 use `test`; insert into t1 values( 71 ) +master-bin.000001 30276 Query 1 30366 use `test`; insert into t1 values( 70 ) +master-bin.000001 30366 Query 1 30456 use `test`; insert into t1 values( 69 ) +master-bin.000001 30456 Query 1 30546 use `test`; insert into t1 values( 68 ) +master-bin.000001 30546 Query 1 30636 use `test`; insert into t1 values( 67 ) +master-bin.000001 30636 Query 1 30726 use `test`; insert into t1 values( 66 ) +master-bin.000001 30726 Query 1 30816 use `test`; insert into t1 values( 65 ) +master-bin.000001 30816 Query 1 30906 use `test`; insert into t1 values( 64 ) +master-bin.000001 30906 Query 1 30996 use `test`; insert into t1 values( 63 ) +master-bin.000001 30996 Query 1 31086 use `test`; insert into t1 values( 62 ) +master-bin.000001 31086 Query 1 31176 use `test`; insert into t1 values( 61 ) +master-bin.000001 31176 Query 1 31266 use `test`; insert into t1 values( 60 ) +master-bin.000001 31266 Query 1 31356 use `test`; insert into t1 values( 59 ) +master-bin.000001 31356 Query 1 31446 use `test`; insert into t1 values( 58 ) +master-bin.000001 31446 Query 1 31536 use `test`; insert into t1 values( 57 ) +master-bin.000001 31536 Query 1 31626 use `test`; insert into t1 values( 56 ) +master-bin.000001 31626 Query 1 31716 use `test`; insert into t1 values( 55 ) +master-bin.000001 31716 Query 1 31806 use `test`; insert into t1 values( 54 ) +master-bin.000001 31806 Query 1 31896 use `test`; insert into t1 values( 53 ) +master-bin.000001 31896 Query 1 31986 use `test`; insert into t1 values( 52 ) +master-bin.000001 31986 Query 1 32076 use `test`; insert into t1 values( 51 ) +master-bin.000001 32076 Query 1 32166 use `test`; insert into t1 values( 50 ) +master-bin.000001 32166 Query 1 32256 use `test`; insert into t1 values( 49 ) +master-bin.000001 32256 Query 1 32346 use `test`; insert into t1 values( 48 ) +master-bin.000001 32346 Query 1 32436 use `test`; insert into t1 values( 47 ) +master-bin.000001 32436 Query 1 32526 use `test`; insert into t1 values( 46 ) +master-bin.000001 32526 Query 1 32616 use `test`; insert into t1 values( 45 ) +master-bin.000001 32616 Query 1 32706 use `test`; insert into t1 values( 44 ) +master-bin.000001 32706 Query 1 32796 use `test`; insert into t1 values( 43 ) +master-bin.000001 32796 Query 1 32886 use `test`; insert into t1 values( 42 ) +master-bin.000001 32886 Query 1 32976 use `test`; insert into t1 values( 41 ) +master-bin.000001 32976 Query 1 33066 use `test`; insert into t1 values( 40 ) +master-bin.000001 33066 Query 1 33156 use `test`; insert into t1 values( 39 ) +master-bin.000001 33156 Query 1 33246 use `test`; insert into t1 values( 38 ) +master-bin.000001 33246 Query 1 33336 use `test`; insert into t1 values( 37 ) +master-bin.000001 33336 Query 1 33426 use `test`; insert into t1 values( 36 ) +master-bin.000001 33426 Query 1 33516 use `test`; insert into t1 values( 35 ) +master-bin.000001 33516 Query 1 33606 use `test`; insert into t1 values( 34 ) +master-bin.000001 33606 Query 1 33696 use `test`; insert into t1 values( 33 ) +master-bin.000001 33696 Query 1 33786 use `test`; insert into t1 values( 32 ) +master-bin.000001 33786 Query 1 33876 use `test`; insert into t1 values( 31 ) +master-bin.000001 33876 Query 1 33966 use `test`; insert into t1 values( 30 ) +master-bin.000001 33966 Query 1 34056 use `test`; insert into t1 values( 29 ) +master-bin.000001 34056 Query 1 34146 use `test`; insert into t1 values( 28 ) +master-bin.000001 34146 Query 1 34236 use `test`; insert into t1 values( 27 ) +master-bin.000001 34236 Query 1 34326 use `test`; insert into t1 values( 26 ) +master-bin.000001 34326 Query 1 34416 use `test`; insert into t1 values( 25 ) +master-bin.000001 34416 Query 1 34506 use `test`; insert into t1 values( 24 ) +master-bin.000001 34506 Query 1 34596 use `test`; insert into t1 values( 23 ) +master-bin.000001 34596 Query 1 34686 use `test`; insert into t1 values( 22 ) +master-bin.000001 34686 Query 1 34776 use `test`; insert into t1 values( 21 ) +master-bin.000001 34776 Query 1 34866 use `test`; insert into t1 values( 20 ) +master-bin.000001 34866 Query 1 34956 use `test`; insert into t1 values( 19 ) +master-bin.000001 34956 Query 1 35046 use `test`; insert into t1 values( 18 ) +master-bin.000001 35046 Query 1 35136 use `test`; insert into t1 values( 17 ) +master-bin.000001 35136 Query 1 35226 use `test`; insert into t1 values( 16 ) +master-bin.000001 35226 Query 1 35316 use `test`; insert into t1 values( 15 ) +master-bin.000001 35316 Query 1 35406 use `test`; insert into t1 values( 14 ) +master-bin.000001 35406 Query 1 35496 use `test`; insert into t1 values( 13 ) +master-bin.000001 35496 Query 1 35586 use `test`; insert into t1 values( 12 ) +master-bin.000001 35586 Query 1 35676 use `test`; insert into t1 values( 11 ) +master-bin.000001 35676 Query 1 35766 use `test`; insert into t1 values( 10 ) +master-bin.000001 35766 Query 1 35855 use `test`; insert into t1 values( 9 ) +master-bin.000001 35855 Query 1 35944 use `test`; insert into t1 values( 8 ) +master-bin.000001 35944 Query 1 36033 use `test`; insert into t1 values( 7 ) +master-bin.000001 36033 Query 1 36122 use `test`; insert into t1 values( 6 ) +master-bin.000001 36122 Query 1 36211 use `test`; insert into t1 values( 5 ) +master-bin.000001 36211 Query 1 36300 use `test`; insert into t1 values( 4 ) +master-bin.000001 36300 Query 1 36389 use `test`; insert into t1 values( 3 ) +master-bin.000001 36389 Query 1 36478 use `test`; insert into t1 values( 2 ) +master-bin.000001 36478 Query 1 36567 use `test`; insert into t1 values( 1 ) +master-bin.000001 36567 Xid 1 36594 COMMIT /* XID */ +master-bin.000001 36594 Rotate 1 36638 master-bin.000002;pos=4 drop table t1; set global binlog_cache_size=@bcs; set session autocommit = @ac; @@ -590,10 +590,10 @@ deallocate prepare stmt; drop table t1; show binlog events from 0; Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 4 Format_desc 1 106 Server version, Binlog ver: 4 -master-bin.000001 106 Query 1 227 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned) -master-bin.000001 227 Query 1 351 use `test`; insert into t1 values (9999999999999999,14632475938453979136) -master-bin.000001 351 Query 1 427 use `test`; drop table t1 +master-bin.000001 4 Format_desc 1 107 Server version, Binlog ver: 4 +master-bin.000001 107 Query 1 228 use `test`; create table t1 (a bigint unsigned, b bigint(20) unsigned) +master-bin.000001 228 Query 1 352 use `test`; insert into t1 values (9999999999999999,14632475938453979136) +master-bin.000001 352 Query 1 428 use `test`; drop table t1 reset master; CREATE DATABASE bug39182 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; USE bug39182; diff --git a/mysql-test/suite/binlog/t/binlog_incident.test b/mysql-test/suite/binlog/t/binlog_incident.test index 208c7f24df2..37566e71b53 100644 --- a/mysql-test/suite/binlog/t/binlog_incident.test +++ b/mysql-test/suite/binlog/t/binlog_incident.test @@ -19,9 +19,9 @@ REPLACE INTO t1 VALUES (4); DROP TABLE t1; FLUSH LOGS; -exec $MYSQL_BINLOG --start-position=106 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; +exec $MYSQL_BINLOG --start-position=107 $MYSQLD_DATADIR/master-bin.000001 >$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; --disable_query_log eval SELECT cont LIKE '%RELOAD DATABASE; # Shall generate syntax error%' AS `Contain RELOAD DATABASE` FROM (SELECT load_file('$MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql') AS cont) AS tbl; --enable_query_log -remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; \ No newline at end of file +remove_file $MYSQLTEST_VARDIR/tmp/binlog_incident-bug44442.sql; diff --git a/mysql-test/suite/rpl/r/rpl_000015.result b/mysql-test/suite/rpl/r/rpl_000015.result index 03b96d5870b..d6cb544df7c 100644 --- a/mysql-test/suite/rpl/r/rpl_000015.result +++ b/mysql-test/suite/rpl/r/rpl_000015.result @@ -44,6 +44,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 0 change master to master_host='127.0.0.1',master_user='root', master_password='',master_port=MASTER_PORT; SHOW SLAVE STATUS; @@ -85,6 +87,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 0 start slave; SHOW SLAVE STATUS; Slave_IO_State # @@ -125,6 +129,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 drop table if exists t1; create table t1 (n int, PRIMARY KEY(n)); insert into t1 values (10),(45),(90); diff --git a/mysql-test/suite/rpl/r/rpl_bug33931.result b/mysql-test/suite/rpl/r/rpl_bug33931.result index a17941f6ba9..ba3c3ebafe6 100644 --- a/mysql-test/suite/rpl/r/rpl_bug33931.result +++ b/mysql-test/suite/rpl/r/rpl_bug33931.result @@ -43,4 +43,6 @@ Last_IO_Errno 0 Last_IO_Error Last_SQL_Errno # Last_SQL_Error Failed during slave thread initialization +Replicate_Ignore_Server_Ids +Master_Server_Id 0 SET GLOBAL debug=""; diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result index c06c1201e3d..7bc5473c46e 100644 --- a/mysql-test/suite/rpl/r/rpl_change_master.result +++ b/mysql-test/suite/rpl/r/rpl_change_master.result @@ -50,6 +50,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 change master to master_user='root'; SHOW SLAVE STATUS; Slave_IO_State # @@ -90,6 +92,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave; select * from t1; n diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result index 9b54498d809..25c31675b53 100644 --- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result @@ -89,6 +89,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 *** Test lock wait timeout *** include/stop_slave.inc @@ -151,6 +153,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 *** Test lock wait timeout and purged relay logs *** SET @my_max_relay_log_size= @@global.max_relay_log_size; @@ -218,6 +222,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 *** Clean up *** DROP TABLE t1,t2,t3; diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result index fd208055bea..9f30d44eeab 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_innodb.result @@ -93,6 +93,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -160,6 +162,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t3 *** @@ -222,6 +226,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t4 *** @@ -284,6 +290,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t5 *** @@ -345,6 +353,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** DROP TABLE t6; @@ -454,6 +464,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1364 Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 331 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Create t10 on slave *** @@ -513,6 +525,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t10 *** @@ -574,6 +588,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t11 *** @@ -824,6 +840,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1060 Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; *** Try to insert in master **** @@ -964,6 +982,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; ** DROP table t17 *** diff --git a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result index e50caa8861e..6f4dad3628b 100644 --- a/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extraCol_myisam.result @@ -93,6 +93,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -160,6 +162,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t3 *** @@ -222,6 +226,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t4 *** @@ -284,6 +290,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t5 *** @@ -345,6 +353,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** DROP TABLE t6; @@ -454,6 +464,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1364 Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 331 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Create t10 on slave *** @@ -513,6 +525,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t10 *** @@ -574,6 +588,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t11 *** @@ -824,6 +840,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1060 Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; *** Try to insert in master **** @@ -964,6 +982,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; ** DROP table t17 *** diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result index ad67f96db71..ffc42c852be 100644 --- a/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_innodb.result @@ -133,6 +133,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ***** Testing Altering table def scenario ***** @@ -509,6 +511,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 **************************************** * columns in master at middle of table * @@ -583,6 +587,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -658,6 +664,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -809,6 +817,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1091 Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -895,6 +905,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1054 Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -981,6 +993,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1072 Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -1274,6 +1288,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ***** Testing Altering table def scenario ***** @@ -1650,6 +1666,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 **************************************** * columns in master at middle of table * @@ -1724,6 +1742,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -1799,6 +1819,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -1950,6 +1972,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1091 Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -2036,6 +2060,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1054 Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -2122,6 +2148,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1072 Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -2415,6 +2443,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ***** Testing Altering table def scenario ***** @@ -2791,6 +2821,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 **************************************** * columns in master at middle of table * @@ -2865,6 +2897,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -2940,6 +2974,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -3091,6 +3127,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1091 Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -3177,6 +3215,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1054 Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -3263,6 +3303,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1072 Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result index 8859a8e24e3..0c3dd7ed21d 100644 --- a/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result +++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_myisam.result @@ -133,6 +133,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ***** Testing Altering table def scenario ***** @@ -509,6 +511,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 **************************************** * columns in master at middle of table * @@ -583,6 +587,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -658,6 +664,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -809,6 +817,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1091 Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -895,6 +905,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1054 Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -981,6 +993,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1072 Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -1274,6 +1288,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ***** Testing Altering table def scenario ***** @@ -1650,6 +1666,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 **************************************** * columns in master at middle of table * @@ -1724,6 +1742,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -1799,6 +1819,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -1950,6 +1972,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1091 Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -2036,6 +2060,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1054 Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -2122,6 +2148,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1072 Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -2415,6 +2443,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ***** Testing Altering table def scenario ***** @@ -2791,6 +2821,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 **************************************** * columns in master at middle of table * @@ -2865,6 +2897,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -2940,6 +2974,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -3091,6 +3127,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1091 Last_SQL_Error Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -3177,6 +3215,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1054 Last_SQL_Error Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; @@ -3263,6 +3303,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1072 Last_SQL_Error Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result index 600ac44fc86..3ebd1ac27a4 100644 --- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result +++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result @@ -59,3 +59,5 @@ Last_IO_Errno # Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 2 diff --git a/mysql-test/suite/rpl/r/rpl_grant.result b/mysql-test/suite/rpl/r/rpl_grant.result index 1bed6101e3c..fc32dcefec7 100644 --- a/mysql-test/suite/rpl/r/rpl_grant.result +++ b/mysql-test/suite/rpl/r/rpl_grant.result @@ -80,3 +80,5 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat.result b/mysql-test/suite/rpl/r/rpl_heartbeat.result index 5775351c33d..3bd2ad108ca 100644 --- a/mysql-test/suite/rpl/r/rpl_heartbeat.result +++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result @@ -92,6 +92,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 @@ -131,6 +133,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 show status like 'Slave_heartbeat_period';; Variable_name Slave_heartbeat_period Value 0.500 diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result index c3baabbdbc3..a9b641b243b 100644 --- a/mysql-test/suite/rpl/r/rpl_incident.result +++ b/mysql-test/suite/rpl/r/rpl_incident.result @@ -64,6 +64,8 @@ Last_IO_Errno 0 Last_IO_Error Last_SQL_Errno 1590 Last_SQL_Error The incident LOST_EVENTS occured on the master. Message: +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; SELECT * FROM t1; @@ -111,4 +113,6 @@ Last_IO_Errno 0 Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result index 3055216cbd9..7f346070290 100644 --- a/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result +++ b/mysql-test/suite/rpl/r/rpl_known_bugs_detection.result @@ -50,6 +50,8 @@ Last_IO_Errno 0 Last_IO_Error Last_SQL_Errno 1105 Last_SQL_Error Error 'master may suffer from http://bugs.mysql.com/bug.php?id=24432 so slave stops; check error log on slave for more info' on query. Default database: 'test'. Query: 'INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT * FROM t1; a b stop slave; @@ -141,6 +143,8 @@ SELECT t2.field_a, t2.field_b, t2.field_c FROM t2 ON DUPLICATE KEY UPDATE t1.field_3 = t2.field_c' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT * FROM t1; id field_1 field_2 field_3 drop table t1, t2; diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result index 141bbaeb95e..35fac3bd076 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata.result @@ -73,6 +73,8 @@ Last_IO_Errno 0 Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 set sql_log_bin=0; delete from t1; set sql_log_bin=1; @@ -119,6 +121,8 @@ Last_IO_Errno 0 Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 set global sql_slave_skip_counter=1; start slave; set sql_log_bin=0; @@ -166,6 +170,8 @@ Last_IO_Errno 0 Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 reset master; create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60), unique(day)) engine=MyISAM; diff --git a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result index cb2accc86ca..bbf4b9f97d4 100644 --- a/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result +++ b/mysql-test/suite/rpl/r/rpl_loaddata_fatal.result @@ -45,6 +45,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 LOAD DATA INFILE '../../std_data/rpl_loaddata.dat' INTO TABLE t1; SHOW SLAVE STATUS; Slave_IO_State # @@ -85,6 +87,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1593 Last_SQL_Error Fatal error: Not enough memory +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result index 7b3ebf62959..e490468059d 100644 --- a/mysql-test/suite/rpl/r/rpl_log_pos.result +++ b/mysql-test/suite/rpl/r/rpl_log_pos.result @@ -48,6 +48,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave; include/stop_slave.inc SHOW SLAVE STATUS; @@ -89,6 +91,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 show master status; File Position Binlog_Do_DB Binlog_Ignore_DB master-bin.000001 # diff --git a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result index 59726ea5661..53e8899d27f 100644 --- a/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result +++ b/mysql-test/suite/rpl/r/rpl_rbr_to_sbr.result @@ -63,6 +63,8 @@ Last_IO_Errno # Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SHOW BINLOG EVENTS; Log_name Pos Event_type Server_id End_log_pos Info slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4 diff --git a/mysql-test/suite/rpl/r/rpl_replicate_do.result b/mysql-test/suite/rpl/r/rpl_replicate_do.result index 33088ee2ec8..2fbd283a9c8 100644 --- a/mysql-test/suite/rpl/r/rpl_replicate_do.result +++ b/mysql-test/suite/rpl/r/rpl_replicate_do.result @@ -65,6 +65,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 create table t1 (ts timestamp); set one_shot time_zone='met'; insert into t1 values('2005-08-12 00:00:00'); diff --git a/mysql-test/suite/rpl/r/rpl_rotate_logs.result b/mysql-test/suite/rpl/r/rpl_rotate_logs.result index 013ba87ec0b..b3b1480a740 100644 --- a/mysql-test/suite/rpl/r/rpl_rotate_logs.result +++ b/mysql-test/suite/rpl/r/rpl_rotate_logs.result @@ -53,6 +53,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 select * from t1; s Could not break slave @@ -132,6 +134,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 select * from t2; m 34 @@ -196,6 +200,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 lock tables t3 read; select count(*) from t3 where n >= 4; count(*) diff --git a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result index 6d002a722f1..acda689ca9b 100644 --- a/mysql-test/suite/rpl/r/rpl_row_colSize.result +++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result @@ -57,6 +57,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -111,6 +113,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 12, test.t1 on slave has size 12. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -165,6 +169,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 10, test.t1 on slave has size 3. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -220,6 +226,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 5, test.t1 has type 4 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -275,6 +283,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 8, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -329,6 +339,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 2. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -384,6 +396,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -439,6 +453,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 20, test.t1 on slave has size 11. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -525,6 +541,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -580,6 +598,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 100. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -634,6 +654,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 200, test.t1 on slave has size 10. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -688,6 +710,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 2000, test.t1 on slave has size 1000. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 @@ -743,6 +767,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 size mismatch - master has size 4, test.t1 on slave has size 1. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT COUNT(*) FROM t1; COUNT(*) 0 diff --git a/mysql-test/suite/rpl/r/rpl_row_log.result b/mysql-test/suite/rpl/r/rpl_row_log.result index ca8fba3b6bd..789db064eb5 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log.result +++ b/mysql-test/suite/rpl/r/rpl_row_log.result @@ -283,6 +283,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result index 9347f87ef8f..fbd9f685ba9 100644 --- a/mysql-test/suite/rpl/r/rpl_row_log_innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_log_innodb.result @@ -283,6 +283,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result index 2215b34814e..c2554218f73 100644 --- a/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result +++ b/mysql-test/suite/rpl/r/rpl_row_max_relay_size.result @@ -60,6 +60,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 2 # @@ -108,6 +110,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 3: max_relay_log_size = 0 # @@ -156,6 +160,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions # @@ -201,6 +207,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 5 # @@ -247,6 +255,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated # @@ -291,6 +301,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result index fa40d8760a8..501749e12f9 100644 --- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result +++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result @@ -43,6 +43,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 stop slave; change master to master_user='test'; SHOW SLAVE STATUS; @@ -84,6 +86,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 reset slave; SHOW SLAVE STATUS; Slave_IO_State # @@ -124,6 +128,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave; SHOW SLAVE STATUS; Slave_IO_State # @@ -164,6 +170,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 stop slave; reset slave; start slave; diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result index a6a2181cd2a..4cb632da9e1 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result @@ -144,6 +144,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 1364 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; INSERT INTO t9 VALUES (2); @@ -195,6 +197,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 INSERT INTO t9 VALUES (4); INSERT INTO t4 VALUES (4); SHOW SLAVE STATUS; @@ -236,6 +240,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 1535 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; INSERT INTO t9 VALUES (5); @@ -279,6 +285,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 1535 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; INSERT INTO t9 VALUES (6); @@ -322,6 +330,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 1535 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; INSERT INTO t9 VALUES (6); @@ -364,6 +374,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); SELECT * FROM t7 ORDER BY a; diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result index 02e8c074354..a293bfed0d5 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result @@ -144,6 +144,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 1364 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; INSERT INTO t9 VALUES (2); @@ -195,6 +197,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 INSERT INTO t9 VALUES (4); INSERT INTO t4 VALUES (4); SHOW SLAVE STATUS; @@ -236,6 +240,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 1535 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; INSERT INTO t9 VALUES (5); @@ -279,6 +285,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 1535 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; INSERT INTO t9 VALUES (6); @@ -322,6 +330,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 1535 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; INSERT INTO t9 VALUES (6); @@ -364,6 +374,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 INSERT INTO t7 VALUES (1),(2),(3); INSERT INTO t8 VALUES (1),(2),(3); SELECT * FROM t7 ORDER BY a; diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result index ad54450af74..e878456e296 100644 --- a/mysql-test/suite/rpl/r/rpl_row_until.result +++ b/mysql-test/suite/rpl/r/rpl_row_until.result @@ -59,6 +59,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291; SELECT * FROM t1; n @@ -105,6 +107,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', RELAY_LOG_POS=relay_pos_insert1_t2 SELECT * FROM t2; n @@ -149,6 +153,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 START SLAVE; include/stop_slave.inc START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2 @@ -191,6 +197,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 START SLAVE UNTIL MASTER_LOG_FILE='master-bin', MASTER_LOG_POS=561; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=561, RELAY_LOG_POS=12; diff --git a/mysql-test/suite/rpl/r/rpl_skip_error.result b/mysql-test/suite/rpl/r/rpl_skip_error.result index d955859f030..7b2bd48515d 100644 --- a/mysql-test/suite/rpl/r/rpl_skip_error.result +++ b/mysql-test/suite/rpl/r/rpl_skip_error.result @@ -70,6 +70,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ==== Clean Up ==== drop table t1; create table t1(a int primary key); @@ -123,6 +125,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ==== Clean Up ==== drop table t1; ==== Using Innodb ==== diff --git a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result index e2efcf08d7a..880fc9e8569 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result +++ b/mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result @@ -49,6 +49,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 9 Last_SQL_Error Error in Begin_load_query event: write to '../../tmp/SQL_LOAD.data' failed +Replicate_Ignore_Server_Ids +Master_Server_Id 1 drop table t1; drop table t1; call mtr.add_suppression("Slave: Error writing file 'UNKNOWN' .Errcode: 9. Error_code: 3"); diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result index 41076f9fee3..5a37344cac6 100644 --- a/mysql-test/suite/rpl/r/rpl_slave_skip.result +++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result @@ -82,6 +82,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; SELECT * FROM t1; @@ -146,6 +148,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 **** On Master **** DROP TABLE t1, t2; SET SESSION BINLOG_FORMAT=ROW; diff --git a/mysql-test/suite/rpl/r/rpl_ssl.result b/mysql-test/suite/rpl/r/rpl_ssl.result index d188dd353ce..c8e9e1a4911 100644 --- a/mysql-test/suite/rpl/r/rpl_ssl.result +++ b/mysql-test/suite/rpl/r/rpl_ssl.result @@ -58,6 +58,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; select * from t1; t @@ -102,6 +104,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 drop user replssl@localhost; drop table t1; End of 5.0 tests diff --git a/mysql-test/suite/rpl/r/rpl_ssl1.result b/mysql-test/suite/rpl/r/rpl_ssl1.result index 74d2550cdaf..de255228aff 100644 --- a/mysql-test/suite/rpl/r/rpl_ssl1.result +++ b/mysql-test/suite/rpl/r/rpl_ssl1.result @@ -57,6 +57,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 stop slave; change master to master_user='root',master_password='', master_ssl=0; start slave; @@ -101,6 +103,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 stop slave; change master to master_host="localhost", @@ -155,4 +159,6 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_stm_log.result b/mysql-test/suite/rpl/r/rpl_stm_log.result index 61eba2b4b3f..97dfbb618e2 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_log.result +++ b/mysql-test/suite/rpl/r/rpl_stm_log.result @@ -265,6 +265,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; diff --git a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result index 2215b34814e..c2554218f73 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result +++ b/mysql-test/suite/rpl/r/rpl_stm_max_relay_size.result @@ -60,6 +60,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 2 # @@ -108,6 +110,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 3: max_relay_log_size = 0 # @@ -156,6 +160,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions # @@ -201,6 +207,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 5 # @@ -247,6 +255,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 # # Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated # @@ -291,6 +301,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 flush logs; show master status; File Position Binlog_Do_DB Binlog_Ignore_DB diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result index 78d9d7c41eb..d18ca563b7b 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result +++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result @@ -43,6 +43,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 stop slave; change master to master_user='test'; SHOW SLAVE STATUS; @@ -84,6 +86,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 reset slave; SHOW SLAVE STATUS; Slave_IO_State # @@ -124,6 +128,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave; SHOW SLAVE STATUS; Slave_IO_State # @@ -164,6 +170,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 stop slave; reset slave; start slave; diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result index 55074f0be0d..6af9be0da3b 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_until.result +++ b/mysql-test/suite/rpl/r/rpl_stm_until.result @@ -63,6 +63,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291; select * from t1; n @@ -109,6 +111,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746; select * from t2; n @@ -153,6 +157,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 start slave; [on master] [on slave] @@ -197,6 +203,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 ==== Test various error conditions ==== start slave until master_log_file='master-bin', master_log_pos=561; ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL diff --git a/mysql-test/suite/rpl/r/rpl_temporary_errors.result b/mysql-test/suite/rpl/r/rpl_temporary_errors.result index d14380a6369..f4626304fc3 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary_errors.result +++ b/mysql-test/suite/rpl/r/rpl_temporary_errors.result @@ -79,6 +79,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 DROP TABLE t1; **** On Master **** DROP TABLE t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result index b16a63ec5ad..6680f3fd70f 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_basic.result @@ -179,6 +179,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 set GLOBAL slave_transaction_retries=10; include/start_slave.inc select * from t1 order by nid; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result index 2daacb351a9..aeb9e215d15 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular.result @@ -56,6 +56,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT * FROM t1 ORDER BY a; a b 1 2 @@ -99,5 +101,7 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 2 STOP SLAVE; DROP TABLE t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result index 01f8d94da48..19439c4c0e1 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_circular_simplex.result @@ -53,6 +53,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 2 SELECT * FROM t1 ORDER BY a; a b 1 2 @@ -102,3 +104,5 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result index f812509de6f..771f44e4279 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_extraCol.result @@ -93,6 +93,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size. +Replicate_Ignore_Server_Ids +Master_Server_Id 1 STOP SLAVE; RESET SLAVE; SELECT * FROM t2 ORDER BY a; @@ -160,6 +162,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t3 *** @@ -222,6 +226,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t4 *** @@ -284,6 +290,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t5 *** @@ -345,6 +353,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3; *** Drop t6 *** DROP TABLE t6; @@ -454,6 +464,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1364 Last_SQL_Error Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 447 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Create t10 on slave *** @@ -513,6 +525,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t10 *** @@ -574,6 +588,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; *** Drop t11 *** @@ -824,6 +840,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1060 Last_SQL_Error Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5' +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE; *** Try to insert in master **** @@ -964,6 +982,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 1535 Last_SQL_Error Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2 +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; ** DROP table t17 *** diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result index e2fee391bab..2df70ace0c1 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_idempotent.result @@ -33,15 +33,15 @@ c1 c2 c3 row3 C 3 row4 D 4 SHOW SLAVE STATUS; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error - 127.0.0.1 root MASTER_PORT 1 master-bin.000001 master-bin.000001 Yes Yes 0 0 None 0 No No 0 +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id + 127.0.0.1 root MASTER_PORT 1 master-bin.000001 master-bin.000001 Yes Yes 0 0 None 0 No No 0 1 STOP SLAVE; CHANGE MASTER TO master_log_file = 'master-bin.000001', master_log_pos = ; SHOW SLAVE STATUS; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error - 127.0.0.1 root MASTER_PORT 1 master-bin.000001 master-bin.000001 No No 0 0 None 0 No No 0 +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id + 127.0.0.1 root MASTER_PORT 1 master-bin.000001 master-bin.000001 No No 0 0 None 0 No No 0 1 START SLAVE; SELECT * FROM t1 ORDER BY c3; c1 c2 c3 @@ -68,6 +68,6 @@ SELECT * FROM t1; c1 c2 c3 row2 new on slave 2 SHOW SLAVE STATUS; -Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error - 127.0.0.1 root MASTER_PORT 1 master-bin.000001 master-bin.000001 Yes Yes 0 0 None 0 No 0 +Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id + 127.0.0.1 root MASTER_PORT 1 master-bin.000001 master-bin.000001 Yes Yes 0 0 None 0 No 0 1 DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result index 3ef5e2b7e53..b61f5550719 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sync.result @@ -107,6 +107,8 @@ Last_IO_Errno Last_IO_Error Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3; hex(c1) hex(c2) c3 1 1 row1 diff --git a/mysql-test/t/ctype_cp932_binlog_stm.test b/mysql-test/t/ctype_cp932_binlog_stm.test index 19f44695f28..af6e6baf92a 100644 --- a/mysql-test/t/ctype_cp932_binlog_stm.test +++ b/mysql-test/t/ctype_cp932_binlog_stm.test @@ -33,7 +33,7 @@ delimiter ;| # the log's contents) that caused the server crash. --error 1220 -SHOW BINLOG EVENTS FROM 365; +SHOW BINLOG EVENTS FROM 366; --echo Bug#44352 UPPER/LOWER function doesn't work correctly on cp932 and sjis environment. CREATE TABLE t1 (a varchar(16)) character set cp932; diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 597c9671053..015d4d152cb 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -119,7 +119,7 @@ select "--- reading stdin --" as ""; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ ---exec $MYSQL_BINLOG --short-form --position=80 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 +--exec $MYSQL_BINLOG --short-form --position=79 - < $MYSQL_TEST_DIR/std_data/trunc_binlog.000001 drop table t1,t2; # diff --git a/sql/lex.h b/sql/lex.h index 790808a8c14..0a61a92fd60 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -244,6 +244,7 @@ static SYMBOL symbols[] = { { "IDENTIFIED", SYM(IDENTIFIED_SYM)}, { "IF", SYM(IF)}, { "IGNORE", SYM(IGNORE_SYM)}, + { "IGNORE_SERVER_IDS", SYM(IGNORE_SERVER_IDS_SYM)}, { "IMPORT", SYM(IMPORT)}, { "IN", SYM(IN_SYM)}, { "INDEX", SYM(INDEX_SYM)}, diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 77f7b7e1929..a50f75d53e3 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -27,17 +27,19 @@ int init_intvar_from_file(int* var, IO_CACHE* f, int default_val); int init_strvar_from_file(char *var, int max_size, IO_CACHE *f, const char *default_val); int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val); +int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f); Master_info::Master_info() :Slave_reporting_capability("I/O"), ssl(0), ssl_verify_server_cert(0), fd(-1), io_thd(0), inited(0), abort_slave(0),slave_running(0), slave_run_id(0), - heartbeat_period(0), received_heartbeats(0) + heartbeat_period(0), received_heartbeats(0), master_id(0) { host[0] = 0; user[0] = 0; password[0] = 0; ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0; ssl_cipher[0]= 0; ssl_key[0]= 0; + my_init_dynamic_array(&ignore_server_ids, sizeof(::server_id), 16, 16); bzero((char*) &file, sizeof(file)); pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST); pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST); @@ -48,6 +50,7 @@ Master_info::Master_info() Master_info::~Master_info() { + delete_dynamic(&ignore_server_ids); pthread_mutex_destroy(&run_lock); pthread_mutex_destroy(&data_lock); pthread_cond_destroy(&data_cond); @@ -55,6 +58,43 @@ Master_info::~Master_info() pthread_cond_destroy(&stop_cond); } +/** + A comparison function to be supplied as argument to @c sort_dynamic() + and @c bsearch() + + @return -1 if first argument is less, 0 if it equal to, 1 if it is greater + than the second +*/ +int change_master_server_id_cmp(ulong *id1, ulong *id2) +{ + return *id1 < *id2? -1 : (*id1 > *id2? 1 : 0); +} + + +/** + Reports if the s_id server has been configured to ignore events + it generates with + + CHANGE MASTER IGNORE_SERVER_IDS= ( list of server ids ) + + Method is called from the io thread event receiver filtering. + + @param s_id the master server identifier + + @retval TRUE if s_id is in the list of ignored master servers, + @retval FALSE otherwise. + */ +bool Master_info::shall_ignore_server_id(ulong s_id) +{ + if (likely(ignore_server_ids.elements == 1)) + return (* (ulong*) dynamic_array_ptr(&ignore_server_ids, 0)) == s_id; + else + return bsearch((const ulong *) &s_id, + ignore_server_ids.buffer, + ignore_server_ids.elements, sizeof(ulong), + (int (*) (const void*, const void*)) change_master_server_id_cmp) + != NULL; +} void init_master_info_with_options(Master_info* mi) { @@ -105,12 +145,12 @@ enum { /* 5.1.16 added value of master_ssl_verify_server_cert */ LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT= 15, - /* 6.0 added value of master_heartbeat_period */ LINE_FOR_MASTER_HEARTBEAT_PERIOD= 16, - + /* 6.0 added value of master_ignore_server_id */ + LINE_FOR_REPLICATE_IGNORE_SERVER_IDS= 17, /* Number of lines currently used when saving master info file */ - LINES_IN_MASTER_INFO= LINE_FOR_MASTER_HEARTBEAT_PERIOD + LINES_IN_MASTER_INFO= LINE_FOR_REPLICATE_IGNORE_SERVER_IDS }; int init_master_info(Master_info* mi, const char* master_info_fname, @@ -304,6 +344,16 @@ file '%s')", fname); if (lines >= LINE_FOR_MASTER_HEARTBEAT_PERIOD && init_floatvar_from_file(&master_heartbeat_period, &mi->file, 0.0)) goto errwithmsg; + /* + Starting from 6.0 list of server_id of ignorable servers might be + in the file + */ + if (lines >= LINE_FOR_REPLICATE_IGNORE_SERVER_IDS && + init_dynarray_intvar_from_file(&mi->ignore_server_ids, &mi->file)) + { + sql_print_error("Failed to initialize master info ignore_server_ids"); + goto errwithmsg; + } } #ifndef HAVE_OPENSSL @@ -384,7 +434,29 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) if (flush_relay_log_cache && flush_io_cache(mi->rli.relay_log.get_log_file())) DBUG_RETURN(2); - + + /* + produce a line listing the total number and all the ignored server_id:s + */ + char* ignore_server_ids_buf; + { + ignore_server_ids_buf= + (char *) my_malloc((sizeof(::server_id) * 3 + 1) * + (1 + mi->ignore_server_ids.elements), MYF(MY_WME)); + if (!ignore_server_ids_buf) + DBUG_RETURN(1); + for (ulong i= 0, cur_len= my_sprintf(ignore_server_ids_buf, + (ignore_server_ids_buf, "%u", + mi->ignore_server_ids.elements)); + i < mi->ignore_server_ids.elements; i++) + { + ulong s_id; + get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i); + cur_len +=my_sprintf(ignore_server_ids_buf + cur_len, + (ignore_server_ids_buf + cur_len, + " %lu", s_id)); + } + } /* We flushed the relay log BEFORE the master.info file, because if we crash now, we will get a duplicate event in the relay log at restart. If we @@ -405,14 +477,16 @@ int flush_master_info(Master_info* mi, bool flush_relay_log_cache) my_sprintf(heartbeat_buf, (heartbeat_buf, "%.3f", mi->heartbeat_period)); my_b_seek(file, 0L); my_b_printf(file, - "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n", + "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n%s\n%s\n", LINES_IN_MASTER_INFO, mi->master_log_name, llstr(mi->master_log_pos, lbuf), mi->host, mi->user, mi->password, mi->port, mi->connect_retry, (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert, mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert, - heartbeat_buf); + heartbeat_buf, ignore_server_ids_buf); + + my_free(ignore_server_ids_buf, MYF(0)); DBUG_RETURN(-flush_io_cache(file)); } diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h index 35e18414932..0caa6904da4 100644 --- a/sql/rpl_mi.h +++ b/sql/rpl_mi.h @@ -20,6 +20,7 @@ #include "rpl_rli.h" #include "rpl_reporting.h" +#include "my_sys.h" /***************************************************************************** @@ -60,6 +61,7 @@ class Master_info : public Slave_reporting_capability public: Master_info(); ~Master_info(); + bool shall_ignore_server_id(ulong s_id); /* the variables below are needed because we can change masters on the fly */ char master_log_name[FN_REFLEN]; @@ -83,8 +85,6 @@ class Master_info : public Slave_reporting_capability Relay_log_info rli; uint port; uint connect_retry; - float heartbeat_period; // interface with CHANGE MASTER or master.info - ulonglong received_heartbeats; // counter of received heartbeat events #ifndef DBUG_OFF int events_till_disconnect; #endif @@ -102,6 +102,10 @@ class Master_info : public Slave_reporting_capability */ long clock_diff_with_master; + float heartbeat_period; // interface with CHANGE MASTER or master.info + ulonglong received_heartbeats; // counter of received heartbeat events + DYNAMIC_ARRAY ignore_server_ids; + ulong master_id; }; void init_master_info_with_options(Master_info* mi); @@ -111,6 +115,7 @@ int init_master_info(Master_info* mi, const char* master_info_fname, int thread_mask); void end_master_info(Master_info* mi); int flush_master_info(Master_info* mi, bool flush_relay_log_cache); +int change_master_server_id_cmp(ulong *id1, ulong *id2); #endif /* HAVE_REPLICATION */ #endif /* RPL_MI_H */ diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 3aba434b284..18d3a41424a 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -6163,6 +6163,9 @@ ER_SLAVE_HEARTBEAT_FAILURE ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE eng "The requested value for the heartbeat period %s %s" +ER_SLAVE_IGNORE_SERVER_IDS + eng "The requested server id %d clashes with the slave startup option --replicate-same-server-id" + ER_NDB_REPLICATION_SCHEMA_ERROR eng "Bad schema for mysql.ndb_replication table. Message: %-.64s" ER_CONFLICT_FN_PARSE_ERROR diff --git a/sql/slave.cc b/sql/slave.cc index bbdfb8e633f..fe4a2f6ba0a 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -880,6 +880,95 @@ int init_floatvar_from_file(float* var, IO_CACHE* f, float default_val) DBUG_RETURN(1); } + +/** + A master info read method + + This function is called from @c init_master_info() along with + relatives to restore some of @c active_mi members. + Particularly, this function is responsible for restoring + IGNORE_SERVER_IDS list of servers whose events the slave is + going to ignore (to not log them in the relay log). + Items being read are supposed to be decimal output of values of a + type shorter or equal of @c long and separated by the single space. + + @param arr @c DYNAMIC_ARRAY pointer to storage for servers id + @param f @c IO_CACHE pointer to the source file + + @retval 0 All OK + @retval non-zero An error +*/ + +int init_dynarray_intvar_from_file(DYNAMIC_ARRAY* arr, IO_CACHE* f) +{ + int ret= 0; + char buf[16 * (sizeof(long)*4 + 1)]; // static buffer to use most of times + char *buf_act= buf; // actual buffer can be dynamic if static is short + char *token, *last; + uint num_items; // number of items of `arr' + size_t read_size; + DBUG_ENTER("init_dynarray_intvar_from_file"); + + if ((read_size= my_b_gets(f, buf_act, sizeof(buf))) == 0) + { + return 0; // no line in master.info + } + if (read_size + 1 == sizeof(buf) && buf[sizeof(buf) - 2] != '\n') + { + /* + short read happend; allocate sufficient memory and make the 2nd read + */ + char buf_work[(sizeof(long)*3 + 1)*16]; + memcpy(buf_work, buf, sizeof(buf_work)); + num_items= atoi(strtok_r(buf_work, " ", &last)); + size_t snd_size; + /* + max size lower bound approximate estimation bases on the formula: + (the items number + items themselves) * + (decimal size + space) - 1 + `\n' + '\0' + */ + size_t max_size= (1 + num_items) * (sizeof(long)*3 + 1) + 1; + buf_act= (char*) my_malloc(max_size, MYF(MY_WME)); + memcpy(buf_act, buf, read_size); + snd_size= my_b_gets(f, buf_act + read_size, max_size - read_size); + if (snd_size == 0 || + (snd_size + 1 == max_size - read_size) && buf[max_size - 2] != '\n') + { + /* + failure to make the 2nd read or short read again + */ + ret= 1; + goto err; + } + } + token= strtok_r(buf_act, " ", &last); + if (token == NULL) + { + ret= 1; + goto err; + } + num_items= atoi(token); + for (uint i=0; i < num_items; i++) + { + token= strtok_r(NULL, " ", &last); + if (token == NULL) + { + ret= 1; + goto err; + } + else + { + ulong val= atol(token); + insert_dynamic(arr, (uchar *) &val); + } + } +err: + if (buf_act != buf) + my_free(buf_act, MYF(0)); + DBUG_RETURN(ret); +} + + static bool check_io_slave_killed(THD *thd, Master_info *mi, const char *info) { if (io_slave_killed(thd, mi)) @@ -1058,7 +1147,7 @@ static int get_master_version_and_clock(MYSQL* mysql, Master_info* mi) (master_res= mysql_store_result(mysql)) && (master_row= mysql_fetch_row(master_res))) { - if ((::server_id == strtoul(master_row[1], 0, 10)) && + if ((::server_id == (mi->master_id= strtoul(master_row[1], 0, 10))) && !mi->rli.replicate_same_server_id) { errmsg= "The slave I/O thread stops because master and slave have equal \ @@ -1096,6 +1185,13 @@ maybe it is a *VERY OLD MASTER*."); mysql_free_result(master_res); master_res= NULL; } + if (mi->master_id == 0 && mi->ignore_server_ids.elements > 0) + { + errmsg= "Slave configured with server id filtering could not detect the master server id."; + err_code= ER_SLAVE_FATAL_ERROR; + sprintf(err_buff, ER(err_code), errmsg); + goto err; + } /* Check that the master's global character_set_server and ours are the same. @@ -1659,6 +1755,10 @@ bool show_master_info(THD* thd, Master_info* mi) field_list.push_back(new Item_empty_string("Last_IO_Error", 20)); field_list.push_back(new Item_return_int("Last_SQL_Errno", 4, MYSQL_TYPE_LONG)); field_list.push_back(new Item_empty_string("Last_SQL_Error", 20)); + field_list.push_back(new Item_empty_string("Replicate_Ignore_Server_Ids", + FN_REFLEN)); + field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong), + MYSQL_TYPE_LONG)); if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) @@ -1780,6 +1880,32 @@ bool show_master_info(THD* thd, Master_info* mi) protocol->store(mi->rli.last_error().number); // Last_SQL_Error protocol->store(mi->rli.last_error().message, &my_charset_bin); + // Replicate_Ignore_Server_Ids + { + char buff[FN_REFLEN]; + ulong i, cur_len; + for (i= 0, buff[0]= 0, cur_len= 0; + i < mi->ignore_server_ids.elements; i++) + { + ulong s_id, slen; + char sbuff[FN_REFLEN]; + get_dynamic(&mi->ignore_server_ids, (uchar*) &s_id, i); + slen= my_sprintf(sbuff, (sbuff, (i==0? "%lu" : ", %lu"), s_id)); + if (cur_len + slen + 4 > FN_REFLEN) + { + /* + break the loop whenever remained space could not fit + ellipses on the next cycle + */ + my_sprintf(buff + cur_len, (buff + cur_len, "...")); + break; + } + cur_len += my_sprintf(buff + cur_len, (buff + cur_len, "%s", sbuff)); + } + protocol->store(buff, &my_charset_bin); + } + // Master_Server_id + protocol->store((uint32) mi->master_id); pthread_mutex_unlock(&mi->rli.err_lock); pthread_mutex_unlock(&mi->err_lock); @@ -3599,6 +3725,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) ulong inc_pos; Relay_log_info *rli= &mi->rli; pthread_mutex_t *log_lock= rli->relay_log.get_log_lock(); + ulong s_id; DBUG_ENTER("queue_event"); LINT_INIT(inc_pos); @@ -3745,9 +3872,20 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) */ pthread_mutex_lock(log_lock); - - if ((uint4korr(buf + SERVER_ID_OFFSET) == ::server_id) && - !mi->rli.replicate_same_server_id) + s_id= uint4korr(buf + SERVER_ID_OFFSET); + if ((s_id == ::server_id && !mi->rli.replicate_same_server_id) || + /* + the following conjunction deals with IGNORE_SERVER_IDS, if set + If the master is on the ignore list, execution of + format description log events and rotate events is necessary. + */ + (mi->ignore_server_ids.elements > 0 && + mi->shall_ignore_server_id(s_id) && + /* everything is filtered out from non-master */ + (s_id != mi->master_id || + /* for the master meta information is necessary */ + buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && + buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT))) { /* Do not write it to the relay log. @@ -3762,10 +3900,14 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) But events which were generated by this slave and which do not exist in the master's binlog (i.e. Format_desc, Rotate & Stop) should not increment mi->master_log_pos. + If the event is originated remotely and is being filtered out by + IGNORE_SERVER_IDS it increments mi->master_log_pos + as well as rli->group_relay_log_pos. */ - if (buf[EVENT_TYPE_OFFSET]!=FORMAT_DESCRIPTION_EVENT && - buf[EVENT_TYPE_OFFSET]!=ROTATE_EVENT && - buf[EVENT_TYPE_OFFSET]!=STOP_EVENT) + if (!(s_id == ::server_id && !mi->rli.replicate_same_server_id) || + buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT && + buf[EVENT_TYPE_OFFSET] != ROTATE_EVENT && + buf[EVENT_TYPE_OFFSET] != STOP_EVENT) { mi->master_log_pos+= inc_pos; memcpy(rli->ign_master_log_name_end, mi->master_log_name, FN_REFLEN); @@ -3773,8 +3915,8 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) rli->ign_master_log_pos_end= mi->master_log_pos; } rli->relay_log.signal_update(); // the slave SQL thread needs to re-check - DBUG_PRINT("info", ("master_log_pos: %lu, event originating from the same server, ignored", - (ulong) mi->master_log_pos)); + DBUG_PRINT("info", ("master_log_pos: %lu, event originating from %u server, ignored", + (ulong) mi->master_log_pos, uint4korr(buf + SERVER_ID_OFFSET))); } else { diff --git a/sql/sql_lex.h b/sql/sql_lex.h index f6effab93a4..c4ab3091d6a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -214,10 +214,11 @@ typedef struct st_lex_master_info changed variable or if it should be left at old value */ enum {LEX_MI_UNCHANGED, LEX_MI_DISABLE, LEX_MI_ENABLE} - ssl, ssl_verify_server_cert, heartbeat_opt; + ssl, ssl_verify_server_cert, heartbeat_opt, repl_ignore_server_ids_opt; char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher; char *relay_log_name; ulong relay_log_pos; + DYNAMIC_ARRAY repl_ignore_server_ids; } LEX_MASTER_INFO; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index cde713b1b40..eadb3362882 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1266,26 +1266,27 @@ bool change_master(THD* thd, Master_info* mi) int thread_mask; const char* errmsg= 0; bool need_relay_log_purge= 1; + bool ret= FALSE; DBUG_ENTER("change_master"); lock_slave_threads(mi); init_thread_mask(&thread_mask,mi,0 /*not inverse*/); + LEX_MASTER_INFO* lex_mi= &thd->lex->mi; if (thread_mask) // We refuse if any slave thread is running { my_message(ER_SLAVE_MUST_STOP, ER(ER_SLAVE_MUST_STOP), MYF(0)); - unlock_slave_threads(mi); - DBUG_RETURN(TRUE); + ret= TRUE; + goto err; } thd_proc_info(thd, "Changing master"); - LEX_MASTER_INFO* lex_mi= &thd->lex->mi; // TODO: see if needs re-write if (init_master_info(mi, master_info_file, relay_log_info_file, 0, thread_mask)) { my_message(ER_MASTER_INFO, ER(ER_MASTER_INFO), MYF(0)); - unlock_slave_threads(mi); - DBUG_RETURN(TRUE); + ret= TRUE; + goto err; } /* @@ -1330,6 +1331,34 @@ bool change_master(THD* thd, Master_info* mi) mi->heartbeat_period= (float) min(SLAVE_MAX_HEARTBEAT_PERIOD, (slave_net_timeout/2.0)); mi->received_heartbeats= LL(0); // counter lives until master is CHANGEd + /* + reset the last time server_id list if the current CHANGE MASTER + is mentioning IGNORE_SERVER_IDS= (...) + */ + if (lex_mi->repl_ignore_server_ids_opt == LEX_MASTER_INFO::LEX_MI_ENABLE) + reset_dynamic(&mi->ignore_server_ids); + for (uint i= 0; i < lex_mi->repl_ignore_server_ids.elements; i++) + { + ulong s_id; + get_dynamic(&lex_mi->repl_ignore_server_ids, (uchar*) &s_id, i); + if (s_id == ::server_id && replicate_same_server_id) + { + my_error(ER_SLAVE_IGNORE_SERVER_IDS, MYF(0), s_id); + ret= TRUE; + goto err; + } + else + { + if (bsearch((const ulong *) &s_id, + mi->ignore_server_ids.buffer, + mi->ignore_server_ids.elements, sizeof(ulong), + (int (*) (const void*, const void*)) + change_master_server_id_cmp) == NULL) + insert_dynamic(&mi->ignore_server_ids, (uchar*) &s_id); + } + } + sort_dynamic(&mi->ignore_server_ids, (qsort_cmp) change_master_server_id_cmp); + if (lex_mi->ssl != LEX_MASTER_INFO::LEX_MI_UNCHANGED) mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::LEX_MI_ENABLE); @@ -1407,8 +1436,8 @@ bool change_master(THD* thd, Master_info* mi) if (flush_master_info(mi, 0)) { my_error(ER_RELAY_LOG_INIT, MYF(0), "Failed to flush master info file"); - unlock_slave_threads(mi); - DBUG_RETURN(TRUE); + ret= TRUE; + goto err; } if (need_relay_log_purge) { @@ -1419,8 +1448,8 @@ bool change_master(THD* thd, Master_info* mi) &errmsg)) { my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg); - unlock_slave_threads(mi); - DBUG_RETURN(TRUE); + ret= TRUE; + goto err; } } else @@ -1435,8 +1464,8 @@ bool change_master(THD* thd, Master_info* mi) &msg, 0)) { my_error(ER_RELAY_LOG_INIT, MYF(0), msg); - unlock_slave_threads(mi); - DBUG_RETURN(TRUE); + ret= TRUE; + goto err; } } /* @@ -1473,10 +1502,13 @@ bool change_master(THD* thd, Master_info* mi) pthread_cond_broadcast(&mi->data_cond); pthread_mutex_unlock(&mi->rli.data_lock); +err: unlock_slave_threads(mi); thd_proc_info(thd, 0); - my_ok(thd); - DBUG_RETURN(FALSE); + if (ret == FALSE) + my_ok(thd); + delete_dynamic(&lex_mi->repl_ignore_server_ids); //freeing of parser-time alloc + DBUG_RETURN(ret); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 50395d386e8..7dff91befb0 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -740,6 +740,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); %token IDENT_QUOTED %token IF %token IGNORE_SYM +%token IGNORE_SERVER_IDS_SYM %token IMPORT %token INDEXES %token INDEX_SYM @@ -1559,6 +1560,12 @@ change: LEX *lex = Lex; lex->sql_command = SQLCOM_CHANGE_MASTER; bzero((char*) &lex->mi, sizeof(lex->mi)); + /* + resetting flags that can left from the previous CHANGE MASTER + */ + lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_UNCHANGED; + my_init_dynamic_array(&Lex->mi.repl_ignore_server_ids, + sizeof(::server_id), 16, 16); } master_defs {} @@ -1661,10 +1668,26 @@ master_def: } Lex->mi.heartbeat_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; } + | IGNORE_SERVER_IDS_SYM EQ '(' ignore_server_id_list ')' + { + Lex->mi.repl_ignore_server_ids_opt= LEX_MASTER_INFO::LEX_MI_ENABLE; + } | master_file_def ; +ignore_server_id_list: + /* Empty */ + | ignore_server_id + | ignore_server_id_list ',' ignore_server_id + ; + +ignore_server_id: + ulong_num + { + insert_dynamic(&Lex->mi.repl_ignore_server_ids, (uchar*) &($1)); + } + master_file_def: MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys { From 15c63309d4da505d171a0856a0404ee20bbd6484 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 12:11:50 +0800 Subject: [PATCH 62/88] Post fix backporting wl#1720 Fix mtr semisync plugin option paths --- mysql-test/mysql-test-run.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 434896df6a5..d50195c7d16 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1819,9 +1819,13 @@ sub environment_setup { # Add the path where mysqld will find semisync plugins # -------------------------------------------------------------------------- my $lib_semisync_master_plugin= - mtr_file_exists("$basedir/plugin/semisync/.libs/libsemisync_master.so"); + mtr_file_exists(vs_config_dirs('plugin/semisync',"libsemisync_master.so"), + "$basedir/plugin/semisync/.libs/libsemisync_master.so", + "$basedir/lib/mysql/plugin/libsemisync_master.so"); my $lib_semisync_slave_plugin= - mtr_file_exists("$basedir/plugin/semisync/.libs/libsemisync_slave.so"); + mtr_file_exists(vs_config_dirs('plugin/semisync',"libsemisync_slave.so"), + "$basedir/plugin/semisync/.libs/libsemisync_slave.so", + "$basedir/lib/mysql/plugin/libsemisync_slave.so"); if ($lib_semisync_master_plugin && $lib_semisync_slave_plugin) { $ENV{'SEMISYNC_MASTER_PLUGIN'}= basename($lib_semisync_master_plugin); From c1e2b1471452a9337d21e2e66fc3427bba62eeb3 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 13:59:42 +0800 Subject: [PATCH 63/88] Backport BUG#41013 main.bootstrap coredumps in 6.0-rpl When a storage engine failed to initialize before allocated slot number, the slot number would be 0, and when later finalizing this plugin, it would accidentally unplug the storage engine currently uses slot 0. This patch fixed this problem by add a new macro value HA_SLOT_UNDEF to distinguish undefined slot number from slot 0. --- sql/handler.cc | 9 ++++++++- sql/handler.h | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sql/handler.cc b/sql/handler.cc index f966a9099ee..ac959cb62f2 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -413,7 +413,13 @@ int ha_finalize_handlerton(st_plugin_int *plugin) reuse an array slot. Otherwise the number of uninstall/install cycles would be limited. */ - hton2plugin[hton->slot]= NULL; + if (hton->slot != HA_SLOT_UNDEF) + { + /* Make sure we are not unpluging another plugin */ + DBUG_ASSERT(hton2plugin[hton->slot] == plugin); + DBUG_ASSERT(hton->slot < MAX_HA); + hton2plugin[hton->slot]= NULL; + } my_free((uchar*)hton, MYF(0)); @@ -438,6 +444,7 @@ int ha_initialize_handlerton(st_plugin_int *plugin) goto err_no_hton_memory; } + hton->slot= HA_SLOT_UNDEF; /* Historical Requirement */ plugin->data= hton; // shortcut for the future if (plugin->plugin->init && plugin->plugin->init(hton)) diff --git a/sql/handler.h b/sql/handler.h index a281aaa0ad7..ea0b134e53d 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -216,6 +216,13 @@ */ #define MAX_HA 15 +/* + Use this instead of 0 as the initial value for the slot number of + handlerton, so that we can distinguish uninitialized slot number + from slot 0. +*/ +#define HA_SLOT_UNDEF ((uint)-1) + /* Parameters for open() (in register form->filestat) HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED From 494adde6fbd9d5b3ec194ec3aef5ba7e88cc987c Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 16:07:33 +0800 Subject: [PATCH 64/88] Backport BUG#41613 Slave I/O status inconsistent between SHOW SLAVE STATUS and START SLAVE There are three internal status for slave I/O thread, both MYSQL_SLAVE_RUN_NOT_CONNECT and MYSQL_SLAVE_NOT_RUN are reported as 'No' for Slave_IO_running of command SHOW SLAVE STATUS. Change MYSQL_SLAVE_RUN_NOT_CONNECT to be reported as 'Connecting'. --- sql/slave.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/slave.cc b/sql/slave.cc index 4c13841875c..47842cce225 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1848,7 +1848,8 @@ bool show_master_info(THD* thd, Master_info* mi) protocol->store((ulonglong) mi->rli.group_relay_log_pos); protocol->store(mi->rli.group_master_log_name, &my_charset_bin); protocol->store(mi->slave_running == MYSQL_SLAVE_RUN_CONNECT ? - "Yes" : "No", &my_charset_bin); + "Yes" : (mi->slave_running == MYSQL_SLAVE_RUN_NOT_CONNECT ? + "Connecting" : "No"), &my_charset_bin); protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin); protocol->store(rpl_filter->get_do_db()); protocol->store(rpl_filter->get_ignore_db()); From 4354cfd4043b9b54a3a2923374fc6cb615bf6ab7 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 16:18:40 +0800 Subject: [PATCH 65/88] Backport BUG#38468 Memory leak detected when using mysqlbinlog utility There were two memory leaks in mysqlbinlog command, one was already fixed by previous patches, another one was that defaults_argv was set to the value of argv after parse_args, in which called handle_options after calling load_defaults and changed the value of argv, and caused the memory allocated for defaults arguments not freed. Fixed the problem by setting defaults_argv right after calling load_defaults. --- client/mysqlbinlog.cc | 4 ++-- mysql-test/t/mysqlbinlog.test | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 82af7ca65f6..5713dfa59a1 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1346,7 +1346,6 @@ static int parse_args(int *argc, char*** argv) int ho_error; result_file = stdout; - load_defaults("my",load_default_groups,argc,argv); if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) exit(ho_error); if (debug_info_flag) @@ -1998,8 +1997,9 @@ int main(int argc, char** argv) my_init_time(); // for time functions + load_defaults("my", load_default_groups, &argc, &argv); + defaults_argv= argv; parse_args(&argc, (char***)&argv); - defaults_argv=argv; if (!argc) { diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 015d4d152cb..04fb5486f31 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -380,3 +380,27 @@ FLUSH LOGS; --echo End of 5.0 tests --echo End of 5.1 tests + +# +# BUG#38468 Memory leak detected when using mysqlbinlog utility; +# +disable_query_log; +RESET MASTER; +CREATE TABLE t1 SELECT 1; +FLUSH LOGS; +DROP TABLE t1; +enable_query_log; + +# Write an empty file for comparison +write_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; +EOF + +# Before fix of BUG#38468, this would generate some warnings +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 >/dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn + +# Make sure the command above does not generate any error or warnings +diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; + +# Cleanup for this part of test +remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; +remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn; From 86c36aa1fd05c510b036dcc8573e68b58549742d Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 16:25:53 +0800 Subject: [PATCH 66/88] Backport BUG#25192 Using relay-log and relay-log-index without values produces unexpected results. Options loaded from config files were added before command line arguments, and they were parsed together, which could interprete the following: option-a option-b as --option-a=--option-b if 'option-a' requires a value, and caused confusing. Because all options that requires a value are always given in the form '--option=value', so it's an error if there is no '=value' part for such an option read from config file. This patch added a separator to separate the arguments from config files and that from command line, so that they can be handled differently. And report an error for options loaded from config files that requires a value and is not given in the form '--option=value'. --- extra/my_print_defaults.c | 3 +- include/my_sys.h | 1 + mysys/default.c | 49 +++++++++++++++++++++++------ mysys/my_getopt.c | 33 +++++++++++++++++-- sql-common/client.c | 2 ++ storage/ndb/test/run-test/setup.cpp | 8 +++++ 6 files changed, 83 insertions(+), 13 deletions(-) diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 06f7e51c380..42a5cbd6877 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -192,7 +192,8 @@ int main(int argc, char **argv) } for (argument= arguments+1 ; *argument ; argument++) - puts(*argument); + if (*argument != args_separator) /* skip arguments separator */ + puts(*argument); my_free((char*) load_default_groups,MYF(0)); free_defaults(arguments); diff --git a/include/my_sys.h b/include/my_sys.h index 222564e0b44..4e85525e4b0 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -843,6 +843,7 @@ extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); extern int get_defaults_options(int argc, char **argv, char **defaults, char **extra_defaults, char **group_suffix); +extern const char *args_separator; extern int my_load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv, const char ***); extern int load_defaults(const char *conf_file, const char **groups, diff --git a/mysys/default.c b/mysys/default.c index 1c021b4584f..c610b57c6d1 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -41,6 +41,29 @@ #include #endif +/** + arguments separator + + load_defaults() loads arguments from config file and put them + before the arguments from command line, this separator is used to + separate the arguments loaded from config file and arguments user + provided on command line. + + Options with value loaded from config file are always in the form + '--option=value', while for command line options, the value can be + given as the next argument. Thus we used a separator so that + handle_options() can distinguish them. + + Note: any other places that does not need to distinguish them + should skip the separator. + + The content of arguments separator does not matter, one should only + check the pointer, use "----args-separator----" here to ease debug + if someone misused it. + + See BUG#25192 +*/ +const char *args_separator= "----args-separator----"; const char *my_defaults_file=0; const char *my_defaults_group_suffix=0; char *my_defaults_extra_file=0; @@ -454,10 +477,11 @@ int my_load_defaults(const char *conf_file, const char **groups, goto err; res= (char**) (ptr+sizeof(alloc)); res[0]= **argv; /* Copy program name */ + /* set arguments separator */ + res[1]= args_separator; for (i=2 ; i < (uint) *argc ; i++) - res[i-1]=argv[0][i]; - res[i-1]=0; /* End pointer */ - (*argc)--; + res[i]=argv[0][i]; + res[i]=0; /* End pointer */ *argv=res; *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ if (default_directories) @@ -487,7 +511,7 @@ int my_load_defaults(const char *conf_file, const char **groups, or a forced default file */ if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+ - (args.elements + *argc +1) *sizeof(char*)))) + (args.elements + *argc + 1 + 1) *sizeof(char*)))) goto err; res= (char**) (ptr+sizeof(alloc)); @@ -508,12 +532,16 @@ int my_load_defaults(const char *conf_file, const char **groups, --*argc; ++*argv; /* skip argument */ } - if (*argc) - memcpy((uchar*) (res+1+args.elements), (char*) ((*argv)+1), - (*argc-1)*sizeof(char*)); - res[args.elements+ *argc]=0; /* last null */ + /* set arguments separator for arguments from config file and + command line */ + res[args.elements+1]= args_separator; - (*argc)+=args.elements; + if (*argc) + memcpy((uchar*) (res+1+args.elements+1), (char*) ((*argv)+1), + (*argc-1)*sizeof(char*)); + res[args.elements+ *argc+1]=0; /* last null */ + + (*argc)+=args.elements+1; *argv= (char**) res; *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ delete_dynamic(&args); @@ -523,7 +551,8 @@ int my_load_defaults(const char *conf_file, const char **groups, printf("%s would have been started with the following arguments:\n", **argv); for (i=1 ; i < *argc ; i++) - printf("%s ", (*argv)[i]); + if ((*argv)[i] != args_separator) /* skip arguments separator */ + printf("%s ", (*argv)[i]); puts(""); exit(0); } diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index b6eb6dac54f..22b1216f99c 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -121,6 +121,7 @@ int handle_options(int *argc, char ***argv, const struct my_option *optp; uchar* *value; int error, i; + my_bool is_cmdline_arg= 1; LINT_INIT(opt_found); /* handle_options() assumes arg0 (program name) always exists */ @@ -130,10 +131,34 @@ int handle_options(int *argc, char ***argv, (*argv)++; /* --- || ---- */ init_variables(longopts, init_one_value); + /* + Search for args_separator, if found, then the first part of the + arguments are loaded from configs + */ + for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) + { + if (*pos == args_separator) + { + is_cmdline_arg= 0; + break; + } + } + for (pos= *argv, pos_end=pos+ *argc; pos != pos_end ; pos++) { char **first= pos; char *cur_arg= *pos; + if (!is_cmdline_arg && (cur_arg == args_separator)) + { + is_cmdline_arg= 1; + + /* save the separator too if skip unkown options */ + if (my_getopt_skip_unknown) + (*argv)[argvpos++]= cur_arg; + else + (*argc)--; + continue; + } if (cur_arg[0] == '-' && cur_arg[1] && !end_of_options) /* must be opt */ { char *argument= 0; @@ -426,8 +451,12 @@ invalid value '%s'", } else if (optp->arg_type == REQUIRED_ARG && !optend) { - /* Check if there are more arguments after this one */ - if (!*++pos) + /* Check if there are more arguments after this one, + + Note: options loaded from config file that requires value + should always be in the form '--option=value'. + */ + if (!is_cmdline_arg || !*++pos) { if (my_getopt_print_errors) my_getopt_error_reporter(ERROR_LEVEL, diff --git a/sql-common/client.c b/sql-common/client.c index 84029b449af..cbed3a5e2a8 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1053,6 +1053,8 @@ void mysql_read_default_options(struct st_mysql_options *options, char **option=argv; while (*++option) { + if (option[0] == args_separator) /* skip arguments separator */ + continue; /* DBUG_PRINT("info",("option: %s",option[0])); */ if (option[0][0] == '-' && option[0][1] == '-') { diff --git a/storage/ndb/test/run-test/setup.cpp b/storage/ndb/test/run-test/setup.cpp index cbb7a34f171..60f8285888c 100644 --- a/storage/ndb/test/run-test/setup.cpp +++ b/storage/ndb/test/run-test/setup.cpp @@ -105,6 +105,8 @@ setup_config(atrt_config& config) */ for (j = 0; j<(size_t)argc; j++) { + if (tmp[j] == args_separator) /* skip arguments separator */ + continue; for (k = 0; proc_args[k].name; k++) { if (!strncmp(tmp[j], proc_args[k].name, strlen(proc_args[k].name))) @@ -369,6 +371,12 @@ load_options(int argc, char** argv, int type, atrt_options& opts) { for (size_t i = 0; i<(size_t)argc; i++) { + /** + * Skip the separator for arguments from config file and command + * line + */ + if (argv[i] == args_separator) + continue; for (size_t j = 0; f_options[j].name; j++) { const char * name = f_options[j].name; From 79faadd54d5360ad0d2a480f4dcdc1757fe567f4 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 16:35:03 +0800 Subject: [PATCH 67/88] Backport BUG#12190 CHANGE MASTER has differ path requiremts on MASTER_LOG_FILE and RELAY_LOG_FILE CHANGE MASTER TO command required the value for RELAY_LOG_FILE to be an absolute path, which was different from the requirement of MASTER_LOG_FILE. This patch fixed the problem by changing the value for RELAY_LOG_FILE to be the basename of the log file as that for MASTER_LOG_FILE. --- mysql-test/include/setup_fake_relay_log.inc | 2 +- .../t/binlog_auto_increment_bug33029.test | 2 +- .../suite/rpl/r/rpl_change_master.result | 17 ++++++ mysql-test/suite/rpl/t/rpl_change_master.test | 53 +++++++++++++++++++ sql/sql_repl.cc | 6 ++- 5 files changed, 76 insertions(+), 4 deletions(-) diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index f88806e1079..b3df7abba76 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -69,7 +69,7 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; # Create relay log file. copy_file $fake_relay_log $_fake_relay_log; # Create relay log index. ---exec echo $_fake_filename-fake.000001 > $_fake_relay_index +--exec echo ./$_fake_filename-fake.000001 > $_fake_relay_index # Setup replication from existing relay log. eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4; diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test index 5297767675c..1277f6e7ccb 100644 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test +++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test @@ -26,7 +26,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001; write_file $MYSQLD_DATADIR/slave-relay-bin.index; -slave-relay-bin.000001 +./slave-relay-bin.000001 EOF change master to diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result index 7bc5473c46e..a51ba50475b 100644 --- a/mysql-test/suite/rpl/r/rpl_change_master.result +++ b/mysql-test/suite/rpl/r/rpl_change_master.result @@ -100,3 +100,20 @@ n 1 2 drop table t1; +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +create table t1 (a int); +insert into t1 values (1); +flush logs; +insert into t1 values (2); +include/stop_slave.inc +delete from t1 where a=2; +CHANGE MASTER TO relay_log_file='slave-relay-bin.000005', relay_log_pos=4; +start slave sql_thread; +start slave io_thread; +set global relay_log_purge=1; +drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test index d0cd40e2e11..c1ef417ea78 100644 --- a/mysql-test/suite/rpl/t/rpl_change_master.test +++ b/mysql-test/suite/rpl/t/rpl_change_master.test @@ -33,3 +33,56 @@ connection slave; sync_with_master; # End of 4.1 tests + +# +# BUG#12190 CHANGE MASTER has differ path requiremts on MASTER_LOG_FILE and RELAY_LOG_FILE +# + +source include/master-slave-reset.inc; + +connection master; +create table t1 (a int); +insert into t1 values (1); +flush logs; +insert into t1 values (2); + +# Note: the master positon saved by this will also be used by the +# 'sync_with_master' below. +sync_slave_with_master; + +# Check if the table t1 and t2 are identical on master and slave; +let $diff_table_1= master:test.t1 +let $diff_table_2= slave:test.t1 +source include/diff_tables.inc; + +connection slave; +source include/stop_slave.inc; +delete from t1 where a=2; + +# start replication from the second insert, after fix of BUG#12190, +# relay_log_file does not use absolute path, only the filename is +# required +# +# Note: the follow change master will automatically reset +# relay_log_purge to false, save the old value to restore +let $relay_log_purge= `select @@global.relay_log_purge`; +CHANGE MASTER TO relay_log_file='slave-relay-bin.000005', relay_log_pos=4; +start slave sql_thread; +source include/wait_for_slave_sql_to_start.inc; + +# Sync to the same position saved by the 'sync_slave_with_master' above. +sync_with_master; + +# Check if the table t1 and t2 are identical on master and slave; +let $diff_table_1= master:test.t1 +let $diff_table_2= slave:test.t1 +source include/diff_tables.inc; + +# clean up +connection slave; +start slave io_thread; +source include/wait_for_slave_io_to_start.inc; +eval set global relay_log_purge=$relay_log_purge; +connection master; +drop table t1; +sync_slave_with_master; diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index a899c8b7551..2c373059bf7 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -1400,9 +1400,11 @@ bool change_master(THD* thd, Master_info* mi) if (lex_mi->relay_log_name) { need_relay_log_purge= 0; - strmake(mi->rli.group_relay_log_name,lex_mi->relay_log_name, + char relay_log_name[FN_REFLEN]; + mi->rli.relay_log.make_log_name(relay_log_name, lex_mi->relay_log_name); + strmake(mi->rli.group_relay_log_name, relay_log_name, sizeof(mi->rli.group_relay_log_name)-1); - strmake(mi->rli.event_relay_log_name,lex_mi->relay_log_name, + strmake(mi->rli.event_relay_log_name, relay_log_name, sizeof(mi->rli.event_relay_log_name)-1); } From b92d459d118287f9308a61cecd29bd7656ff811d Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 16:40:06 +0800 Subject: [PATCH 68/88] Backport post fix compiler warnings and test failures for BUG#25192 BUG#12190 --- mysql-test/include/setup_fake_relay_log.inc | 16 +++++++++++++++- .../t/binlog_auto_increment_bug33029.test | 19 ++++++++++++++++--- mysys/default.c | 4 ++-- sql/log.cc | 2 +- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index b3df7abba76..b11e6afbeca 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -69,7 +69,21 @@ let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; # Create relay log file. copy_file $fake_relay_log $_fake_relay_log; # Create relay log index. ---exec echo ./$_fake_filename-fake.000001 > $_fake_relay_index + +# After patch for BUG#12190, the filename used in CHANGE MASTER +# RELAY_LOG_FILE will be automatically added the directory of the +# relay log before comparison, thus we need to added the directory +# part (./ on unix .\ on windows) when faking the relay-log-bin.index. + +if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`) +{ + eval select './$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'; +} + +if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`) +{ + eval select '.\\\\$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'; +} # Setup replication from existing relay log. eval CHANGE MASTER TO MASTER_HOST='dummy.localdomain', RELAY_LOG_FILE='$_fake_filename-fake.000001', RELAY_LOG_POS=4; diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test index 1277f6e7ccb..19137066429 100644 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test +++ b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test @@ -25,9 +25,22 @@ let $MYSQLD_DATADIR= `select @@datadir`; copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001; -write_file $MYSQLD_DATADIR/slave-relay-bin.index; -./slave-relay-bin.000001 -EOF + +# After patch for BUG#12190, the filename used in CHANGE MASTER +# RELAY_LOG_FILE will be automatically added the directory of the +# relay log before comparison, thus we need to added the directory +# part (./ on unix .\ on windows) when faking the relay-log-bin.index. +disable_query_log; +if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`) +{ + eval select './slave-relay-bin.000001\n' into dumpfile '$MYSQLD_DATADIR/slave-relay-bin.index'; +} + +if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") != 0`) +{ + eval select '.\\\\slave-relay-bin.000001\n' into dumpfile '$MYSQLD_DATADIR/slave-relay-bin.index'; +} +enable_query_log; change master to MASTER_HOST='dummy.localdomain', diff --git a/mysys/default.c b/mysys/default.c index c610b57c6d1..6468cf2b35d 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -478,7 +478,7 @@ int my_load_defaults(const char *conf_file, const char **groups, res= (char**) (ptr+sizeof(alloc)); res[0]= **argv; /* Copy program name */ /* set arguments separator */ - res[1]= args_separator; + res[1]= (char *)args_separator; for (i=2 ; i < (uint) *argc ; i++) res[i]=argv[0][i]; res[i]=0; /* End pointer */ @@ -534,7 +534,7 @@ int my_load_defaults(const char *conf_file, const char **groups, /* set arguments separator for arguments from config file and command line */ - res[args.elements+1]= args_separator; + res[args.elements+1]= (char *)args_separator; if (*argc) memcpy((uchar*) (res+1+args.elements+1), (char*) ((*argv)+1), diff --git a/sql/log.cc b/sql/log.cc index 16f54649d2d..a523c111e87 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1901,7 +1901,7 @@ updating the index files.", max_found); */ if (((strlen(ext_buf) + (end - name)) >= FN_REFLEN)) { - sql_print_error("Log filename too large: %s%s (%d). \ + sql_print_error("Log filename too large: %s%s (%lu). \ Please fix this by archiving old logs and updating the \ index files.", name, ext_buf, (strlen(ext_buf) + (end - name))); error= 1; From 1b3300d5e976ff2f05e4924b9120d4ffc4468e9c Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 16:50:05 +0800 Subject: [PATCH 69/88] Backport BUG#34227 Replication permission error message is misleading According to Jon's comment, add (at least one of) to the error message. --- mysql-test/r/mysqldump.result | 8 ++++---- sql/share/errmsg.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 8162e1aca05..b2a4c1ae585 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -3554,11 +3554,11 @@ use test; create user mysqltest_1@localhost; create table t1(a int, b varchar(34)); reset master; -mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need the RELOAD privilege for this operation (1227) -mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need the RELOAD privilege for this operation (1227) +mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) +mysqldump: Couldn't execute 'FLUSH /*!40101 LOCAL */ TABLES': Access denied; you need (at least one of) the RELOAD privilege(s) for this operation (1227) grant RELOAD on *.* to mysqltest_1@localhost; -mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227) -mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227) +mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation (1227) +mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need (at least one of) the SUPER,REPLICATION CLIENT privilege(s) for this operation (1227) grant REPLICATION CLIENT on *.* to mysqltest_1@localhost; drop table t1; drop user mysqltest_1@localhost; diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 18d3a41424a..1773599c63d 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -4620,7 +4620,7 @@ ER_USER_LIMIT_REACHED 42000 swe "Användare '%-.64s' har överskridit '%s' (nuvarande värde: %ld)" ER_SPECIFIC_ACCESS_DENIED_ERROR 42000 nla "Toegang geweigerd. U moet het %-.128s privilege hebben voor deze operatie" - eng "Access denied; you need the %-.128s privilege for this operation" + eng "Access denied; you need (at least one of) the %-.128s privilege(s) for this operation" ger "Kein Zugriff. Hierfür wird die Berechtigung %-.128s benötigt" ita "Accesso non consentito. Serve il privilegio %-.128s per questa operazione" por "Acesso negado. Você precisa o privilégio %-.128s para essa operação" From fa7395c9a1baa795ea0f33110887bb42288f8b65 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 17:12:10 +0800 Subject: [PATCH 70/88] Backport Post fix of result files after push of BUG#34227 --- mysql-test/r/events_bugs.result | 4 ++-- mysql-test/r/grant2.result | 4 ++-- mysql-test/r/information_schema_db.result | 2 +- mysql-test/r/sp-security.result | 4 ++-- mysql-test/r/trigger_notembedded.result | 4 ++-- mysql-test/r/view_grant.result | 12 ++++++------ mysql-test/suite/binlog/r/binlog_grant.result | 6 +++--- mysql-test/suite/federated/federated_server.result | 8 ++++---- mysql-test/suite/funcs_1/r/innodb_trig_03e.result | 4 ++-- mysql-test/suite/funcs_1/r/memory_trig_03e.result | 4 ++-- mysql-test/suite/funcs_1/r/myisam_trig_03e.result | 4 ++-- mysql-test/suite/funcs_1/r/ndb_trig_03e.result | 4 ++-- mysql-test/suite/rpl/r/rpl_temporary.result | 4 ++-- mysql-test/suite/sys_vars/r/read_only_func.result | 2 +- 14 files changed, 33 insertions(+), 33 deletions(-) diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index 50bfa97c59f..15a9e226c39 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -375,7 +375,7 @@ SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost ALTER DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 HOUR; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost @@ -386,7 +386,7 @@ event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; CREATE DEFINER=root@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation DROP EVENT e1; ERROR HY000: Unknown event 'e1' DROP USER mysqltest_u1@localhost; diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 7c2023127f0..461ad78bbb6 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -121,9 +121,9 @@ mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7; create database mysqltest_1; grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost; set sql_log_off = 1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation set sql_log_bin = 0; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation delete from mysql.user where user like 'mysqltest\_1'; delete from mysql.db where user like 'mysqltest\_1'; drop database mysqltest_1; diff --git a/mysql-test/r/information_schema_db.result b/mysql-test/r/information_schema_db.result index 6305f8cd47a..4cc96d3e9ce 100644 --- a/mysql-test/r/information_schema_db.result +++ b/mysql-test/r/information_schema_db.result @@ -121,7 +121,7 @@ grant insert on v1 to testdb_2@localhost; create view v5 as select f1 from t1; grant show view on v5 to testdb_2@localhost; create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation use testdb_1; create view v6 as select f1 from t1; grant show view on v6 to testdb_2@localhost; diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index 65c94577a57..ecac8fed8c4 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -349,9 +349,9 @@ CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1; ---> connection: mysqltest_1_con USE mysqltest; CREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation CREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation ---> connection: mysqltest_2_con use mysqltest; diff --git a/mysql-test/r/trigger_notembedded.result b/mysql-test/r/trigger_notembedded.result index 335e6910a3a..f8975cb2ee5 100644 --- a/mysql-test/r/trigger_notembedded.result +++ b/mysql-test/r/trigger_notembedded.result @@ -117,7 +117,7 @@ CREATE DEFINER='mysqltest_inv'@'localhost' TRIGGER trg1 BEFORE INSERT ON t1 FOR EACH ROW SET @new_sum = 0; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation ---> connection: default use mysqltest_db1; @@ -473,7 +473,7 @@ SELECT trigger_name FROM INFORMATION_SCHEMA.TRIGGERS WHERE trigger_schema = 'db1'; trigger_name SHOW CREATE TRIGGER db1.trg; -ERROR 42000: Access denied; you need the TRIGGER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the TRIGGER privilege(s) for this operation DROP USER 'no_rights'@'localhost'; DROP DATABASE db1; End of 5.1 tests. diff --git a/mysql-test/r/view_grant.result b/mysql-test/r/view_grant.result index 7e280fa2fe5..982b3b98d9c 100644 --- a/mysql-test/r/view_grant.result +++ b/mysql-test/r/view_grant.result @@ -16,7 +16,7 @@ create table mysqltest.t2 (a int, b int); grant select on mysqltest.t1 to mysqltest_1@localhost; grant create view,select on test.* to mysqltest_1@localhost; create definer=root@localhost view v1 as select * from mysqltest.t1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation create view v1 as select * from mysqltest.t1; alter view v1 as select * from mysqltest.t1; ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1' @@ -779,11 +779,11 @@ GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost; GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost; GRANT SELECT ON db26813.t1 TO u26813@localhost; ALTER VIEW v1 AS SELECT f2 FROM t1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation ALTER VIEW v2 AS SELECT f2 FROM t1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation ALTER VIEW v3 AS SELECT f2 FROM t1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation SHOW CREATE VIEW v3; View Create View character_set_client collation_connection v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci @@ -807,9 +807,9 @@ GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost; GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost; GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost; ALTER VIEW v1 AS SELECT f2 FROM t1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation ALTER VIEW v2 AS SELECT f2 FROM t1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation SHOW CREATE VIEW v2; View Create View character_set_client collation_connection v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci diff --git a/mysql-test/suite/binlog/r/binlog_grant.result b/mysql-test/suite/binlog/r/binlog_grant.result index 21ebb891103..548013fcbf2 100644 --- a/mysql-test/suite/binlog/r/binlog_grant.result +++ b/mysql-test/suite/binlog/r/binlog_grant.result @@ -13,16 +13,16 @@ set session sql_log_bin = 1; set global sql_log_bin = 1; ERROR HY000: Variable 'sql_log_bin' is a SESSION variable and can't be used with SET GLOBAL set session sql_log_bin = 1; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation **** Variable BINLOG_FORMAT **** [root] set global binlog_format = row; set session binlog_format = row; [plain] set global binlog_format = row; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation set session binlog_format = row; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation **** Clean up **** set global binlog_format = @saved_binlog_format; drop user mysqltest_1@localhost; diff --git a/mysql-test/suite/federated/federated_server.result b/mysql-test/suite/federated/federated_server.result index 2c20d1c1d57..5079a4dcfa0 100644 --- a/mysql-test/suite/federated/federated_server.result +++ b/mysql-test/suite/federated/federated_server.result @@ -197,13 +197,13 @@ select * from federated.t1; id name 1 this is legitimate alter server s1 options (database 'db_bogus'); -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation flush tables; select * from federated.t1; id name 1 this is legitimate alter server s1 options (database 'db_bogus'); -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation flush tables; select * from federated.t1; id name @@ -214,7 +214,7 @@ select * from federated.t1; id name 2 this is bogus drop server if exists 's1'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation create server 's1' foreign data wrapper 'mysql' options (HOST '127.0.0.1', DATABASE 'db_legitimate', @@ -223,7 +223,7 @@ PASSWORD '', PORT SLAVE_PORT, SOCKET '', OWNER 'root'); -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation drop server 's1'; create server 's1' foreign data wrapper 'mysql' options (HOST '127.0.0.1', diff --git a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result index 476ccc6ebd8..25edc0f68bb 100644 --- a/mysql-test/suite/funcs_1/r/innodb_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/innodb_trig_03e.result @@ -1251,7 +1251,7 @@ drop trigger trg1_0; create definer=not_ex_user@localhost trigger trg1_0 before INSERT on t1 for each row set new.f1 = 'trig 1_0-yes'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation create definer=current_user trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-yes'; @@ -1284,7 +1284,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca create definer=not_ex_user@localhost trigger trg1_3 after UPDATE on t1 for each row set @var1 = 'trig 1_3-yes'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation select current_user; current_user root@localhost diff --git a/mysql-test/suite/funcs_1/r/memory_trig_03e.result b/mysql-test/suite/funcs_1/r/memory_trig_03e.result index bbee7d47e7e..462a8858029 100644 --- a/mysql-test/suite/funcs_1/r/memory_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/memory_trig_03e.result @@ -1252,7 +1252,7 @@ drop trigger trg1_0; create definer=not_ex_user@localhost trigger trg1_0 before INSERT on t1 for each row set new.f1 = 'trig 1_0-yes'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation create definer=current_user trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-yes'; @@ -1285,7 +1285,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca create definer=not_ex_user@localhost trigger trg1_3 after UPDATE on t1 for each row set @var1 = 'trig 1_3-yes'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation select current_user; current_user root@localhost diff --git a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result index e4dc67098ad..104db478638 100644 --- a/mysql-test/suite/funcs_1/r/myisam_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/myisam_trig_03e.result @@ -1252,7 +1252,7 @@ drop trigger trg1_0; create definer=not_ex_user@localhost trigger trg1_0 before INSERT on t1 for each row set new.f1 = 'trig 1_0-yes'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation create definer=current_user trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-yes'; @@ -1285,7 +1285,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca create definer=not_ex_user@localhost trigger trg1_3 after UPDATE on t1 for each row set @var1 = 'trig 1_3-yes'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation select current_user; current_user root@localhost diff --git a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result index 84260822edf..73388680481 100644 --- a/mysql-test/suite/funcs_1/r/ndb_trig_03e.result +++ b/mysql-test/suite/funcs_1/r/ndb_trig_03e.result @@ -1251,7 +1251,7 @@ drop trigger trg1_0; create definer=not_ex_user@localhost trigger trg1_0 before INSERT on t1 for each row set new.f1 = 'trig 1_0-yes'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation create definer=current_user trigger trg1_1 before INSERT on t1 for each row set new.f1 = 'trig 1_1-yes'; @@ -1284,7 +1284,7 @@ GRANT SELECT, INSERT, UPDATE, TRIGGER ON `priv_db`.`t1` TO 'test_yesprivs'@'loca create definer=not_ex_user@localhost trigger trg1_3 after UPDATE on t1 for each row set @var1 = 'trig 1_3-yes'; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation select current_user; current_user root@localhost diff --git a/mysql-test/suite/rpl/r/rpl_temporary.result b/mysql-test/suite/rpl/r/rpl_temporary.result index 631eb0677b0..b2400a03f63 100644 --- a/mysql-test/suite/rpl/r/rpl_temporary.result +++ b/mysql-test/suite/rpl/r/rpl_temporary.result @@ -27,12 +27,12 @@ Warning 1265 Data truncated for column 'b' at row 1 DROP TABLE t1; SET @save_select_limit=@@session.sql_select_limit; SET @@session.sql_select_limit=10, @@session.pseudo_thread_id=100; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation SELECT @@session.sql_select_limit = @save_select_limit; @@session.sql_select_limit = @save_select_limit 1 SET @@session.sql_select_limit=10, @@session.sql_log_bin=0; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation SELECT @@session.sql_select_limit = @save_select_limit; @@session.sql_select_limit = @save_select_limit 1 diff --git a/mysql-test/suite/sys_vars/r/read_only_func.result b/mysql-test/suite/sys_vars/r/read_only_func.result index 35b42d468d6..7e98b7adc50 100644 --- a/mysql-test/suite/sys_vars/r/read_only_func.result +++ b/mysql-test/suite/sys_vars/r/read_only_func.result @@ -20,7 +20,7 @@ id name CREATE user sameea; ** Connecting connn using username 'sameea' ** SET Global read_ONLY=ON; -ERROR 42000: Access denied; you need the SUPER privilege for this operation +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation CREATE TABLE t2 ( id INT NOT NULL auto_increment, From 0ec47798fd59c0bb8e6c1ef03e907eccd6161345 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 17:24:21 +0800 Subject: [PATCH 71/88] Backport fixes for the follow tests binlog_tmp_table rpl_row_sp006_InnoDB rpl_slave_status --- mysql-test/extra/rpl_tests/rpl_row_sp006.test | 3 ++- mysql-test/suite/binlog/r/binlog_tmp_table.result | 1 + mysql-test/suite/binlog/t/binlog_tmp_table.test | 2 ++ mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result | 3 ++- mysql-test/suite/rpl/t/rpl_slave_status.test | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp006.test b/mysql-test/extra/rpl_tests/rpl_row_sp006.test index 897d7e492bf..613ce630f90 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp006.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp006.test @@ -11,7 +11,8 @@ # Begin clean up test section connection master; --disable_warnings -create database if not exists mysqltest1; +drop database if exists mysqltest1; +create database mysqltest1; DROP PROCEDURE IF EXISTS mysqltest1.p1; DROP PROCEDURE IF EXISTS mysqltest1.p2; DROP TABLE IF EXISTS mysqltest1.t2; diff --git a/mysql-test/suite/binlog/r/binlog_tmp_table.result b/mysql-test/suite/binlog/r/binlog_tmp_table.result index e4928432324..b057d24cba9 100644 --- a/mysql-test/suite/binlog/r/binlog_tmp_table.result +++ b/mysql-test/suite/binlog/r/binlog_tmp_table.result @@ -1,3 +1,4 @@ +reset master; create table foo (a int); flush logs; create temporary table tmp1_foo like foo; diff --git a/mysql-test/suite/binlog/t/binlog_tmp_table.test b/mysql-test/suite/binlog/t/binlog_tmp_table.test index 6947959a5e0..cd147149ed1 100644 --- a/mysql-test/suite/binlog/t/binlog_tmp_table.test +++ b/mysql-test/suite/binlog/t/binlog_tmp_table.test @@ -31,6 +31,8 @@ source include/have_binlog_format_mixed_or_statement.inc; connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master1,127.0.0.1,root,,test,$MASTER_MYPORT,); +reset master; + create table foo (a int); flush logs; diff --git a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result index 8339e77d3a0..0f4dd71f389 100644 --- a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result +++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result @@ -4,7 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create database if not exists mysqltest1; +drop database if exists mysqltest1; +create database mysqltest1; DROP PROCEDURE IF EXISTS mysqltest1.p1; DROP PROCEDURE IF EXISTS mysqltest1.p2; DROP TABLE IF EXISTS mysqltest1.t2; diff --git a/mysql-test/suite/rpl/t/rpl_slave_status.test b/mysql-test/suite/rpl/t/rpl_slave_status.test index 4edf1802a5d..02fd555d13c 100644 --- a/mysql-test/suite/rpl/t/rpl_slave_status.test +++ b/mysql-test/suite/rpl/t/rpl_slave_status.test @@ -54,6 +54,7 @@ sync_slave_with_master; source include/stop_slave.inc; START SLAVE; source include/wait_for_slave_sql_to_start.inc; +source include/wait_for_slave_io_to_stop.inc; --echo ==== Verify that Slave_IO_Running = No ==== let $result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, 1); From 04c6e8ff0746baa14c0017e2f37e2e2f77786a2b Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Fri, 2 Oct 2009 19:16:06 +0800 Subject: [PATCH 72/88] Post fix SEMISYNC_PLUGIN_OPT when semi-sync plugins are not found --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index d50195c7d16..1c14104957d 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -1836,7 +1836,7 @@ sub environment_setup { { $ENV{'SEMISYNC_MASTER_PLUGIN'}= ""; $ENV{'SEMISYNC_SLAVE_PLUGIN'}= ""; - $ENV{'SEMISYNC_PLUGIN_OPT'}=""; + $ENV{'SEMISYNC_PLUGIN_OPT'}="--plugin-dir="; } # ---------------------------------------------------- From d0c5656eb8b729fd52583ca6262b348f686665d8 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 2 Oct 2009 16:15:54 +0300 Subject: [PATCH 73/88] fixing tests results: rpl_ndb_log, rpl_ndb_multi, sp_trans_log; adding replicate-ignore_server_ids specific tests --- mysql-test/r/sp_trans_log.result | 10 -- .../suite/rpl/r/rpl_server_id_ignore.result | 46 +++++++ .../rpl/t/rpl_server_id_ignore-slave.opt | 1 + .../suite/rpl/t/rpl_server_id_ignore.test | 114 ++++++++++++++++++ mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result | 2 + .../suite/rpl_ndb/r/rpl_ndb_multi.result | 4 +- 6 files changed, 165 insertions(+), 12 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_server_id_ignore.result create mode 100644 mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt create mode 100644 mysql-test/suite/rpl/t/rpl_server_id_ignore.test diff --git a/mysql-test/r/sp_trans_log.result b/mysql-test/r/sp_trans_log.result index 3eec6f70063..117f6de754a 100644 --- a/mysql-test/r/sp_trans_log.result +++ b/mysql-test/r/sp_trans_log.result @@ -14,15 +14,5 @@ end| reset master| insert into t2 values (bug23333(),1)| ERROR 23000: Duplicate entry '1' for key 'PRIMARY' -show binlog events from | -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Query # # use `test`; BEGIN -master-bin.000001 # Table_map # # table_id: # (test.t2) -master-bin.000001 # Table_map # # table_id: # (test.t1) -master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # use `test`; ROLLBACK -select count(*),@a from t1 /* must be 1,1 */| -count(*) @a -1 1 drop table t1,t2; drop function if exists bug23333; diff --git a/mysql-test/suite/rpl/r/rpl_server_id_ignore.result b/mysql-test/suite/rpl/r/rpl_server_id_ignore.result new file mode 100644 index 00000000000..cba6571eb1a --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_server_id_ignore.result @@ -0,0 +1,46 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +master_id: 1 +stop slave; +*** --replicate-same-server-id and change master option can clash *** +change master to IGNORE_SERVER_IDS= (2, 1); +ERROR HY000: The requested server id 2 clashes with the slave startup option --replicate-same-server-id +*** must be empty due to the error *** +ignore server id list: +change master to IGNORE_SERVER_IDS= (10, 100); +*** must be 10, 100 *** +ignore server id list: 10, 100 +reset slave; +*** must be empty due to reset slave *** +ignore server id list: 10, 100 +change master to IGNORE_SERVER_IDS= (10, 100); +*** CHANGE MASTER with IGNORE_SERVER_IDS option overrides (does not increment) the previous setup *** +change master to IGNORE_SERVER_IDS= (5, 1, 4, 3, 1); +*** must be 1, 3, 4, 5 due to overriding policy *** +ignore server id list: 1, 3, 4, 5 +*** ignore master (server 1) queries for a while *** +start slave; +create table t1 (n int); +*** must be empty as the event is to be filtered out *** +show tables; +Tables_in_test +*** allowing events from master *** +stop slave; +reset slave; +change master to IGNORE_SERVER_IDS= (10, 100); +*** the list must remain (10, 100) after reset slave *** +change master to IGNORE_SERVER_IDS= (); +*** must be empty due to IGNORE_SERVER_IDS empty list *** +ignore server id list: +change master to master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root'; +start slave; +*** must have caught create table *** +show tables; +Tables_in_test +t1 +drop table t1; +end of the tests diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt b/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt new file mode 100644 index 00000000000..302889525dd --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore-slave.opt @@ -0,0 +1 @@ +--disable-log-slave-updates --replicate-same-server-id diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test new file mode 100644 index 00000000000..1b38bd34d3d --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test @@ -0,0 +1,114 @@ +# This test checks that the slave rejects events originating +# by a server from the list of ignored originators (bug#27808 etc) +# +# phases of tests: +# +# 0. master_id new line in show slave status +# 1. syntax related: +# a. error reporting if options clash; +# b. overriding the old IGNORE_SERVER_IDS setup by the following +# CHANGE MASTER ... IGNORE_SERVER_IDS= (list); +# c. the old setup preserving by CHANGE MASTER w/o IGNORE_SERVER_IDS +# d. resetting the ignored server ids with the empty list arg to +# IGNORE_SERVER_IDS=() +# e. RESET SLAVE preserves the list +# 2. run time related: +# a. observing no processing events from a master listed in IGNORE_SERVER_IDS +# b. nullifying the list and resuming of taking binlog from the very beginning with +# executing events this time + +source include/master-slave.inc; + +connection slave; + +# a new line for master_id +let $master_id= query_get_value(SHOW SLAVE STATUS, Master_Server_Id, 1); +echo master_id: $master_id; + +stop slave; +--echo *** --replicate-same-server-id and change master option can clash *** +--error ER_SLAVE_IGNORE_SERVER_IDS +change master to IGNORE_SERVER_IDS= (2, 1); +--echo *** must be empty due to the error *** +let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); +echo ignore server id list: $ignore_list; + +change master to IGNORE_SERVER_IDS= (10, 100); +--echo *** must be 10, 100 *** +let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); +echo ignore server id list: $ignore_list; +reset slave; +--echo *** must be empty due to reset slave *** +let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); +echo ignore server id list: $ignore_list; +change master to IGNORE_SERVER_IDS= (10, 100); +--echo *** CHANGE MASTER with IGNORE_SERVER_IDS option overrides (does not increment) the previous setup *** +change master to IGNORE_SERVER_IDS= (5, 1, 4, 3, 1); +--echo *** must be 1, 3, 4, 5 due to overriding policy *** +let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); +echo ignore server id list: $ignore_list; +--echo *** ignore master (server 1) queries for a while *** +start slave; + +connection master; + +#connection slave; +sync_slave_with_master; +let $slave_relay_pos0= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1); + +connection master; +create table t1 (n int); +let $master_binlog_end= query_get_value(SHOW MASTER STATUS, Position, 1); + +connection slave; +let $slave_param= Exec_Master_Log_Pos; +let $slave_param_value= $master_binlog_end; +source include/wait_for_slave_param.inc; +--echo *** must be empty as the event is to be filtered out *** +show tables; +--echo *** allowing events from master *** +let $slave_relay_pos1= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1); +# +# checking stability of relay log pos +# +if (`select $slave_relay_pos1 - $slave_relay_pos0`) +{ + --echo Error: relay log position changed: $slave_relay_pos0, $slave_relay_pos1 + query_vertical show slave status; +} + +stop slave; +source include/wait_for_slave_to_stop.inc; +reset slave; +change master to IGNORE_SERVER_IDS= (10, 100); +--echo *** the list must remain (10, 100) after reset slave *** +let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); + +change master to IGNORE_SERVER_IDS= (); +--echo *** must be empty due to IGNORE_SERVER_IDS empty list *** +let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1); +echo ignore server id list: $ignore_list; +--replace_result $MASTER_MYPORT MASTER_PORT +eval change master to master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root'; +start slave; + +connection master; + +#connection slave; +sync_slave_with_master; +--echo *** must have caught create table *** +show tables; + +# cleanup +connection master; +drop table t1; +#connection slave +sync_slave_with_master; + +--echo end of the tests + + + + + + diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result index 86752fbc4b8..301f4c2e45b 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_log.result @@ -299,6 +299,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 show binlog events in 'slave-bin.000005' from 4; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log DROP TABLE t1; diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result index f8eb5ebdd89..66eeaa6357c 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_multi.result @@ -26,11 +26,11 @@ stop slave; SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1) FROM mysql.ndb_binlog_index WHERE epoch = ; @the_pos:=Position @the_file:=SUBSTRING_INDEX(FILE, '/', -1) -106 master-bin.000001 +107 master-bin.000001 CHANGE MASTER TO master_port=, master_log_file = 'master-bin.000001', -master_log_pos = 106 ; +master_log_pos = 107 ; start slave; INSERT INTO t1 VALUES ("row2","will go away",2),("row3","will change",3),("row4","D",4); DELETE FROM t1 WHERE c3 = 1; From 87a5e6863438798d23c83f26e23135a1c9cdab3b Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Fri, 2 Oct 2009 23:24:40 +0400 Subject: [PATCH 74/88] WL#4641 Heartbeat testing This is backport for next-mr. The patch adds new test cases that cover replication heartbeat testing. --- mysql-test/include/have_ssl_communication.inc | 4 + .../suite/rpl/r/rpl_heartbeat_2slaves.result | 55 ++ .../suite/rpl/r/rpl_heartbeat_basic.result | 304 ++++++++++ .../suite/rpl/r/rpl_heartbeat_ssl.result | 27 + .../suite/rpl/t/rpl_heartbeat_2slaves.cnf | 17 + .../suite/rpl/t/rpl_heartbeat_2slaves.test | 142 +++++ .../suite/rpl/t/rpl_heartbeat_basic.cnf | 7 + .../suite/rpl/t/rpl_heartbeat_basic.test | 536 ++++++++++++++++++ mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test | 54 ++ 9 files changed, 1146 insertions(+) create mode 100644 mysql-test/include/have_ssl_communication.inc create mode 100644 mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result create mode 100644 mysql-test/suite/rpl/r/rpl_heartbeat_basic.result create mode 100644 mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result create mode 100644 mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf create mode 100644 mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test create mode 100644 mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf create mode 100644 mysql-test/suite/rpl/t/rpl_heartbeat_basic.test create mode 100644 mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test diff --git a/mysql-test/include/have_ssl_communication.inc b/mysql-test/include/have_ssl_communication.inc new file mode 100644 index 00000000000..6f2d5587a75 --- /dev/null +++ b/mysql-test/include/have_ssl_communication.inc @@ -0,0 +1,4 @@ +-- require r/have_ssl.require +disable_query_log; +show variables like 'have_ssl'; +enable_query_log; diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result b/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result new file mode 100644 index 00000000000..ecb7c62c488 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_2slaves.result @@ -0,0 +1,55 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +*** Preparing *** +[on slave] +include/stop_slave.inc +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='MASTER_BINLOG'; +include/start_slave.inc +[on slave1] +STOP SLAVE; +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='MASTER_BINLOG'; +include/start_slave.inc + +*** 2 slaves *** +Slave has received heartbeat event +Slave1 has received heartbeat event +Slave has received more heartbeats than Slave1 (1 means 'yes'): 1 + +*** Master->data->Slave1->heartbeat->Slave: *** +[on slave1] +RESET MASTER; +[on slave] +include/stop_slave.inc +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE1_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.2, MASTER_LOG_FILE='SLAVE1_BINLOG'; +include/start_slave.inc +Slave has received heartbeat event +[on master] +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT); +INSERT INTO t1 VALUES (1, 'on master', ''); +SHOW TABLES; +Tables_in_test +t1 +[on slave1] +SHOW TABLES; +Tables_in_test +t1 +[on slave] +SHOW TABLES; +Tables_in_test +[on master] +creating updates on master and send to slave1 during 5 second +[on slave] +Slave has received heartbeats (1 means 'yes'): 1 + +*** Clean up *** +DROP TABLE t1; + +End of 6.0 test diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result new file mode 100644 index 00000000000..ddb2122c631 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result @@ -0,0 +1,304 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +*** Preparing *** +include/stop_slave.inc +RESET SLAVE; +SET @restore_slave_net_timeout=@@global.slave_net_timeout; +RESET MASTER; +SET @restore_slave_net_timeout=@@global.slave_net_timeout; +SET @restore_event_scheduler=@@global.event_scheduler; + +*** Default value *** +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root'; +slave_net_timeout/slave_heartbeat_timeout=2.0000 +RESET SLAVE; + +*** Reset slave affect *** +SET @@global.slave_net_timeout=30; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; +RESET SLAVE; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 15.000 + +*** Default value if slave_net_timeout changed *** +SET @@global.slave_net_timeout=50; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root'; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 25.000 +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +RESET SLAVE; + +*** Warning if updated slave_net_timeout < slave_heartbeat_timeout *** +SET @@global.slave_net_timeout=FLOOR(SLAVE_HEARTBEAT_TIMEOUT)-1; +Warnings: +Warning 1624 The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout. +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +RESET SLAVE; + +*** Warning if updated slave_heartbeat_timeout > slave_net_timeout *** +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=SLAVE_NET_TIMEOUT; +Warnings: +Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout. +RESET SLAVE; + +*** CHANGE MASTER statement only updates slave_heartbeat_period *** +SET @@global.slave_net_timeout=20; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; +SHOW VARIABLES LIKE 'slave_net_timeout'; +Variable_name Value +slave_net_timeout 20 +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 5.000 +SET @@global.slave_net_timeout=2*@@global.slave_net_timeout; +SHOW VARIABLES LIKE 'slave_net_timeout'; +Variable_name Value +slave_net_timeout 40 +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 5.000 +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +RESET SLAVE; + +*** Update slave_net_timeout on master *** +SET @@global.slave_net_timeout=500; +SET @@global.slave_net_timeout=200; +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root'; +include/start_slave.inc +SHOW VARIABLES LIKE 'slave_net_timeout'; +Variable_name Value +slave_net_timeout 200 +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 100.000 +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +include/stop_slave.inc +RESET SLAVE; +SET @@global.slave_net_timeout=@restore_slave_net_timeout; + +*** Start/stop slave *** +SET @@global.slave_net_timeout=100; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20; +include/start_slave.inc +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 20.000 +include/stop_slave.inc +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 20.000 + +*** Reload slave *** +SET @@global.slave_net_timeout=50; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30; +Reload slave +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 30.000 +SET @restore_slave_net_timeout=@@global.slave_net_timeout; + +*** Disable heartbeat *** +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 0.000 +SHOW STATUS LIKE 'slave_received_heartbeats'; +Variable_name Value +Slave_received_heartbeats 0 +include/start_slave.inc +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 0.000 +SHOW STATUS LIKE 'slave_received_heartbeats'; +Variable_name Value +Slave_received_heartbeats 0 +include/stop_slave.inc +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 0.000 +SHOW STATUS LIKE 'slave_received_heartbeats'; +Variable_name Value +Slave_received_heartbeats 0 +RESET SLAVE; +SELECT SLAVE_HEARTBEAT_TIMEOUT = 0 AS Result; +Result +0 + +*** Min slave_heartbeat_timeout *** +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 0.001 +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009; +Warnings: +Warning 1624 The requested value for the heartbeat period is less than 1 msec. The period is reset to zero which means no heartbeats will be sending +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 0.000 +RESET SLAVE; + +*** Max slave_heartbeat_timeout *** +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967; +Warnings: +Warning 1624 The requested value for the heartbeat period exceeds the value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout. +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +Variable_name Value +Slave_heartbeat_period 4294967.000 +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968; +ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935; +ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296; +ERROR HY000: The requested value for the heartbeat period is negative or exceeds the maximum 4294967 seconds +RESET SLAVE; + +*** Misc incorrect values *** +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''-1'' at line 1 +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc'; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''123abc'' at line 1 +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=''; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 1 +RESET SLAVE; + +*** Running slave *** +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +include/start_slave.inc +Heartbeat event received + +*** Stopped slave *** +include/stop_slave.inc +Number of received heartbeat events while slave stopped: 0 + +*** Started slave *** +include/start_slave.inc +Heartbeat event received + +*** Stopped IO thread *** +STOP SLAVE IO_THREAD; +Number of received heartbeat events while io thread stopped: 0 + +*** Started IO thread *** +START SLAVE IO_THREAD; +Heartbeat event received + +*** Stopped SQL thread *** +STOP SLAVE SQL_THREAD; +Heartbeat events are received while sql thread stopped (1 means 'yes'): 1 + +*** Started SQL thread *** +START SLAVE SQL_THREAD; +Heartbeat event received + +*** Stopped SQL thread by error *** +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT); +INSERT INTO t1 VALUES (1, 'on slave', NULL); +INSERT INTO t1 VALUES (1, 'on master', NULL); +Heartbeat events are received while sql thread stopped (1 means 'yes'): 1 +include/stop_slave.inc +DROP TABLE t1; + +*** Master send to slave *** +CREATE EVENT e1 +ON SCHEDULE EVERY 1 SECOND +DO +BEGIN +UPDATE test.t1 SET a = a + 1 WHERE a < 10; +END| +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1.5; +include/start_slave.inc +SET @@global.event_scheduler=1; +SHOW STATUS LIKE 'slave_received_heartbeats'; +Variable_name Value +Slave_received_heartbeats 0 +SHOW STATUS LIKE 'slave_received_heartbeats'; +Variable_name Value +Slave_received_heartbeats 0 +DELETE FROM t1; +DROP EVENT e1; + +*** Flush logs on slave *** +STOP SLAVE; +RESET SLAVE; +DROP TABLE t1; +DROP TABLE t1; +RESET MASTER; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5; +include/start_slave.inc +Heartbeat events are received while rotation of relay logs (1 means 'yes'): 1 + +*** Compressed protocol *** +SET @@global.slave_compressed_protocol=1; +include/stop_slave.inc +RESET SLAVE; +SET @@global.slave_compressed_protocol=1; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +include/start_slave.inc +Heartbeat event received +SET @@global.slave_compressed_protocol=0; +SET @@global.slave_compressed_protocol=0; + +*** Reset master *** +STOP SLAVE; +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +include/start_slave.inc +RESET MASTER; +Heartbeat events are received after reset of master (1 means 'yes'): 1 + +*** Reload master *** +STOP SLAVE; +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +include/start_slave.inc +Heartbeat event received +Reload master +Heartbeat event received + +*** Circular replication *** +RESET MASTER; +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)); +include/stop_slave.inc +RESET MASTER; +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='MASTER_BINLOG'; +RESET SLAVE; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='SLAVE_BINLOG'; +include/start_slave.inc +INSERT INTO t1 VALUES(1, 'on master'); +include/start_slave.inc +INSERT INTO t1 VALUES(2, 'on slave'); +SELECT * FROM t1 ORDER BY a; +a b +1 on master +2 on slave +SELECT * FROM t1 ORDER BY a; +a b +1 on master +2 on slave +Heartbeat event received on master +Heartbeat event received on slave +Slave has received more events than master (1 means 'yes'): 1 + +*** Clean up *** +include/stop_slave.inc +DROP TABLE t1; +include/stop_slave.inc +SET @@global.slave_net_timeout=@restore_slave_net_timeout; + +End of 6.0 test diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result b/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result new file mode 100644 index 00000000000..42de3c459cb --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result @@ -0,0 +1,27 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +*** Heartbeat over SSL *** +include/stop_slave.inc +RESET SLAVE; +CHANGE MASTER TO +MASTER_HOST='127.0.0.1', +MASTER_PORT=MASTER_PORT, +MASTER_USER='root', +MASTER_HEARTBEAT_PERIOD=0.1, +MASTER_LOG_FILE='MASTER_BINLOG', +MASTER_SSL=1, +MASTER_SSL_CA='MYSQL_TEST_DIR/std_data/cacert.pem', +MASTER_SSL_CERT='MYSQL_TEST_DIR/std_data/client-cert.pem', +MASTER_SSL_KEY='MYSQL_TEST_DIR/std_data/client-key.pem'; +include/start_slave.inc +Master_SSL_Allowed: Yes +Heartbeat event has received + +*** Clean up *** + +End of 6.0 test diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf new file mode 100644 index 00000000000..a3ed77c8bd2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.cnf @@ -0,0 +1,17 @@ +!include ../my.cnf + +[mysqld.1] +server_id=1 + +[mysqld.2] +server_id=2 + +[mysqld.3] +server_id=3 + +[ENV] +SLAVE_MYPORT1= @mysqld.3.port +SLAVE_MYSOCK1= @mysqld.3.socket + + + diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test new file mode 100644 index 00000000000..81737feea9e --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_2slaves.test @@ -0,0 +1,142 @@ +############################################################# +# Author: Serge Kozlov +# Date: 02/19/2009 +# Purpose: Testing heartbeat for schema +# 1 master and 2 slaves +############################################################# +--source include/master-slave.inc +--echo + +--echo *** Preparing *** +--connection master +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +--connection slave +--echo [on slave] +--source include/stop_slave.inc +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT $binlog_file MASTER_BINLOG +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='$binlog_file'; +--source include/start_slave.inc +--disconnect slave1 +--connect(slave1,127.0.0.1,root,,test,$SLAVE_MYPORT1,) +--connection slave1 +--echo [on slave1] +--disable_warnings +STOP SLAVE; +--enable_warnings +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT $binlog_file MASTER_BINLOG +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$binlog_file'; +--source include/start_slave.inc +--echo + +# +# Testing heartbeat +# + +# Check that heartbeat events sent to both slaves with correct periods +--echo *** 2 slaves *** +--connection slave +let $status_var= slave_received_heartbeats; +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Slave has received heartbeat event +--connection slave1 +let $status_var= slave_received_heartbeats; +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +let $slave1_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +--echo Slave1 has received heartbeat event +--connection slave +let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $result= query_get_value(SELECT ($slave_rcvd_heartbeats DIV $slave1_rcvd_heartbeats) > 1 AS Result, Result, 1); +--echo Slave has received more heartbeats than Slave1 (1 means 'yes'): $result +--echo + + +# Create topology A->B->C and check that C receives heartbeat while B gets data +# Slave1 (B) started w/o --log-slave-updates because B should not send data from A to C +--echo *** Master->data->Slave1->heartbeat->Slave: *** +--connection slave1 +--echo [on slave1] +RESET MASTER; +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +--connection slave +--echo [on slave] +--source include/stop_slave.inc +RESET SLAVE; +--replace_result $SLAVE_MYPORT1 SLAVE1_PORT $binlog_file SLAVE1_BINLOG +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT1, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.2, MASTER_LOG_FILE='$binlog_file'; +--source include/start_slave.inc +# Check heartbeat for new replication channel slave1->slave +let $status_var= slave_received_heartbeats; +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Slave has received heartbeat event +--connection master +--echo [on master] +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT); +INSERT INTO t1 VALUES (1, 'on master', ''); +--save_master_pos +SHOW TABLES; +--connection slave1 +--sync_with_master 0 +--echo [on slave1] +SHOW TABLES; +let $slave_pos_before= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); +--save_master_pos +--connection slave +--sync_with_master 0 +--echo [on slave] +SHOW TABLES; +--connection master +--echo [on master] +--echo creating updates on master and send to slave1 during 5 second +# Generate events on master and send to slave1 during 5 second +let $i= 1; +let $j= 1; +let $k= 1; +--disable_query_log +while ($i) { + eval SET @c_text=REPEAT('1234567890', $j); + eval UPDATE t1 SET a=$j, c=@c_text; + --connection slave1 + let $slave_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1); + if (`SELECT ($k*($slave_pos - $slave_pos_before)) > 0`) { + --connection slave + let $slave_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); + let $k= 0; + let $time_before = `SELECT NOW()`; + } + if (`SELECT ((1-$k)*TIMESTAMPDIFF(SECOND,'$time_before',NOW())) > 5`) { + --connection slave + let $slave_rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); + let $i= 0; + } + --connection master + inc $j; + sleep 0.1; +} +--enable_query_log +--connection slave +--echo [on slave] +let $result= query_get_value(SELECT ($slave_rcvd_heartbeats_after - $slave_rcvd_heartbeats_before) > 0 AS Result, Result, 1); +--echo Slave has received heartbeats (1 means 'yes'): $result +--echo + +# +# Clean up +# +--echo *** Clean up *** +--connection master +DROP TABLE t1; +--save_master_pos +--connection slave1 +--sync_with_master 0 +--echo + +# End of 6.0 test +--echo End of 6.0 test diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf new file mode 100644 index 00000000000..a4a291bca79 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.cnf @@ -0,0 +1,7 @@ +!include ../my.cnf + +[mysqld.1] +log-slave-updates + +[mysqld.2] +log-slave-updates diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test new file mode 100644 index 00000000000..198f1208344 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test @@ -0,0 +1,536 @@ +############################################################# +# Author: Serge Kozlov +# Date: 02/19/2009 +# Purpose: Testing basic functionality of heartbeat. +# Description: +# * Testing different values for slave_heartbeat_period. +# * How to affect various statements to slave_heartbeat_period +# * Various states of slave and heartbeat +# * Various states of master and heartbeat +# * Circular replication +############################################################# +--source include/master-slave.inc +--echo + +--echo *** Preparing *** +--connection slave +--source include/stop_slave.inc +RESET SLAVE; +SET @restore_slave_net_timeout=@@global.slave_net_timeout; +let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1); +--disable_query_log +eval SET @restore_slave_heartbeat_timeout=$slave_heartbeat_timeout; +--enable_query_log + +--connection master +RESET MASTER; +SET @restore_slave_net_timeout=@@global.slave_net_timeout; +SET @restore_event_scheduler=@@global.event_scheduler; +--echo + +# +# Test slave_heartbeat_period +# + +--connection slave + +# Default value of slave_heartbeat_timeout = slave_net_timeout/2 +--echo *** Default value *** +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root'; +let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout', Value, 1); +let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1); +let $result= query_get_value(SELECT $slave_net_timeout/$slave_heartbeat_timeout AS Result, Result, 1); +--echo slave_net_timeout/slave_heartbeat_timeout=$result +RESET SLAVE; +--echo + +# Reset slave set slave_heartbeat_timeout = slave_net_timeout/2 +--echo *** Reset slave affect *** +--disable_warnings +SET @@global.slave_net_timeout=30; +--enable_warnings +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; +RESET SLAVE; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +--echo + +# Check default value of slave_heartbeat_timeout if slave_net_timeout is changed +--echo *** Default value if slave_net_timeout changed *** +--disable_warnings +SET @@global.slave_net_timeout=50; +--enable_warnings +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root'; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +RESET SLAVE; +--echo + +# Set slave_net_timeout less than current value of slave_heartbeat_period +--echo *** Warning if updated slave_net_timeout < slave_heartbeat_timeout *** +let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1); +--replace_result $slave_heartbeat_timeout SLAVE_HEARTBEAT_TIMEOUT +eval SET @@global.slave_net_timeout=FLOOR($slave_heartbeat_timeout)-1; +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +RESET SLAVE; +--echo + +# Set value of slave_heartbeat_period greater than slave_net_timeout +--echo *** Warning if updated slave_heartbeat_timeout > slave_net_timeout *** +let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout', Value, 1); +inc $slave_net_timeout; +--replace_result $MASTER_MYPORT MASTER_PORT $slave_net_timeout SLAVE_NET_TIMEOUT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=$slave_net_timeout; +RESET SLAVE; +--echo + +# Changing of slave_net_timeout shouldn't affect to current value of slave_heartbeat_period +--echo *** CHANGE MASTER statement only updates slave_heartbeat_period *** +--disable_warnings +SET @@global.slave_net_timeout=20; +--enable_warnings +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; +SHOW VARIABLES LIKE 'slave_net_timeout'; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +SET @@global.slave_net_timeout=2*@@global.slave_net_timeout; +SHOW VARIABLES LIKE 'slave_net_timeout'; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +RESET SLAVE; +--echo + +# Master value of slave_net_timeout shouldn't affect to slave's slave_heartbeat_period +--echo *** Update slave_net_timeout on master *** +--connection master +--disable_warnings +SET @@global.slave_net_timeout=500; +--enable_warnings +--connection slave +SET @@global.slave_net_timeout=200; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root'; +--source include/start_slave.inc +--sync_with_master +SHOW VARIABLES LIKE 'slave_net_timeout'; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +--source include/stop_slave.inc +RESET SLAVE; +--connection master +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +--echo + +# Start/stop slave shouldn't change slave_heartbeat_period +--echo *** Start/stop slave *** +--connection slave +--disable_warnings +SET @@global.slave_net_timeout=100; +--enable_warnings +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=20; +--source include/start_slave.inc +--sync_with_master +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +--source include/stop_slave.inc +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +--echo + +# Reload slave shouldn't change slave_heartbeat_period +--echo *** Reload slave *** +--connection slave +--disable_warnings +SET @@global.slave_net_timeout=50; +--enable_warnings +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=30; +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +wait +EOF +--echo Reload slave +--shutdown_server 10 +--source include/wait_until_disconnected.inc +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +SET @restore_slave_net_timeout=@@global.slave_net_timeout; +--echo + +# Disable heartbeat +--echo *** Disable heartbeat *** +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +SHOW STATUS LIKE 'slave_received_heartbeats'; +--source include/start_slave.inc +--sync_with_master +--sleep 2 +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +SHOW STATUS LIKE 'slave_received_heartbeats'; +--source include/stop_slave.inc +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +SHOW STATUS LIKE 'slave_received_heartbeats'; +RESET SLAVE; +let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1); +--replace_result $slave_heartbeat_timeout SLAVE_HEARTBEAT_TIMEOUT +--eval SELECT $slave_heartbeat_timeout = 0 AS Result +--echo + +# +# Check limits for slave_heartbeat_timeout +# + +--echo *** Min slave_heartbeat_timeout *** +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.001; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.0009; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +RESET SLAVE; +--echo + +--echo *** Max slave_heartbeat_timeout *** +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967; +SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period'; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294968; +RESET SLAVE; +# Check double size of max allowed value for master_heartbeat_period +--replace_result $MASTER_MYPORT MASTER_PORT +--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=8589935; +RESET SLAVE; +# Check 2^32 +--replace_result $MASTER_MYPORT MASTER_PORT +--error ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=4294967296; +RESET SLAVE; +--echo + +--echo *** Misc incorrect values *** +--replace_result $MASTER_MYPORT MASTER_PORT +--error ER_PARSE_ERROR +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='-1'; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +--error ER_PARSE_ERROR +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD='123abc'; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +--error ER_PARSE_ERROR +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=''; +RESET SLAVE; +--echo + +# +# Testing heartbeat +# + +# Check received heartbeat events for running slave +--echo *** Running slave *** +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +--source include/start_slave.inc +--sync_with_master +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var= slave_received_heartbeats; +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Heartbeat event received +--echo + +# Check received heartbeat events for stopped slave +--echo *** Stopped slave *** +--source include/stop_slave.inc +let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +sleep 2; +let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) AS Result, Result, 1); +--echo Number of received heartbeat events while slave stopped: $result +--echo + +# Check received heartbeat events for started slave +--echo *** Started slave *** +--source include/start_slave.inc +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +--source include/wait_for_status_var.inc +--echo Heartbeat event received +--echo + +# Check received heartbeat events for stopped IO thread +--echo *** Stopped IO thread *** +STOP SLAVE IO_THREAD; +--source include/wait_for_slave_io_to_stop.inc +let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +sleep 2; +let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) AS Result, Result, 1); +--echo Number of received heartbeat events while io thread stopped: $result +--echo + +# Check received heartbeat events for started IO thread +--echo *** Started IO thread *** +START SLAVE IO_THREAD; +--source include/wait_for_slave_io_to_start.inc +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +--source include/wait_for_status_var.inc +--echo Heartbeat event received +--echo + +# Check received heartbeat events for stopped SQL thread +--echo *** Stopped SQL thread *** +STOP SLAVE SQL_THREAD; +--source include/wait_for_slave_sql_to_stop.inc +let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +sleep 2; +let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1); +--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result +--echo + +# Check received heartbeat events for started SQL thread +--echo *** Started SQL thread *** +START SLAVE SQL_THREAD; +--source include/wait_for_slave_sql_to_start.inc +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +--source include/wait_for_status_var.inc +--echo Heartbeat event received +--echo + +# Check received heartbeat event for stopped SQL thread by error +--echo *** Stopped SQL thread by error *** +--connection master +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10), c LONGTEXT); +--sync_slave_with_master +INSERT INTO t1 VALUES (1, 'on slave', NULL); +--connection master +INSERT INTO t1 VALUES (1, 'on master', NULL); +--connection slave +let $slave_errno= ER_DUP_ENTRY +--source include/wait_for_slave_sql_error.inc +let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +sleep 2; +let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1); +--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result +--source include/stop_slave.inc +DROP TABLE t1; +--echo + +# Check received heartbeat events while master send events to slave +--echo *** Master send to slave *** +--connection master +# Create the event that will update table t1 every second +DELIMITER |; +CREATE EVENT e1 + ON SCHEDULE EVERY 1 SECOND + DO + BEGIN + UPDATE test.t1 SET a = a + 1 WHERE a < 10; + END| +DELIMITER ;| +--connection slave +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1.5; +--source include/start_slave.inc +--connection master +# Enable scheduler +SET @@global.event_scheduler=1; +--connection slave +SHOW STATUS LIKE 'slave_received_heartbeats'; +--sync_with_master +# Wait some updates for table t1 from master +let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5; +--source include/wait_condition.inc +SHOW STATUS LIKE 'slave_received_heartbeats'; +--connection master +DELETE FROM t1; +DROP EVENT e1; +--echo + +# Check received heartbeat events while logs flushed on slave +--connection slave +--echo *** Flush logs on slave *** +STOP SLAVE; +RESET SLAVE; +DROP TABLE t1; +--connection master +DROP TABLE t1; +RESET MASTER; +--connection slave +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.5; +let $slave_param_comparison= =; +--source include/start_slave.inc +let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +# Flush logs every 0.1 second during 5 sec +--disable_query_log +let $i=50; +while ($i) { + FLUSH LOGS; + dec $i; + sleep 0.1; +} +--enable_query_log +let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1); +--echo Heartbeat events are received while rotation of relay logs (1 means 'yes'): $result +--echo + +# Use compressed protocol between master and slave +--echo *** Compressed protocol *** +--connection master +SET @@global.slave_compressed_protocol=1; +--connection slave +--source include/stop_slave.inc +RESET SLAVE; +SET @@global.slave_compressed_protocol=1; +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +--source include/start_slave.inc +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var= slave_received_heartbeats; +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Heartbeat event received +SET @@global.slave_compressed_protocol=0; +--connection master +SET @@global.slave_compressed_protocol=0; +--echo + + +# Check received heartbeat events after reset of master +--echo *** Reset master *** +--connection slave +STOP SLAVE; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +--source include/start_slave.inc +let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +--connection master +RESET MASTER; +--enable_query_log +--sync_slave_with_master +--sleep 2 +let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1); +--echo Heartbeat events are received after reset of master (1 means 'yes'): $result +--echo + +# Reloaded master should restore heartbeat +--echo *** Reload master *** +--connection slave +STOP SLAVE; +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1; +--source include/start_slave.inc +# Wait until slave_received_heartbeats will be incremented +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var= slave_received_heartbeats; +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Heartbeat event received +--connection master +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF +--echo Reload master +--shutdown_server 10 +--source include/wait_until_disconnected.inc +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF +--enable_reconnect +--source include/wait_until_connected_again.inc +--connection slave +# Wait until slave_received_heartbeats will be incremented +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var= slave_received_heartbeats; +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Heartbeat event received +--echo + +# Circular replication +--echo *** Circular replication *** +# Configure circular replication +--connection master +RESET MASTER; +let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1); +CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(10)); +--sync_slave_with_master +--source include/stop_slave.inc +RESET MASTER; +let $slave_binlog= query_get_value(SHOW MASTER STATUS, File, 1); +RESET SLAVE; +--replace_result $MASTER_MYPORT MASTER_PORT $master_binlog MASTER_BINLOG +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=0.1, MASTER_LOG_FILE='$master_binlog'; +--connection master +RESET SLAVE; +--replace_result $SLAVE_MYPORT SLAVE_PORT $slave_binlog SLAVE_BINLOG +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1, MASTER_LOG_FILE='$slave_binlog'; +--source include/start_slave.inc +# Insert data on master and on slave and make sure that it replicated for both directions +INSERT INTO t1 VALUES(1, 'on master'); +--save_master_pos +--connection slave +--source include/start_slave.inc +--sync_with_master +INSERT INTO t1 VALUES(2, 'on slave'); +--save_master_pos +--connection master +--sync_with_master +SELECT * FROM t1 ORDER BY a; +let $master_rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +--connection slave +SELECT * FROM t1 ORDER BY a; +# Wait heartbeat event on master +--connection master +let $status_var= slave_received_heartbeats; +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Heartbeat event received on master +let $master_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +# Wait heartbeat event on slave +--connection slave +let $status_var= slave_received_heartbeats; +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Heartbeat event received on slave +let $slave_rcvd_heartbeats= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +# Heartbeat period on slave less than on master therefore number of received events on slave +# should be greater than on master +let $result= query_get_value(SELECT ($slave_rcvd_heartbeats DIV $master_rcvd_heartbeats) > 1 AS Result, Result, 1); +--echo Slave has received more events than master (1 means 'yes'): $result +--echo + +# +# Clean up and restore system variables +# +--echo *** Clean up *** +--connection master +--source include/stop_slave.inc +DROP TABLE t1; +--sync_slave_with_master +--source include/stop_slave.inc +SET @@global.slave_net_timeout=@restore_slave_net_timeout; +--echo + +# End of 6.0 test +--echo End of 6.0 test diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test new file mode 100644 index 00000000000..6460b157b52 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test @@ -0,0 +1,54 @@ +############################################################# +# Author: Serge Kozlov +# Date: 02/19/2009 +# Purpose: Testing basic functionality of heartbeat over SSL +############################################################# +--source include/have_ssl_communication.inc +--source include/master-slave.inc +--echo + +# +# Testing heartbeat over SSL +# + +# Heartbeat over SSL +--echo *** Heartbeat over SSL *** +--connection master +let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1); +--connection slave +--source include/stop_slave.inc +RESET SLAVE; +# Connect to master with SSL +--replace_result $MASTER_MYPORT MASTER_PORT $MYSQL_TEST_DIR MYSQL_TEST_DIR $master_binlog MASTER_BINLOG +eval CHANGE MASTER TO + MASTER_HOST='127.0.0.1', + MASTER_PORT=$MASTER_MYPORT, + MASTER_USER='root', + MASTER_HEARTBEAT_PERIOD=0.1, + MASTER_LOG_FILE='$master_binlog', + MASTER_SSL=1, + MASTER_SSL_CA='$MYSQL_TEST_DIR/std_data/cacert.pem', + MASTER_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem', + MASTER_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem'; +--source include/start_slave.inc +# Check SSL state of slave +let $slave_ssl_status= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1); +--echo Master_SSL_Allowed: $slave_ssl_status +# Wait until hearbeat event will received +let $status_var_value= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $status_var= slave_received_heartbeats; +let $status_var_comparsion= >; +--source include/wait_for_status_var.inc +--echo Heartbeat event has received +--echo + +# +# Clean up +# +--echo *** Clean up *** +--connection master +--sync_slave_with_master +--echo + +# End of 6.0 test +--echo End of 6.0 test From ab6d244f518079524daf74242921063fd71fc929 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Sat, 3 Oct 2009 09:40:32 +0800 Subject: [PATCH 75/88] Post fix result file --- mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result index 482d43c8f10..4675216f9a2 100644 --- a/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result +++ b/mysql-test/suite/rpl_ndb/r/rpl_ndb_sp006.result @@ -4,7 +4,8 @@ reset master; reset slave; drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; start slave; -create database if not exists mysqltest1; +drop database if exists mysqltest1; +create database mysqltest1; DROP PROCEDURE IF EXISTS mysqltest1.p1; DROP PROCEDURE IF EXISTS mysqltest1.p2; DROP TABLE IF EXISTS mysqltest1.t2; From d8b4e637a07cea438c03747e33a7d82a18aa5e71 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Sat, 3 Oct 2009 13:00:05 +0800 Subject: [PATCH 76/88] Fix semisync master/slave status always showed as OFF on sparc On sparc, semisync master/slave status is always showed as OFF, this is fixed by change rpl_semisync_master/slave_status variables from long to char. --- plugin/semisync/semisync_master.cc | 2 +- plugin/semisync/semisync_master.h | 2 +- plugin/semisync/semisync_slave.cc | 2 +- plugin/semisync/semisync_slave.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index b3454c49829..3641b658268 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -25,7 +25,7 @@ char rpl_semi_sync_master_enabled; unsigned long rpl_semi_sync_master_timeout; unsigned long rpl_semi_sync_master_trace_level; -unsigned long rpl_semi_sync_master_status = 0; +char rpl_semi_sync_master_status = 0; unsigned long rpl_semi_sync_master_yes_transactions = 0; unsigned long rpl_semi_sync_master_no_transactions = 0; unsigned long rpl_semi_sync_master_off_times = 0; diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h index a1697b2ae67..bb63cece18a 100644 --- a/plugin/semisync/semisync_master.h +++ b/plugin/semisync/semisync_master.h @@ -347,7 +347,7 @@ class ReplSemiSyncMaster extern char rpl_semi_sync_master_enabled; extern unsigned long rpl_semi_sync_master_timeout; extern unsigned long rpl_semi_sync_master_trace_level; -extern unsigned long rpl_semi_sync_master_status; +extern char rpl_semi_sync_master_status; extern unsigned long rpl_semi_sync_master_yes_transactions; extern unsigned long rpl_semi_sync_master_no_transactions; extern unsigned long rpl_semi_sync_master_off_times; diff --git a/plugin/semisync/semisync_slave.cc b/plugin/semisync/semisync_slave.cc index f6bbb17ce9d..3298ce316a8 100644 --- a/plugin/semisync/semisync_slave.cc +++ b/plugin/semisync/semisync_slave.cc @@ -17,7 +17,7 @@ #include "semisync_slave.h" char rpl_semi_sync_slave_enabled; -unsigned long rpl_semi_sync_slave_status= 0; +char rpl_semi_sync_slave_status= 0; unsigned long rpl_semi_sync_slave_trace_level; int ReplSemiSyncSlave::initObject() diff --git a/plugin/semisync/semisync_slave.h b/plugin/semisync/semisync_slave.h index 73bc8aeeade..16fa31c69eb 100644 --- a/plugin/semisync/semisync_slave.h +++ b/plugin/semisync/semisync_slave.h @@ -94,6 +94,6 @@ private: /* System and status variables for the slave component */ extern char rpl_semi_sync_slave_enabled; extern unsigned long rpl_semi_sync_slave_trace_level; -extern unsigned long rpl_semi_sync_slave_status; +extern char rpl_semi_sync_slave_status; #endif /* SEMISYNC_SLAVE_H */ From d77bd29c69ef749469faa7fb07294b81152aed46 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Sat, 3 Oct 2009 22:21:44 +0400 Subject: [PATCH 77/88] WL#3788 It is backport patch. This adds new test case for testing affects of some variables to replication. --- .../suite/rpl/r/rpl_spec_variables.result | 225 +++++++++++++ .../suite/rpl/t/rpl_spec_variables-slave.opt | 1 + .../suite/rpl/t/rpl_spec_variables.test | 306 ++++++++++++++++++ 3 files changed, 532 insertions(+) create mode 100644 mysql-test/suite/rpl/r/rpl_spec_variables.result create mode 100644 mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt create mode 100644 mysql-test/suite/rpl/t/rpl_spec_variables.test diff --git a/mysql-test/suite/rpl/r/rpl_spec_variables.result b/mysql-test/suite/rpl/r/rpl_spec_variables.result new file mode 100644 index 00000000000..ea2778bf71c --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_spec_variables.result @@ -0,0 +1,225 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; + +* auto_increment_increment, auto_increment_offset * +SET @@global.auto_increment_increment=2; +SET @@session.auto_increment_increment=2; +SET @@global.auto_increment_offset=10; +SET @@session.auto_increment_offset=10; +SET @@global.auto_increment_increment=3; +SET @@session.auto_increment_increment=3; +SET @@global.auto_increment_offset=20; +SET @@session.auto_increment_offset=20; +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES ('master'); +INSERT INTO t1 (b) VALUES ('master'); +SELECT * FROM t1 ORDER BY a; +a b +2 master +4 master +CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES ('slave'); +INSERT INTO t1 (b) VALUES ('slave'); +INSERT INTO t2 (b) VALUES ('slave'); +INSERT INTO t2 (b) VALUES ('slave'); +SELECT * FROM t1 ORDER BY a; +a b +2 master +4 master +7 slave +10 slave +SELECT * FROM t2 ORDER BY a; +a b +1 slave +4 slave +DROP TABLE IF EXISTS t1,t2; +SET @@global.auto_increment_increment=1; +SET @@session.auto_increment_increment=1; +SET @@global.auto_increment_offset=1; +SET @@session.auto_increment_offset=1; +SET @@global.auto_increment_increment=1; +SET @@session.auto_increment_increment=1; +SET @@global.auto_increment_offset=1; +SET @@session.auto_increment_offset=1; +SET auto_increment_increment=1; +SET auto_increment_offset=1; + +* character_set_database, collation_server * +SET @restore_master_character_set_database=@@global.character_set_database; +SET @restore_master_collation_server=@@global.collation_server; +SET @@global.character_set_database=latin1; +SET @@session.character_set_database=latin1; +SET @@global.collation_server=latin1_german1_ci; +SET @@session.collation_server=latin1_german1_ci; +SET @restore_slave_character_set_database=@@global.character_set_database; +SET @restore_slave_collation_server=@@global.collation_server; +SET @@global.character_set_database=utf8; +SET @@session.character_set_database=utf8; +SET @@global.collation_server=utf8_bin; +SET @@session.collation_server=utf8_bin; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(10) COLLATE latin1_german1_ci DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci +CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(10) COLLATE latin1_german1_ci DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL, + `b` varchar(10) COLLATE utf8_bin DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin +SET @@global.collation_server=latin1_swedish_ci; +SET @@session.collation_server=latin1_swedish_ci; +SET @@global.collation_server=latin1_swedish_ci; +SET @@session.collation_server=latin1_swedish_ci; +DROP TABLE IF EXISTS t1,t2; + +* default_week_format * +SET @@global.default_week_format=0; +SET @@session.default_week_format=0; +SET @@global.default_week_format=1; +SET @@session.default_week_format=1; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1, 'master ', WEEK('2008-01-07')); +SELECT * FROM t1 ORDER BY a; +a b c +1 master 1 +INSERT INTO t1 VALUES (2, 'slave ', WEEK('2008-01-07')); +SELECT * FROM t1 ORDER BY a; +a b c +1 master 1 +2 slave 2 +DROP TABLE t1; +SET @@global.default_week_format=0; +SET @@session.default_week_format=0; + +* local_infile * +SET @@global.local_infile=0; +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(20), c CHAR(254)) ENGINE=MyISAM; +LOAD DATA LOCAL INFILE 'FILE' INTO TABLE t1 (b); +SELECT COUNT(*) FROM t1; +COUNT(*) +70 +LOAD DATA LOCAL INFILE 'FILE2' INTO TABLE t1 (b); +ERROR 42000: The used command is not allowed with this MySQL version +SELECT COUNT(*) FROM t1; +COUNT(*) +70 +SET @@global.local_infile=1; +DROP TABLE t1; + +* max_heap_table_size * +SET @restore_slave_max_heap_table_size=@@global.max_heap_table_size; +SET @@global.max_heap_table_size=16384; +SET @@session.max_heap_table_size=16384; +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY; +SELECT COUNT(*)=2000 FROM t1; +COUNT(*)=2000 +1 +SELECT COUNT(*)=2000 FROM t1 WHERE b='master' GROUP BY b ORDER BY b; +COUNT(*)=2000 +1 +SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t1 WHERE b='slave' GROUP BY b ORDER BY b; +COUNT(*)<2000 AND COUNT(*)>0 +1 +SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t2 WHERE b='slave' GROUP BY b ORDER BY b; +COUNT(*)<2000 AND COUNT(*)>0 +1 +DROP TABLE IF EXISTS t1,t2; + +* storage_engine * +SET @restore_master_storage_engine=@@global.storage_engine; +SET @@global.storage_engine=InnoDB; +SET @@session.storage_engine=InnoDB; +SET @restore_slave_storage_engine=@@global.storage_engine; +SET @@global.storage_engine=Memory; +SET @@session.storage_engine=Memory; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)); +CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; +CREATE TABLE t3 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t3; +Table Create Table +t3 CREATE TABLE `t3` ( + `a` int(11) NOT NULL, + `b` varchar(10) DEFAULT NULL, + PRIMARY KEY (`a`) +) ENGINE=MEMORY DEFAULT CHARSET=latin1 +SET @@global.storage_engine=InnoDB; +SET @@session.storage_engine=InnoDB; +DROP TABLE IF EXISTS t1,t2,t3; + +* sql_mode * +SET @@global.sql_mode=ANSI; +SET @@session.sql_mode=ANSI; +SET @@global.sql_mode=TRADITIONAL; +SET @@session.sql_mode=TRADITIONAL; +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c DATE); +INSERT INTO t1 VALUES (1, 'master', '0000-00-00'); +SELECT * FROM t1 ORDER BY a; +a b c +1 master 0000-00-00 +INSERT INTO t1 VALUES (1, 'slave', '0000-00-00'); +ERROR 22007: Incorrect date value: '0000-00-00' for column 'c' at row 1 +SELECT * FROM t1 ORDER BY a; +a b c +1 master 0000-00-00 +SET @@global.sql_mode=''; +SET @@session.sql_mode=''; +SET @@global.sql_mode=''; +SET @@session.sql_mode=''; +DROP TABLE t1; + +*** clean up *** +SET @@global.character_set_database=@restore_master_character_set_database; +SET @@global.collation_server=@restore_master_collation_server; +SET @@global.storage_engine=@restore_master_storage_engine; +SET @@global.character_set_database=@restore_slave_character_set_database; +SET @@global.collation_server=@restore_slave_collation_server; +SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size; +SET @@global.storage_engine=@restore_slave_storage_engine; + +call mtr.add_suppression("The table 't[12]' is full"); diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt b/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt new file mode 100644 index 00000000000..627becdbfb5 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_spec_variables-slave.opt @@ -0,0 +1 @@ +--innodb diff --git a/mysql-test/suite/rpl/t/rpl_spec_variables.test b/mysql-test/suite/rpl/t/rpl_spec_variables.test new file mode 100644 index 00000000000..a60738316c8 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_spec_variables.test @@ -0,0 +1,306 @@ +############################################################# +# Author: Serge Kozlov +# Date: 07/01/2008 +# Purpose: Testing possible affects of some system dynamic +# variables to the replication. +# Scenario for each variable: +# 1) Set different values for master and slave +# 2) Create and replicate a data from master to slave +# 3) Check results on master and slave: changes on slave +# shouldn't be affected to replicated data. +############################################################# +--source include/have_innodb.inc +--source include/master-slave.inc +--echo + +# +# AUTO_INCREMENT +# +--echo * auto_increment_increment, auto_increment_offset * + +--connection master +SET @@global.auto_increment_increment=2; +SET @@session.auto_increment_increment=2; +SET @@global.auto_increment_offset=10; +SET @@session.auto_increment_offset=10; + +--connection slave +SET @@global.auto_increment_increment=3; +SET @@session.auto_increment_increment=3; +SET @@global.auto_increment_offset=20; +SET @@session.auto_increment_offset=20; + +--connection master +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES ('master'); +INSERT INTO t1 (b) VALUES ('master'); +SELECT * FROM t1 ORDER BY a; + +--sync_slave_with_master +CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +INSERT INTO t1 (b) VALUES ('slave'); +INSERT INTO t1 (b) VALUES ('slave'); +INSERT INTO t2 (b) VALUES ('slave'); +INSERT INTO t2 (b) VALUES ('slave'); +SELECT * FROM t1 ORDER BY a; +SELECT * FROM t2 ORDER BY a; + +--connection master +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings +SET @@global.auto_increment_increment=1; +SET @@session.auto_increment_increment=1; +SET @@global.auto_increment_offset=1; +SET @@session.auto_increment_offset=1; + +--connection slave +SET @@global.auto_increment_increment=1; +SET @@session.auto_increment_increment=1; +SET @@global.auto_increment_offset=1; +SET @@session.auto_increment_offset=1; + +--connection slave +SET auto_increment_increment=1; +SET auto_increment_offset=1; +--echo + +# +# CHARACTER_SET_DATABASE, COLLATION_SERVER +# +--echo * character_set_database, collation_server * + +--connection master +SET @restore_master_character_set_database=@@global.character_set_database; +SET @restore_master_collation_server=@@global.collation_server; +SET @@global.character_set_database=latin1; +SET @@session.character_set_database=latin1; +SET @@global.collation_server=latin1_german1_ci; +SET @@session.collation_server=latin1_german1_ci; + +--connection slave +SET @restore_slave_character_set_database=@@global.character_set_database; +SET @restore_slave_collation_server=@@global.collation_server; +SET @@global.character_set_database=utf8; +SET @@session.character_set_database=utf8; +SET @@global.collation_server=utf8_bin; +SET @@session.collation_server=utf8_bin; + +--connection master +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; + +--sync_slave_with_master +CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=MyISAM; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +SET @@global.collation_server=latin1_swedish_ci; +SET @@session.collation_server=latin1_swedish_ci; + +--connection master +SET @@global.collation_server=latin1_swedish_ci; +SET @@session.collation_server=latin1_swedish_ci; + +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings +--echo + +# +# DEFAULT_WEEK_FORMAT +# +--echo * default_week_format * + +--connection master +SET @@global.default_week_format=0; +SET @@session.default_week_format=0; + +--connection slave +SET @@global.default_week_format=1; +SET @@session.default_week_format=1; + +--connection master +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1, 'master ', WEEK('2008-01-07')); +SELECT * FROM t1 ORDER BY a; + +--sync_slave_with_master +INSERT INTO t1 VALUES (2, 'slave ', WEEK('2008-01-07')); +SELECT * FROM t1 ORDER BY a; + +--connection master +DROP TABLE t1; + +--connection slave +SET @@global.default_week_format=0; +SET @@session.default_week_format=0; +--echo + +# +# LOCAL_INFILE +# +--echo * local_infile * + +--connection slave +SET @@global.local_infile=0; + +--connection master +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(20), c CHAR(254)) ENGINE=MyISAM; +--copy_file ./std_data/words.dat $MYSQLTEST_VARDIR/tmp/words.dat +--copy_file ./std_data/words2.dat $MYSQLTEST_VARDIR/tmp/words2.dat +--replace_regex /\'.+\'/'FILE'/ +--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/words.dat' INTO TABLE t1 (b) +SELECT COUNT(*) FROM t1; +--sync_slave_with_master +--replace_regex /\'.+\'/'FILE2'/ +--error 1148 +--eval LOAD DATA LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/words2.dat' INTO TABLE t1 (b) +SELECT COUNT(*) FROM t1; + +SET @@global.local_infile=1; + +--connection master +DROP TABLE t1; +--echo + +# +# MAX_HEAP_TABLE_SIZE +# +--echo * max_heap_table_size * + +--connection slave +SET @restore_slave_max_heap_table_size=@@global.max_heap_table_size; +SET @@global.max_heap_table_size=16384; +SET @@session.max_heap_table_size=16384; + +--connection master +CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY; +let $counter=2000; +--disable_query_log +while ($counter) { + INSERT INTO t1 (b,c) VALUES ('master', REPEAT('A', 254)); + dec $counter; +} +--enable_query_log +SELECT COUNT(*)=2000 FROM t1; + +--sync_slave_with_master +let $counter=2000; +--disable_query_log +while ($counter) { + --error 0,1114 + INSERT INTO t1 (b,c) VALUES ('slave', REPEAT('A', 254)); + dec $counter; +} +CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT PRIMARY KEY, b VARCHAR(10), c CHAR(254)) ENGINE=MEMORY; +let $counter=2000; +--disable_query_log +while ($counter) { + --error 0,1114 + INSERT INTO t2 (b,c) VALUES ('slave', REPEAT('A', 254)); + dec $counter; +} +--enable_query_log +# We don't know how many memory used and can't check exact values so need to check following +# conditions +SELECT COUNT(*)=2000 FROM t1 WHERE b='master' GROUP BY b ORDER BY b; +SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t1 WHERE b='slave' GROUP BY b ORDER BY b; +SELECT COUNT(*)<2000 AND COUNT(*)>0 FROM t2 WHERE b='slave' GROUP BY b ORDER BY b; + +--connection master +--disable_warnings +DROP TABLE IF EXISTS t1,t2; +--enable_warnings +--echo + +# +# STORAGE_ENGINE +# +--echo * storage_engine * + +--connection master +SET @restore_master_storage_engine=@@global.storage_engine; +SET @@global.storage_engine=InnoDB; +SET @@session.storage_engine=InnoDB; + +--connection slave +SET @restore_slave_storage_engine=@@global.storage_engine; +SET @@global.storage_engine=Memory; +SET @@session.storage_engine=Memory; + +--connection master +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)); +CREATE TABLE t2 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)) ENGINE=InnoDB; + +--sync_slave_with_master +CREATE TABLE t3 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10)); + +--connection master +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +--connection slave +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; +SHOW CREATE TABLE t3; + +SET @@global.storage_engine=InnoDB; +SET @@session.storage_engine=InnoDB; + +--connection master +--disable_warnings +DROP TABLE IF EXISTS t1,t2,t3; +--enable_warnings +--echo + +# +# SQL_MODE +# +--echo * sql_mode * + +--connection master +SET @@global.sql_mode=ANSI; +SET @@session.sql_mode=ANSI; + +--connection slave +SET @@global.sql_mode=TRADITIONAL; +SET @@session.sql_mode=TRADITIONAL; + +--connection master +CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY, b VARCHAR(10), c DATE); +INSERT INTO t1 VALUES (1, 'master', '0000-00-00'); +SELECT * FROM t1 ORDER BY a; + +--sync_slave_with_master +--error 1292 +INSERT INTO t1 VALUES (1, 'slave', '0000-00-00'); +SELECT * FROM t1 ORDER BY a; +SET @@global.sql_mode=''; +SET @@session.sql_mode=''; + +--connection master +SET @@global.sql_mode=''; +SET @@session.sql_mode=''; +DROP TABLE t1; +--echo + + +# Clean up +--echo *** clean up *** +--connection master +SET @@global.character_set_database=@restore_master_character_set_database; +SET @@global.collation_server=@restore_master_collation_server; +SET @@global.storage_engine=@restore_master_storage_engine; +--sync_slave_with_master +SET @@global.character_set_database=@restore_slave_character_set_database; +SET @@global.collation_server=@restore_slave_collation_server; +SET @@global.max_heap_table_size=@restore_slave_max_heap_table_size; +SET @@global.storage_engine=@restore_slave_storage_engine; + +# Put at the end since the test otherwise emptied the table. + +--echo +call mtr.add_suppression("The table 't[12]' is full"); + +# End of 5.1 test From e4abe4eb3c719e251cec848fd99fa83a31113144 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Wed, 7 Oct 2009 01:05:27 +0300 Subject: [PATCH 78/88] correcting rpl_partition.result --- mysql-test/suite/parts/r/rpl_partition.result | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/suite/parts/r/rpl_partition.result b/mysql-test/suite/parts/r/rpl_partition.result index c2537815631..dfce1c3cdfa 100644 --- a/mysql-test/suite/parts/r/rpl_partition.result +++ b/mysql-test/suite/parts/r/rpl_partition.result @@ -177,6 +177,8 @@ Last_IO_Errno # Last_IO_Error # Last_SQL_Errno 0 Last_SQL_Error +Replicate_Ignore_Server_Ids +Master_Server_Id 1 SELECT count(*) "Slave norm" FROM t1; Slave norm 500 SELECT count(*) "Slave bykey" FROM t2; From 6507f04de26425cdd67ccf69313c563eb1b07f65 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Wed, 7 Oct 2009 19:44:01 +0400 Subject: [PATCH 79/88] WL#4641, Bug#43828: fix for rpl_heartbeat_basic.test: The issue appears when number of heartbeat events non-zero before start of test block. But really we need to check that no new events has received during test block. So I did following: 1. Replace absolute values by diff of values 2. Increase heartbeat period from 1.5 to 5 sec --- mysql-test/suite/rpl/r/rpl_heartbeat_basic.result | 9 ++------- mysql-test/suite/rpl/t/rpl_heartbeat_basic.test | 11 ++++++++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result index ddb2122c631..d229e1260dd 100644 --- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result @@ -220,15 +220,10 @@ BEGIN UPDATE test.t1 SET a = a + 1 WHERE a < 10; END| RESET SLAVE; -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1.5; +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; include/start_slave.inc SET @@global.event_scheduler=1; -SHOW STATUS LIKE 'slave_received_heartbeats'; -Variable_name Value -Slave_received_heartbeats 0 -SHOW STATUS LIKE 'slave_received_heartbeats'; -Variable_name Value -Slave_received_heartbeats 0 +Number of received heartbeat events: 0 DELETE FROM t1; DROP EVENT e1; diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test index 198f1208344..10d327eece0 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test @@ -343,23 +343,28 @@ DELIMITER ;| --connection slave RESET SLAVE; --replace_result $MASTER_MYPORT MASTER_PORT -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1.5; +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5; --source include/start_slave.inc --connection master # Enable scheduler SET @@global.event_scheduler=1; --connection slave -SHOW STATUS LIKE 'slave_received_heartbeats'; +let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); --sync_with_master # Wait some updates for table t1 from master let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5; --source include/wait_condition.inc -SHOW STATUS LIKE 'slave_received_heartbeats'; +let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1); +let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1); +--echo Number of received heartbeat events: $result --connection master DELETE FROM t1; DROP EVENT e1; --echo + + + # Check received heartbeat events while logs flushed on slave --connection slave --echo *** Flush logs on slave *** From 75a4dd3e6a1909110944bdbfd90d00b4a303e3b4 Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Wed, 7 Oct 2009 22:13:07 +0100 Subject: [PATCH 80/88] BUG#40611, BUG#44779: reverted in mysql-5.1-rep+2. --- .../binlog/r/binlog_max_extension.result | 8 -- .../suite/binlog/t/binlog_max_extension.test | 92 ------------------- sql/log.cc | 75 +++------------ sql/log.h | 13 --- 4 files changed, 14 insertions(+), 174 deletions(-) delete mode 100644 mysql-test/suite/binlog/r/binlog_max_extension.result delete mode 100644 mysql-test/suite/binlog/t/binlog_max_extension.test diff --git a/mysql-test/suite/binlog/r/binlog_max_extension.result b/mysql-test/suite/binlog/r/binlog_max_extension.result deleted file mode 100644 index af341db4536..00000000000 --- a/mysql-test/suite/binlog/r/binlog_max_extension.result +++ /dev/null @@ -1,8 +0,0 @@ -call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0."); -call mtr.add_suppression("Log filename extension number exhausted:"); -call mtr.add_suppression("Can't generate a unique log-filename"); -RESET MASTER; -FLUSH LOGS; -Warnings: -Warning 1098 Can't generate a unique log-filename master-bin.(1-999) - diff --git a/mysql-test/suite/binlog/t/binlog_max_extension.test b/mysql-test/suite/binlog/t/binlog_max_extension.test deleted file mode 100644 index 9f52d195e21..00000000000 --- a/mysql-test/suite/binlog/t/binlog_max_extension.test +++ /dev/null @@ -1,92 +0,0 @@ -# BUG#40611: MySQL cannot make a binary log after sequential number beyond -# unsigned long. -# -# Problem statement -# ================= -# -# Extension for log file names might be created with negative -# numbers (when counter used would wrap around), causing server -# failure when incrementing -00001 (reaching number 000000 -# extension). -# -# Test -# ==== -# This tests aims at testing the a patch that removes negatives -# numbers from log name extensions and checks that the server -# reports gracefully that the limit has been reached. -# -# It instruments index file to point to a log file close to -# the new maximum and calls flush logs to get warning. -# - -call mtr.add_suppression("Next log extension: 2147483647. Remaining log filename extensions: 0."); -call mtr.add_suppression("Log filename extension number exhausted:"); -call mtr.add_suppression("Can't generate a unique log-filename"); - - --- source include/have_log_bin.inc -RESET MASTER; - --- let $MYSQLD_DATADIR= `select @@datadir` - -############################################### -# check hitting maximum file name extension: -############################################### - -########## -# Prepare -########## - -# 1. Stop master server --- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF --- shutdown_server 10 --- source include/wait_until_disconnected.inc - -# 2. Prepare log and index file --- copy_file $MYSQLD_DATADIR/master-bin.index $MYSQLD_DATADIR/master-bin.index.orig --- copy_file $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.2147483646 --- append_file $MYSQLD_DATADIR/master-bin.index -master-bin.2147483646 -EOF - -# 3. Restart the server --- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF --- enable_reconnect --- source include/wait_until_connected_again.inc - -########### -# Assertion -########### - -# assertion: should throw warning -FLUSH LOGS; - -############## -# Clean up -############## - -# 1. Stop the server --- write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF --- shutdown_server 10 --- source include/wait_until_disconnected.inc - -# 2. Undo changes to index and log files --- remove_file $MYSQLD_DATADIR/master-bin.index --- copy_file $MYSQLD_DATADIR/master-bin.index.orig $MYSQLD_DATADIR/master-bin.index --- remove_file $MYSQLD_DATADIR/master-bin.index.orig - --- remove_file $MYSQLD_DATADIR/master-bin.2147483646 --- remove_file $MYSQLD_DATADIR/master-bin.2147483647 - -# 3. Restart the server --- append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart -EOF --- enable_reconnect --- source include/wait_until_connected_again.inc diff --git a/sql/log.cc b/sql/log.cc index 45d71379b9e..5926c2c036f 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -53,7 +53,7 @@ LOGGER logger; MYSQL_BIN_LOG mysql_bin_log(&sync_binlog_period); static bool test_if_number(const char *str, - ulong *res, bool allow_wildcards); + long *res, bool allow_wildcards); static int binlog_init(void *p); static int binlog_close_connection(handlerton *hton, THD *thd); static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv); @@ -1835,27 +1835,22 @@ static void setup_windows_event_source() /** Find a unique filename for 'filename.#'. - Set '#' to the number next to the maximum found in the most - recent log file extension. - - This function will return nonzero if: (i) the generated name - exceeds FN_REFLEN; (ii) if the number of extensions is exhausted; - or (iii) some other error happened while examining the filesystem. + Set '#' to a number as low as possible. @return - nonzero if not possible to get unique filename. + nonzero if not possible to get unique filename */ static int find_uniq_filename(char *name) { + long number; uint i; - char buff[FN_REFLEN], ext_buf[FN_REFLEN]; + char buff[FN_REFLEN]; struct st_my_dir *dir_info; reg1 struct fileinfo *file_info; - ulong max_found= 0, next= 0, number= 0; + ulong max_found=0; size_t buf_length, length; char *start, *end; - int error= 0; DBUG_ENTER("find_uniq_filename"); length= dirname_part(buff, name, &buf_length); @@ -1863,15 +1858,15 @@ static int find_uniq_filename(char *name) end= strend(start); *end='.'; - length= (size_t) (end - start + 1); + length= (size_t) (end-start+1); - if (!(dir_info= my_dir(buff,MYF(MY_DONT_SORT)))) + if (!(dir_info = my_dir(buff,MYF(MY_DONT_SORT)))) { // This shouldn't happen strmov(end,".1"); // use name+1 - DBUG_RETURN(1); + DBUG_RETURN(0); } file_info= dir_info->dir_entry; - for (i= dir_info->number_off_files ; i-- ; file_info++) + for (i=dir_info->number_off_files ; i-- ; file_info++) { if (bcmp((uchar*) file_info->name, (uchar*) start, length) == 0 && test_if_number(file_info->name+length, &number,0)) @@ -1881,44 +1876,9 @@ static int find_uniq_filename(char *name) } my_dirend(dir_info); - /* check if reached the maximum possible extension number */ - if ((max_found == MAX_LOG_UNIQUE_FN_EXT)) - { - sql_print_error("Log filename extension number exhausted: %06lu. \ -Please fix this by archiving old logs and \ -updating the index files.", max_found); - error= 1; - goto end; - } - - next= max_found + 1; - sprintf(ext_buf, "%06lu", next); *end++='.'; - - /* - Check if the generated extension size + the file name exceeds the - buffer size used. If one did not check this, then the filename might be - truncated, resulting in error. - */ - if (((strlen(ext_buf) + (end - name)) >= FN_REFLEN)) - { - sql_print_error("Log filename too large: %s%s (%lu). \ -Please fix this by archiving old logs and updating the \ -index files.", name, ext_buf, (strlen(ext_buf) + (end - name))); - error= 1; - goto end; - } - - sprintf(end, "%06lu", next); - - /* print warning if reaching the end of available extensions. */ - if ((next > (MAX_LOG_UNIQUE_FN_EXT - LOG_WARN_UNIQUE_FN_EXT_LEFT))) - sql_print_warning("Next log extension: %lu. \ -Remaining log filename extensions: %lu. \ -Please consider archiving some logs.", next, (MAX_LOG_UNIQUE_FN_EXT - next)); - -end: - DBUG_RETURN(error); + sprintf(end,"%06ld",max_found+1); + DBUG_RETURN(0); } @@ -2117,13 +2077,6 @@ int MYSQL_LOG::generate_new_name(char *new_name, const char *log_name) { if (find_uniq_filename(new_name)) { - /* - This should be treated as error once propagation of error further - up in the stack gets proper handling. - */ - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_NO_UNIQUE_LOGFILE, ER(ER_NO_UNIQUE_LOGFILE), - log_name); sql_print_error(ER(ER_NO_UNIQUE_LOGFILE), log_name); return 1; } @@ -4841,11 +4794,11 @@ void MYSQL_BIN_LOG::set_max_size(ulong max_size_arg) @retval 1 String is a number @retval - 0 String is not a number + 0 Error */ static bool test_if_number(register const char *str, - ulong *res, bool allow_wildcards) + long *res, bool allow_wildcards) { reg2 int flag; const char *start; diff --git a/sql/log.h b/sql/log.h index b22e22a2cf5..a31be6dcce6 100644 --- a/sql/log.h +++ b/sql/log.h @@ -121,19 +121,6 @@ extern TC_LOG_DUMMY tc_log_dummy; #define LOG_CLOSE_TO_BE_OPENED 2 #define LOG_CLOSE_STOP_EVENT 4 -/* - Maximum unique log filename extension. - Note: setting to 0x7FFFFFFF due to atol windows - overflow/truncate. - */ -#define MAX_LOG_UNIQUE_FN_EXT 0x7FFFFFFF - -/* - Number of warnings that will be printed to error log - before extension number is exhausted. -*/ -#define LOG_WARN_UNIQUE_FN_EXT_LEFT 1000 - class Relay_log_info; typedef struct st_log_info From 124ad21d015dc8c5a7bf074cab9007c0f9e9ee29 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Fri, 9 Oct 2009 16:26:37 +0300 Subject: [PATCH 81/88] backporting fixes of bug@45940 to 5.1-rpl+2 to cover failures rpl_heartbeat_* as well. --- .../rpl/r/rpl_row_stop_middle_update.result | 17 -- .../suite/rpl/r/rpl_stop_middle_group.result | 61 +++++++ .../t/rpl_row_stop_middle_update-master.opt | 1 - .../t/rpl_row_stop_middle_update-slave.opt | 1 - .../rpl/t/rpl_row_stop_middle_update.test | 32 ---- .../suite/rpl/t/rpl_stop_middle_group.test | 149 ++++++++++++++++++ sql/log_event.cc | 53 +++---- sql/log_event_old.cc | 59 +------ sql/rpl_rli.cc | 1 - sql/rpl_rli.h | 10 +- sql/slave.cc | 128 +++++++++++---- 11 files changed, 342 insertions(+), 170 deletions(-) delete mode 100644 mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result create mode 100644 mysql-test/suite/rpl/r/rpl_stop_middle_group.result delete mode 100644 mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt delete mode 100644 mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt delete mode 100644 mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test create mode 100644 mysql-test/suite/rpl/t/rpl_stop_middle_group.test diff --git a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result b/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result deleted file mode 100644 index 1934b01505c..00000000000 --- a/mysql-test/suite/rpl/r/rpl_row_stop_middle_update.result +++ /dev/null @@ -1,17 +0,0 @@ -stop slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -reset master; -reset slave; -drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; -start slave; -create table t1 (words varchar(20)) engine=myisam; -load data infile '../../std_data/words.dat' into table t1 (words); -select count(*) from t1; -count(*) -70 -select count(*) from t1; -count(*) -70 -drop table t1; -include/stop_slave.inc -drop table t1; diff --git a/mysql-test/suite/rpl/r/rpl_stop_middle_group.result b/mysql-test/suite/rpl/r/rpl_stop_middle_group.result new file mode 100644 index 00000000000..0bf0384bf85 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_stop_middle_group.result @@ -0,0 +1,61 @@ +stop slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +reset master; +reset slave; +drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9; +start slave; +create table tm (a int auto_increment primary key) engine=myisam; +create table ti (a int auto_increment primary key) engine=innodb; +set @@global.debug="+d,stop_slave_middle_group"; +begin; +insert into ti set a=null; +insert into tm set a=null; +commit; +SELECT "NO" AS Last_SQL_Error, @check as `true`; +Last_SQL_Error true +NO 1 +select count(*) as one from tm; +one +1 +select count(*) as one from ti; +one +1 +set @@global.debug="-d"; +include/start_slave.inc +truncate table tm; +truncate table ti; +set @@global.debug="+d,stop_slave_middle_group"; +set @@global.debug="+d,incomplete_group_in_relay_log"; +begin; +insert into ti set a=null; +insert into tm set a=null; +commit; +SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`; +Last_SQL_Error true +Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1 +select count(*) as one from tm; +one +1 +select count(*) as zero from ti; +zero +0 +set @@global.debug="-d"; +stop slave; +truncate table tm; +include/start_slave.inc +set @@global.debug="+d,stop_slave_middle_group"; +set @@global.debug="+d,incomplete_group_in_relay_log"; +update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2; +SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details)." AS Last_SQL_Error, @check as `true`; +Last_SQL_Error true +Fatal error: ... The slave SQL is stopped, leaving the current group of events unfinished with a non-transaction table changed. If the group consists solely of Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar errors (see documentation for details). 1 +select max(a) as two from tm; +two +2 +select max(a) as one from ti; +one +1 +set @@global.debug="-d"; +drop table tm, ti; +include/stop_slave.inc +drop table tm, ti; diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt deleted file mode 100644 index b7db8f97bdd..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-binlog-row-event-max-size=256 diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt deleted file mode 100644 index ea49a27adf4..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update-slave.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-debug=d,STOP_SLAVE_after_first_Rows_event diff --git a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test b/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test deleted file mode 100644 index 9b24c78e62d..00000000000 --- a/mysql-test/suite/rpl/t/rpl_row_stop_middle_update.test +++ /dev/null @@ -1,32 +0,0 @@ --- source include/have_binlog_format_row.inc --- source include/have_debug.inc --- source include/master-slave.inc - -# master is asked to create small Rows events: if only one event is -# created, stopping slave at the end of that one will show no bug, we -# need at least two (and stop after first); in this test we use three. - -connection master; -create table t1 (words varchar(20)) engine=myisam; - -load data infile '../../std_data/words.dat' into table t1 (words); -select count(*) from t1; -save_master_pos; - -connection slave; - -# slave will automatically stop the sql thread thanks to the .opt -# file; it will initiate the stop request after the first -# Rows_log_event (out of 3) but should wait until the last one is -# executed before stopping. - -source include/wait_for_slave_sql_to_stop.inc; - -# check that we inserted all rows (waited until the last Rows event) -select count(*) from t1; - -connection master; -drop table t1; -connection slave; # slave SQL thread is stopped -source include/stop_slave.inc; -drop table t1; diff --git a/mysql-test/suite/rpl/t/rpl_stop_middle_group.test b/mysql-test/suite/rpl/t/rpl_stop_middle_group.test new file mode 100644 index 00000000000..2cd41b45cf9 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_stop_middle_group.test @@ -0,0 +1,149 @@ +-- source include/have_debug.inc +-- source include/master-slave.inc +-- source include/have_innodb.inc + +# Proving that stopping in the middle of applying a group of events +# does not have immediate effect if a non-transaction table has been changed. +# The slave sql thread has to try to finish applying first. +# The tests rely on simulation of the killed status. +# The matter of testing correlates to some of `rpl_start_stop_slave' that does +# not require `have_debug'. + +connection master; + +create table tm (a int auto_increment primary key) engine=myisam; +create table ti (a int auto_increment primary key) engine=innodb; + +sync_slave_with_master; +set @@global.debug="+d,stop_slave_middle_group"; + +connection master; + +begin; +insert into ti set a=null; +insert into tm set a=null; # to simulate killed status on the slave +commit; + +connection slave; + +# slave will catch the killed status but won't shut down immediately +# only after the whole group has done (commit) + +source include/wait_for_slave_sql_to_stop.inc; + +# checking: no error and the group is finished + +let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); +let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); +let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT $read = $exec into @check; +--enable_query_log +eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`; +select count(*) as one from tm; +select count(*) as one from ti; + +set @@global.debug="-d"; + +# +# bug#45940 issues around rli->last_event_start_time +# Testing of slave stopped after it had waited (in vain) for +# the group be finished. +# It could not be finished because of simulation of failure to +# receive the terminal part +# The test relay on simulation of the incomplete group in the relay log + +# Two cases are verified: a mixed transacton and a mixed multi-table update. +# +# The mixed transacton. +# +source include/start_slave.inc; + +connection master; + +truncate table tm; # cleanup of former tests +truncate table ti; + +#connection slave; +sync_slave_with_master; + +set @@global.debug="+d,stop_slave_middle_group"; +set @@global.debug="+d,incomplete_group_in_relay_log"; + +connection master; + +begin; +insert into ti set a=null; +insert into tm set a=null; +commit; + +connection slave; + +# slave will catch the killed status, won't shut down immediately +# but does it eventually having the whole group unfinished (not committed) + +source include/wait_for_slave_sql_to_stop.inc; + +# checking: the error and group unfinished + +let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); +let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); +let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT $read - $exec > 0 into @check; +--enable_query_log +eval SELECT "$error" AS Last_SQL_Error, @check as `true`; +select count(*) as one from tm; +select count(*) as zero from ti; + +set @@global.debug="-d"; + +# +# The mixed multi-table update +# +stop slave; +truncate table tm; +source include/start_slave.inc; + +connection master; + +#connection slave; +sync_slave_with_master; +set @@global.debug="+d,stop_slave_middle_group"; +set @@global.debug="+d,incomplete_group_in_relay_log"; + +connection master; +update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2; + +connection slave; + +# slave will catch the killed status, won't shut down immediately +# but does it eventually having the whole group unfinished (not committed) +# + +source include/wait_for_slave_sql_to_stop.inc; + +# checking: the error and group unfinished + +let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); +let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); +let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_query_log +eval SELECT $read - $exec > 0 into @check; +--enable_query_log +eval SELECT "$error" AS Last_SQL_Error, @check as `true`; +select max(a) as two from tm; +select max(a) as one from ti; + +set @@global.debug="-d"; + +# +# clean-up +# + +connection master; +drop table tm, ti; + +connection slave; # slave SQL thread is stopped +source include/stop_slave.inc; +drop table tm, ti; diff --git a/sql/log_event.cc b/sql/log_event.cc index d8dd40c91de..e2f0029eb6e 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -3272,6 +3272,21 @@ Default database: '%s'. Query: '%s'", */ } /* End of if (db_ok(... */ + {/** + The following failure injecion works in cooperation with tests + setting @@global.debug= 'd,stop_slave_middle_group'. + The sql thread receives the killed status and will proceed + to shutdown trying to finish incomplete events group. + */ + DBUG_EXECUTE_IF("stop_slave_middle_group", + if (strcmp("COMMIT", query) != 0 && + strcmp("BEGIN", query) != 0) + { + if (thd->transaction.all.modified_non_trans_table) + const_cast(rli)->abort_slave= 1; + };); + } + end: /* Probably we have set thd->query, thd->db, thd->catalog to point to places @@ -7475,8 +7490,16 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) thd->transaction.stmt.modified_non_trans_table= TRUE; } // row processing loop - DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event", - const_cast(rli)->abort_slave= 1;); + {/** + The following failure injecion works in cooperation with tests + setting @@global.debug= 'd,stop_slave_middle_group'. + The sql thread receives the killed status and will proceed + to shutdown trying to finish incomplete events group. + */ + DBUG_EXECUTE_IF("stop_slave_middle_group", + if (thd->transaction.all.modified_non_trans_table) + const_cast(rli)->abort_slave= 1;); + } if ((error= do_after_row_operations(rli, error)) && ignored_error_code(convert_handler_error(error, thd, table))) @@ -7513,32 +7536,6 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) const_cast(rli)->cleanup_context(thd, error); thd->is_slave_error= 1; } - /* - This code would ideally be placed in do_update_pos() instead, but - since we have no access to table there, we do the setting of - last_event_start_time here instead. - */ - else if (table && (table->s->primary_key == MAX_KEY) && - !cache_stmt && get_flags(STMT_END_F) == RLE_NO_FLAGS) - { - /* - ------------ Temporary fix until WL#2975 is implemented --------- - - This event is not the last one (no STMT_END_F). If we stop now - (in case of terminate_slave_thread()), how will we restart? We - have to restart from Table_map_log_event, but as this table is - not transactional, the rows already inserted will still be - present, and idempotency is not guaranteed (no PK) so we risk - that repeating leads to double insert. So we desperately try to - continue, hope we'll eventually leave this buggy situation (by - executing the final Rows_log_event). If we are in a hopeless - wait (reached end of last relay log and nothing gets appended - there), we timeout after one minute, and notify DBA about the - problem. When WL#2975 is implemented, just remove the member - Relay_log_info::last_event_start_time and all its occurrences. - */ - const_cast(rli)->last_event_start_time= my_time(0); - } DBUG_RETURN(error); } diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index 68cd2bf4673..a335210ce53 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -226,7 +226,7 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info row_start= row_end; } - DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event", + DBUG_EXECUTE_IF("stop_slave_middle_group", const_cast(rli)->abort_slave= 1;); error= do_after_row_operations(table, error); if (!ev->cache_stmt) @@ -269,34 +269,6 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, const Relay_log_info DBUG_RETURN(error); } - /* - This code would ideally be placed in do_update_pos() instead, but - since we have no access to table there, we do the setting of - last_event_start_time here instead. - */ - if (table && (table->s->primary_key == MAX_KEY) && - !ev->cache_stmt && - ev->get_flags(Old_rows_log_event::STMT_END_F) == Old_rows_log_event::RLE_NO_FLAGS) - { - /* - ------------ Temporary fix until WL#2975 is implemented --------- - - This event is not the last one (no STMT_END_F). If we stop now - (in case of terminate_slave_thread()), how will we restart? We - have to restart from Table_map_log_event, but as this table is - not transactional, the rows already inserted will still be - present, and idempotency is not guaranteed (no PK) so we risk - that repeating leads to double insert. So we desperately try to - continue, hope we'll eventually leave this buggy situation (by - executing the final Old_rows_log_event). If we are in a hopeless - wait (reached end of last relay log and nothing gets appended - there), we timeout after one minute, and notify DBA about the - problem. When WL#2975 is implemented, just remove the member - st_relay_log_info::last_event_start_time and all its occurences. - */ - const_cast(rli)->last_event_start_time= my_time(0); - } - DBUG_RETURN(0); } #endif @@ -1744,7 +1716,7 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) } // row processing loop - DBUG_EXECUTE_IF("STOP_SLAVE_after_first_Rows_event", + DBUG_EXECUTE_IF("stop_slave_middle_group", const_cast(rli)->abort_slave= 1;); error= do_after_row_operations(rli, error); if (!cache_stmt) @@ -1787,33 +1759,6 @@ int Old_rows_log_event::do_apply_event(Relay_log_info const *rli) DBUG_RETURN(error); } - /* - This code would ideally be placed in do_update_pos() instead, but - since we have no access to table there, we do the setting of - last_event_start_time here instead. - */ - if (table && (table->s->primary_key == MAX_KEY) && - !cache_stmt && get_flags(STMT_END_F) == RLE_NO_FLAGS) - { - /* - ------------ Temporary fix until WL#2975 is implemented --------- - - This event is not the last one (no STMT_END_F). If we stop now - (in case of terminate_slave_thread()), how will we restart? We - have to restart from Table_map_log_event, but as this table is - not transactional, the rows already inserted will still be - present, and idempotency is not guaranteed (no PK) so we risk - that repeating leads to double insert. So we desperately try to - continue, hope we'll eventually leave this buggy situation (by - executing the final Old_rows_log_event). If we are in a hopeless - wait (reached end of last relay log and nothing gets appended - there), we timeout after one minute, and notify DBA about the - problem. When WL#2975 is implemented, just remove the member - Relay_log_info::last_event_start_time and all its occurrences. - */ - const_cast(rli)->last_event_start_time= my_time(0); - } - DBUG_RETURN(0); } diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index b3a1bbc31d2..ec3adc79ca2 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1195,7 +1195,6 @@ void Relay_log_info::cleanup_context(THD *thd, bool error) */ thd->options&= ~OPTION_NO_FOREIGN_KEY_CHECKS; thd->options&= ~OPTION_RELAXED_UNIQUE_CHECKS; - last_event_start_time= 0; DBUG_VOID_RETURN; } diff --git a/sql/rpl_rli.h b/sql/rpl_rli.h index a5410dd0c79..fd36d18adae 100644 --- a/sql/rpl_rli.h +++ b/sql/rpl_rli.h @@ -349,12 +349,10 @@ public: void clear_tables_to_lock(); /* - Used by row-based replication to detect that it should not stop at - this event, but give it a chance to send more events. The time - where the last event inside a group started is stored here. If the - variable is zero, we are not in a group (but may be in a - transaction). - */ + Used to defer stopping the SQL thread to give it a chance + to finish up the current group of events. + The timestamp is set and reset in @c sql_slave_killed(). + */ time_t last_event_start_time; /** diff --git a/sql/slave.cc b/sql/slave.cc index 44993601e78..834ed8ed933 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -49,6 +49,10 @@ #define FLAGSTR(V,F) ((V)&(F)?#F" ":"") #define MAX_SLAVE_RETRY_PAUSE 5 +/* + a parameter of sql_slave_killed() to defer the killed status +*/ +#define SLAVE_WAIT_GROUP_DONE 60 bool use_slave_mask = 0; MY_BITMAP slave_error_mask; char slave_skip_error_names[SHOW_VAR_FUNC_BUFF_SIZE]; @@ -790,46 +794,95 @@ static bool io_slave_killed(THD* thd, Master_info* mi) DBUG_RETURN(mi->abort_slave || abort_loop || thd->killed); } +/** + The function analyzes a possible killed status and makes + a decision whether to accept it or not. + Normally upon accepting the sql thread goes to shutdown. + In the event of deffering decision @rli->last_event_start_time waiting + timer is set to force the killed status be accepted upon its expiration. + @param thd pointer to a THD instance + @param rli pointer to Relay_log_info instance + + @return TRUE the killed status is recognized, FALSE a possible killed + status is deferred. +*/ static bool sql_slave_killed(THD* thd, Relay_log_info* rli) { + bool ret= FALSE; DBUG_ENTER("sql_slave_killed"); DBUG_ASSERT(rli->sql_thd == thd); DBUG_ASSERT(rli->slave_running == 1);// tracking buffer overrun if (abort_loop || thd->killed || rli->abort_slave) { - if (rli->abort_slave && rli->is_in_group() && - thd->transaction.all.modified_non_trans_table) - DBUG_RETURN(0); - /* - If we are in an unsafe situation (stopping could corrupt replication), - we give one minute to the slave SQL thread of grace before really - terminating, in the hope that it will be able to read more events and - the unsafe situation will soon be left. Note that this one minute starts - from the last time anything happened in the slave SQL thread. So it's - really one minute of idleness, we don't timeout if the slave SQL thread - is actively working. - */ - if (rli->last_event_start_time == 0) - DBUG_RETURN(1); - DBUG_PRINT("info", ("Slave SQL thread is in an unsafe situation, giving " - "it some grace period")); - if (difftime(time(0), rli->last_event_start_time) > 60) + if (thd->transaction.all.modified_non_trans_table && rli->is_in_group()) { - rli->report(ERROR_LEVEL, 0, - "SQL thread had to stop in an unsafe situation, in " - "the middle of applying updates to a " - "non-transactional table without any primary key. " - "There is a risk of duplicate updates when the slave " - "SQL thread is restarted. Please check your tables' " - "contents after restart."); - DBUG_RETURN(1); + char msg_stopped[]= + "... The slave SQL is stopped, leaving the current group " + "of events unfinished with a non-transaction table changed. " + "If the group consists solely of Row-based events, you can try " + "restarting the slave with --slave-exec-mode=IDEMPOTENT, which " + "ignores duplicate key, key not found, and similar errors (see " + "documentation for details)."; + + if (rli->abort_slave) + { + DBUG_PRINT("info", ("Slave SQL thread is being stopped in the middle of" + " a group having updated a non-trans table, giving" + " it some grace period")); + + /* + Slave sql thread shutdown in face of unfinished group modified + Non-trans table is handled via a timer. The slave may eventually + give out to complete the current group and in that case there + might be issues at consequent slave restart, see the error message. + WL#2975 offers a robust solution requiring to store the last exectuted + event's coordinates along with the group's coordianates + instead of waiting with @c last_event_start_time the timer. + */ + + if (rli->last_event_start_time == 0) + rli->last_event_start_time= my_time(0); + ret= difftime(my_time(0), rli->last_event_start_time) <= + SLAVE_WAIT_GROUP_DONE ? FALSE : TRUE; + + DBUG_EXECUTE_IF("stop_slave_middle_group", + DBUG_EXECUTE_IF("incomplete_group_in_relay_log", + ret= TRUE;);); // time is over + + if (ret == 0) + { + rli->report(WARNING_LEVEL, 0, + "slave SQL thread is being stopped in the middle " + "of applying of a group having updated a non-transaction " + "table; waiting for the group completion ... "); + } + else + { + rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, + ER(ER_SLAVE_FATAL_ERROR), msg_stopped); + } + } + else + { + ret= TRUE; + rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, ER(ER_SLAVE_FATAL_ERROR), + msg_stopped); + } + } + else + { + ret= TRUE; } } - DBUG_RETURN(0); + if (ret) + rli->last_event_start_time= 0; + + DBUG_RETURN(ret); } + /* skip_load_data_infile() @@ -2525,6 +2578,27 @@ static int exec_relay_log_event(THD* thd, Relay_log_info* rli) delete ev; DBUG_RETURN(1); } + + { /** + The following failure injecion works in cooperation with tests + setting @@global.debug= 'd,incomplete_group_in_relay_log'. + Xid or Commit events are not executed to force the slave sql + read hanging if the realy log does not have any more events. + */ + DBUG_EXECUTE_IF("incomplete_group_in_relay_log", + if ((ev->get_type_code() == XID_EVENT) || + ((ev->get_type_code() == QUERY_EVENT) && + strcmp("COMMIT", ((Query_log_event *) ev)->query) == 0)) + { + DBUG_ASSERT(thd->transaction.all.modified_non_trans_table); + rli->abort_slave= 1; + pthread_mutex_unlock(&rli->data_lock); + delete ev; + rli->inc_event_relay_log_pos(); + DBUG_RETURN(0); + };); + } + exec_res= apply_event_and_update_pos(ev, thd, rli, TRUE); /* @@ -3953,7 +4027,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) goto skip_relay_logging; } break; - + default: inc_pos= event_len; break; From 2151a821aad6f3e5f42807d2f51b97c63948dfbf Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Sat, 10 Oct 2009 14:27:07 +0400 Subject: [PATCH 82/88] Bug#42891: Tests cleanup Fix for backport into mysql-5.1-rep+2 --- mysql-test/suite/rpl/r/rpl_heartbeat.result | 2 ++ mysql-test/suite/rpl/t/rpl_heartbeat.test | 2 ++ 2 files changed, 4 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat.result b/mysql-test/suite/rpl/r/rpl_heartbeat.result index 3bd2ad108ca..b79545b8336 100644 --- a/mysql-test/suite/rpl/r/rpl_heartbeat.result +++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result @@ -1,4 +1,5 @@ reset master; +set @restore_slave_net_timeout= @@global.slave_net_timeout; set @@global.slave_net_timeout= 10; Warnings: Warning 1624 The currect value for master_heartbeat_period exceeds the new value of `slave_net_timeout' sec. A sensible value for the period should be less than the timeout. @@ -140,4 +141,5 @@ Variable_name Slave_heartbeat_period Value 0.500 A heartbeat has been received by the slave drop table t1; +set @@global.slave_net_timeout= @restore_slave_net_timeout; End of tests diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat.test b/mysql-test/suite/rpl/t/rpl_heartbeat.test index 4304888d6a5..3b0d21052ee 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test @@ -16,6 +16,7 @@ connection master; reset master; connection slave; +set @restore_slave_net_timeout= @@global.slave_net_timeout; set @@global.slave_net_timeout= 10; ### @@ -161,6 +162,7 @@ drop table t1; #connection slave; sync_slave_with_master; +set @@global.slave_net_timeout= @restore_slave_net_timeout; --echo End of tests From 55842061e782593608808dc5c3e95ebc652650d7 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Mon, 12 Oct 2009 20:55:01 +0800 Subject: [PATCH 83/88] Backport BUG#45848 Semisynchronous replication internals are visible in SHOW PROCESSLIST and logs Semi-sync uses an extra connection from slave to master to send replies, this is a normal client connection, and used a normal SET query to set the reply information on master, which is visible to user and may cause some confusion and complaining. This problem is fixed by using the method of sending reply by using the same connection that is used by master dump thread to send binlog to slave. Since now the semi-sync plugins are integrated with the server code, it is not a problem to use the internal net interfaces to do this. The master dump thread will mark the event requires a reply and wait for the reply when the event just sent is the last event of a transaction and semi-sync status is ON; And the slave will send a reply to master when it received such an event that requires a reply. --- mysql-test/suite/rpl/r/rpl_semi_sync.result | 64 +++++--- mysql-test/suite/rpl/t/rpl_semi_sync.test | 80 ++++++++-- plugin/semisync/Makefile.am | 1 + plugin/semisync/semisync.h | 30 ++-- plugin/semisync/semisync_master.cc | 162 ++++++++++++++++---- plugin/semisync/semisync_master.h | 27 +++- plugin/semisync/semisync_master_plugin.cc | 50 +++--- plugin/semisync/semisync_slave.cc | 50 ++++-- plugin/semisync/semisync_slave.h | 12 +- plugin/semisync/semisync_slave_plugin.cc | 10 +- 10 files changed, 343 insertions(+), 143 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result index d6f2a3aceff..ea8a2592852 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -81,7 +81,7 @@ Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 0 -create table t1(n int) engine = ENGINE_TYPE; +create table t1(a int) engine = ENGINE_TYPE; [ master state after CREATE TABLE statement ] show status like 'Rpl_semi_sync_master_status'; Variable_name Value @@ -92,6 +92,9 @@ Rpl_semi_sync_master_no_tx 0 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 1 +select CONNECTIONS_NORMAL_SLAVE - CONNECTIONS_NORMAL_SLAVE as 'Should be 0'; +Should be 0 +0 [ insert records to table ] [ master status after inserts ] show status like 'Rpl_semi_sync_master_status'; @@ -108,15 +111,19 @@ Rpl_semi_sync_master_yes_tx 301 show status like 'Rpl_semi_sync_slave_status'; Variable_name Value Rpl_semi_sync_slave_status ON -select count(distinct n) from t1; -count(distinct n) +select count(distinct a) from t1; +count(distinct a) 300 -select min(n) from t1; -min(n) +select min(a) from t1; +min(a) 1 -select max(n) from t1; -max(n) +select max(a) from t1; +max(a) 300 +# +# Test semi-sync master will switch OFF after one transacton +# timeout waiting for slave reply. +# include/stop_slave.inc [ on master ] [ master status should be ON ] @@ -134,7 +141,16 @@ Variable_name Value Rpl_semi_sync_master_clients 1 [ semi-sync replication of these transactions will fail ] insert into t1 values (500); -delete from t1 where n < 500; +[ master status should be OFF ] +show status like 'Rpl_semi_sync_master_status'; +Variable_name Value +Rpl_semi_sync_master_status OFF +show status like 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 1 +show status like 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 301 insert into t1 values (100); [ master status should be OFF ] show status like 'Rpl_semi_sync_master_status'; @@ -142,10 +158,13 @@ Variable_name Value Rpl_semi_sync_master_status OFF show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value -Rpl_semi_sync_master_no_tx 3 +Rpl_semi_sync_master_no_tx 302 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 301 +# +# Test semi-sync status on master will be ON again when slave catches up +# [ on slave ] [ slave status should be OFF ] show status like 'Rpl_semi_sync_slave_status'; @@ -156,31 +175,33 @@ include/start_slave.inc show status like 'Rpl_semi_sync_slave_status'; Variable_name Value Rpl_semi_sync_slave_status ON -select count(distinct n) from t1; -count(distinct n) +select count(distinct a) from t1; +count(distinct a) 2 -select min(n) from t1; -min(n) +select min(a) from t1; +min(a) 100 -select max(n) from t1; -max(n) +select max(a) from t1; +max(a) 500 [ on master ] -[ do something to activate semi-sync ] -drop table t1; -[ master status should be ON again ] +[ master status should be ON again after slave catches up ] show status like 'Rpl_semi_sync_master_status'; Variable_name Value Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_no_tx'; Variable_name Value -Rpl_semi_sync_master_no_tx 3 +Rpl_semi_sync_master_no_tx 302 show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value -Rpl_semi_sync_master_yes_tx 302 +Rpl_semi_sync_master_yes_tx 301 show status like 'Rpl_semi_sync_master_clients'; Variable_name Value Rpl_semi_sync_master_clients 1 +# +# Test disable/enable master semi-sync on the fly. +# +drop table t1; [ on slave ] include/stop_slave.inc [ on master ] @@ -206,6 +227,9 @@ rpl_semi_sync_master_enabled ON show status like 'Rpl_semi_sync_master_status'; Variable_name Value Rpl_semi_sync_master_status ON +# +# Test RESET MASTER/SLAVE +# [ on slave ] include/start_slave.inc [ on master ] diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 9798ffdb642..cadbb69e47d 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -7,6 +7,11 @@ source include/master-slave.inc; let $engine_type= InnoDB; #let $engine_type= MyISAM; +# After fix of BUG#45848, semi-sync slave should not create any extra +# connections on master, save the count of connections before start +# semi-sync slave for comparison below. +let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); + # Suppress warnings that might be generated during the test disable_query_log; connection master; @@ -150,13 +155,20 @@ show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_yes_tx'; replace_result $engine_type ENGINE_TYPE; -eval create table t1(n int) engine = $engine_type; +eval create table t1(a int) engine = $engine_type; echo [ master state after CREATE TABLE statement ]; show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_yes_tx'; +# After fix of BUG#45848, semi-sync slave should not create any extra +# connections on master. +let $_connections_semisync_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); +replace_result $_connections_semisync_slave CONNECTIONS_SEMISYNC_SLAVE; +replace_result $_connections_normal_slave CONNECTIONS_NORMAL_SLAVE; +eval select $_connections_semisync_slave - $_connections_normal_slave as 'Should be 0'; + let $i=300; echo [ insert records to table ]; disable_query_log; @@ -178,10 +190,15 @@ echo [ on slave ]; echo [ slave status after replicated inserts ]; show status like 'Rpl_semi_sync_slave_status'; -select count(distinct n) from t1; -select min(n) from t1; -select max(n) from t1; +select count(distinct a) from t1; +select min(a) from t1; +select max(a) from t1; +--echo # +--echo # Test semi-sync master will switch OFF after one transacton +--echo # timeout waiting for slave reply. +--echo # +connection slave; source include/stop_slave.inc; connection master; @@ -197,8 +214,11 @@ show status like 'Rpl_semi_sync_master_clients'; echo [ semi-sync replication of these transactions will fail ]; insert into t1 values (500); -delete from t1 where n < 500; -insert into t1 values (100); + +# Wait for the semi-sync replication of this transaction to timeout +let $status_var= Rpl_semi_sync_master_status; +let $status_var_value= OFF; +source include/wait_for_status_var.inc; # The second semi-sync check should be off because one transaction # times out during waiting. @@ -207,6 +227,28 @@ show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_yes_tx'; +# Semi-sync status on master is now OFF, so all these transactions +# will be replicated asynchronously. +let $i=300; +disable_query_log; +while ($i) +{ + eval delete from t1 where a=$i; + dec $i; +} +enable_query_log; + +insert into t1 values (100); + +echo [ master status should be OFF ]; +show status like 'Rpl_semi_sync_master_status'; +show status like 'Rpl_semi_sync_master_no_tx'; +show status like 'Rpl_semi_sync_master_yes_tx'; + +--echo # +--echo # Test semi-sync status on master will be ON again when slave catches up +--echo # + # Save the master position for later use. save_master_pos; @@ -221,23 +263,25 @@ sync_with_master; echo [ slave status should be ON ]; show status like 'Rpl_semi_sync_slave_status'; -select count(distinct n) from t1; -select min(n) from t1; -select max(n) from t1; +select count(distinct a) from t1; +select min(a) from t1; +select max(a) from t1; connection master; echo [ on master ]; -echo [ do something to activate semi-sync ]; -drop table t1; - -# The third semi-sync check should be on again. -echo [ master status should be ON again ]; +# The master semi-sync status should be on again after slave catches up. +echo [ master status should be ON again after slave catches up ]; show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_yes_tx'; show status like 'Rpl_semi_sync_master_clients'; +--echo # +--echo # Test disable/enable master semi-sync on the fly. +--echo # + +drop table t1; sync_slave_with_master; echo [ on slave ]; @@ -259,6 +303,10 @@ set global rpl_semi_sync_master_enabled=1; show variables like 'rpl_semi_sync_master_enabled'; show status like 'Rpl_semi_sync_master_status'; +--echo # +--echo # Test RESET MASTER/SLAVE +--echo # + connection slave; echo [ on slave ]; @@ -512,6 +560,8 @@ source include/start_slave.inc; connection master; drop table t1; +sync_slave_with_master; + +connection master; drop user rpl@127.0.0.1; flush privileges; -sync_slave_with_master; diff --git a/plugin/semisync/Makefile.am b/plugin/semisync/Makefile.am index dd9a630670c..dfe539b8386 100644 --- a/plugin/semisync/Makefile.am +++ b/plugin/semisync/Makefile.am @@ -18,6 +18,7 @@ pkgplugindir = $(pkglibdir)/plugin INCLUDES = -I$(top_srcdir)/include \ -I$(top_srcdir)/sql \ + -I$(top_srcdir)/regex \ -I$(srcdir) noinst_HEADERS = semisync.h semisync_master.h semisync_slave.h diff --git a/plugin/semisync/semisync.h b/plugin/semisync/semisync.h index c9d35a093f6..ced25c40534 100644 --- a/plugin/semisync/semisync.h +++ b/plugin/semisync/semisync.h @@ -18,25 +18,9 @@ #ifndef SEMISYNC_H #define SEMISYNC_H -#include -#include -#include -#include -#include -#include -#include -#include - -typedef uint32_t uint32; -typedef unsigned long long my_off_t; -#define FN_REFLEN 512 /* Max length of full path-name */ -void sql_print_error(const char *format, ...); -void sql_print_warning(const char *format, ...); -void sql_print_information(const char *format, ...); -extern unsigned long max_connections; - #define MYSQL_SERVER #define HAVE_REPLICATION +#include #include #include #include @@ -92,4 +76,16 @@ public: static const unsigned char kPacketFlagSync; }; +/* The layout of a semisync slave reply packet: + 1 byte for the magic num + 8 bytes for the binlog positon + n bytes for the binlog filename, terminated with a '\0' +*/ +#define REPLY_MAGIC_NUM_LEN 1 +#define REPLY_BINLOG_POS_LEN 8 +#define REPLY_BINLOG_NAME_LEN (FN_REFLEN + 1) +#define REPLY_MAGIC_NUM_OFFSET 0 +#define REPLY_BINLOG_POS_OFFSET (REPLY_MAGIC_NUM_OFFSET + REPLY_MAGIC_NUM_LEN) +#define REPLY_BINLOG_NAME_OFFSET (REPLY_BINLOG_POS_OFFSET + REPLY_BINLOG_POS_LEN) + #endif /* SEMISYNC_H */ diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index 3641b658268..decab205674 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -546,19 +546,6 @@ bool ReplSemiSyncMaster::is_semi_sync_slave() return val; } -int ReplSemiSyncMaster::reportReplyBinlog(const char *log_file_pos) -{ - char log_name[FN_REFLEN]; - char *endptr; - my_off_t log_pos= strtoull(log_file_pos, &endptr, 10); - if (!log_pos || !endptr || *endptr != ':' ) - return 1; - endptr++; // skip the ':' seperator - strncpy(log_name, endptr, FN_REFLEN); - uint32 server_id= 0; - return reportReplyBinlog(server_id, log_name, log_pos); -} - int ReplSemiSyncMaster::reportReplyBinlog(uint32 server_id, const char *log_file_name, my_off_t log_file_pos) @@ -679,7 +666,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, "Waiting for semi-sync ACK from slave"); /* This is the real check inside the mutex. */ - if (!getMasterEnabled() || !is_on() || !rpl_semi_sync_master_clients) + if (!getMasterEnabled() || !is_on()) goto l_end; if (trace_level_ & kTraceDetail) @@ -691,17 +678,20 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, while (is_on()) { - int cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_, - trx_wait_binlog_name, trx_wait_binlog_pos); - if (cmp >= 0) + if (reply_file_name_inited_) { - /* We have already sent the relevant binlog to the slave: no need to - * wait here. - */ - if (trace_level_ & kTraceDetail) - sql_print_information("%s: Binlog reply is ahead (%s, %lu),", - kWho, reply_file_name_, (unsigned long)reply_file_pos_); - break; + int cmp = ActiveTranx::compare(reply_file_name_, reply_file_pos_, + trx_wait_binlog_name, trx_wait_binlog_pos); + if (cmp >= 0) + { + /* We have already sent the relevant binlog to the slave: no need to + * wait here. + */ + if (trace_level_ & kTraceDetail) + sql_print_information("%s: Binlog reply is ahead (%s, %lu),", + kWho, reply_file_name_, (unsigned long)reply_file_pos_); + break; + } } /* Let us update the info about the minimum binlog position of waiting @@ -709,8 +699,8 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, */ if (wait_file_name_inited_) { - cmp = ActiveTranx::compare(trx_wait_binlog_name, trx_wait_binlog_pos, - wait_file_name_, wait_file_pos_); + int cmp = ActiveTranx::compare(trx_wait_binlog_name, trx_wait_binlog_pos, + wait_file_name_, wait_file_pos_); if (cmp <= 0) { /* This thd has a lower position, let's update the minimum info. */ @@ -824,6 +814,13 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, } l_end: + /* + At this point, the binlog file and position of this transaction + must have been removed from ActiveTranx. + */ + assert(!active_tranxs_->is_tranx_end_pos(trx_wait_binlog_name, + trx_wait_binlog_pos)); + /* Update the status counter. */ if (is_on() && rpl_semi_sync_master_clients) enabled_transactions_++; @@ -1045,7 +1042,9 @@ int ReplSemiSyncMaster::updateSyncHeader(unsigned char *packet, * reserve the packet header. */ if (sync) + { (packet)[2] = kPacketFlagSync; + } return function_exit(kWho, 0); } @@ -1098,8 +1097,8 @@ int ReplSemiSyncMaster::writeTranxInBinlog(const char* log_file_name, if insert tranx_node failed, print a warning message and turn off semi-sync */ - sql_print_warning("Semi-sync failed to insert tranx_node for binlog file: %s, position: %ul", - log_file_name, log_file_pos); + sql_print_warning("Semi-sync failed to insert tranx_node for binlog file: %s, position: %lu", + log_file_name, (ulong)log_file_pos); switch_off(); } } @@ -1110,6 +1109,113 @@ int ReplSemiSyncMaster::writeTranxInBinlog(const char* log_file_name, return function_exit(kWho, result); } +int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id, + const char *event_buf) +{ + const char *kWho = "ReplSemiSyncMaster::readSlaveReply"; + const unsigned char *packet; + char log_file_name[FN_REFLEN]; + my_off_t log_file_pos; + ulong packet_len; + int result = -1; + + struct timeval start_tv; + int start_time_err= 0; + ulong trc_level = trace_level_; + + function_enter(kWho); + + assert((unsigned char)event_buf[1] == kPacketMagicNum); + if ((unsigned char)event_buf[2] != kPacketFlagSync) + { + /* current event does not require reply */ + result = 0; + goto l_end; + } + + if (trc_level & kTraceNetWait) + start_time_err = gettimeofday(&start_tv, 0); + + /* We flush to make sure that the current event is sent to the network, + * instead of being buffered in the TCP/IP stack. + */ + if (net_flush(net)) + { + sql_print_error("Semi-sync master failed on net_flush() " + "before waiting for slave reply"); + goto l_end; + } + + net_clear(net, 0); + if (trc_level & kTraceDetail) + sql_print_information("%s: Wait for replica's reply", kWho); + + /* Wait for the network here. Though binlog dump thread can indefinitely wait + * here, transactions would not wait indefintely. + * Transactions wait on binlog replies detected by binlog dump threads. If + * binlog dump threads wait too long, transactions will timeout and continue. + */ + packet_len = my_net_read(net); + + if (trc_level & kTraceNetWait) + { + if (start_time_err != 0) + { + sql_print_error("Semi-sync master wait for reply " + "gettimeofday fail to get start time"); + timefunc_fails_++; + } + else + { + int wait_time; + + wait_time = getWaitTime(start_tv); + if (wait_time < 0) + { + sql_print_error("Semi-sync master wait for reply " + "gettimeofday fail to get wait time."); + timefunc_fails_++; + } + else + { + total_net_wait_num_++; + total_net_wait_time_ += wait_time; + } + } + } + + if (packet_len == packet_error || packet_len < REPLY_BINLOG_NAME_OFFSET) + { + if (packet_len == packet_error) + sql_print_error("Read semi-sync reply network error: %s (errno: %d)", + net->last_error, net->last_errno); + else + sql_print_error("Read semi-sync reply length error: %s (errno: %d)", + net->last_error, net->last_errno); + goto l_end; + } + + packet = net->read_pos; + if (packet[REPLY_MAGIC_NUM_OFFSET] != ReplSemiSyncMaster::kPacketMagicNum) + { + sql_print_error("Read semi-sync reply magic number error"); + goto l_end; + } + + log_file_pos = uint8korr(packet + REPLY_BINLOG_POS_OFFSET); + strcpy(log_file_name, (const char*)packet + REPLY_BINLOG_NAME_OFFSET); + + if (trc_level & kTraceDetail) + sql_print_information("%s: Got reply (%s, %lu)", + kWho, log_file_name, (ulong)log_file_pos); + + result = reportReplyBinlog(server_id, log_file_name, log_file_pos); + + l_end: + return function_exit(kWho, result); +} + + int ReplSemiSyncMaster::resetMaster() { const char *kWho = "ReplSemiSyncMaster::resetMaster"; diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h index bb63cece18a..50a4665efb8 100644 --- a/plugin/semisync/semisync_master.h +++ b/plugin/semisync/semisync_master.h @@ -81,7 +81,7 @@ public: /* Insert an active transaction node with the specified position. * * Return: - * 0: success; -1 or otherwise: error + * 0: success; non-zero: error */ int insert_tranx_node(const char *log_file_name, my_off_t log_file_pos); @@ -91,7 +91,7 @@ public: * list and the hash table will be reset to empty. * * Return: - * 0: success; -1 or otherwise: error + * 0: success; non-zero: error */ int clear_active_tranx_nodes(const char *log_file_name, my_off_t log_file_pos); @@ -253,8 +253,6 @@ class ReplSemiSyncMaster /* Is the slave servered by the thread requested semi-sync */ bool is_semi_sync_slave(); - int reportReplyBinlog(const char *log_file_pos); - /* In semi-sync replication, reports up to which binlog position we have * received replies from the slave indicating that it already get the events. * @@ -265,7 +263,7 @@ class ReplSemiSyncMaster * the replies from the slave * * Return: - * 0: success; -1 or otherwise: error + * 0: success; non-zero: error */ int reportReplyBinlog(uint32 server_id, const char* log_file_name, @@ -284,7 +282,7 @@ class ReplSemiSyncMaster * trx_wait_binlog_pos - (IN) ending position's file offset * * Return: - * 0: success; -1 or otherwise: error + * 0: success; non-zero: error */ int commitTrx(const char* trx_wait_binlog_name, my_off_t trx_wait_binlog_pos); @@ -313,7 +311,7 @@ class ReplSemiSyncMaster * server_id - (IN) master server id number * * Return: - * 0: success; -1 or otherwise: error + * 0: success; non-zero: error */ int updateSyncHeader(unsigned char *packet, const char *log_file_name, @@ -330,10 +328,23 @@ class ReplSemiSyncMaster * log_file_pos - (IN) transaction ending position's file offset * * Return: - * 0: success; -1 or otherwise: error + * 0: success; non-zero: error */ int writeTranxInBinlog(const char* log_file_name, my_off_t log_file_pos); + /* Read the slave's reply so that we know how much progress the slave makes + * on receive replication events. + * + * Input: + * net - (IN) the connection to master + * server_id - (IN) master server id number + * event_buf - (IN) pointer to the event packet + * + * Return: + * 0: success; non-zero: error + */ + int readSlaveReply(NET *net, uint32 server_id, const char *event_buf); + /* Export internal statistics for semi-sync replication. */ void setExportStats(); diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc index dc19d09e622..9c76b5369b6 100644 --- a/plugin/semisync/semisync_master_plugin.cc +++ b/plugin/semisync/semisync_master_plugin.cc @@ -69,8 +69,16 @@ int repl_semi_binlog_dump_start(Binlog_transmit_param *param, bool semi_sync_slave= repl_semisync.is_semi_sync_slave(); if (semi_sync_slave) + { /* One more semi-sync slave */ repl_semisync.add_slave(); + + /* + Let's assume this semi-sync slave has already received all + binlog events before the filename and position it requests. + */ + repl_semisync.reportReplyBinlog(param->server_id, log_file, log_pos); + } sql_print_information("Start %s binlog_dump to slave (server_id: %d), pos(%s, %lu)", semi_sync_slave ? "semi-sync" : "asynchronous", param->server_id, log_file, (unsigned long)log_pos); @@ -114,6 +122,18 @@ int repl_semi_before_send_event(Binlog_transmit_param *param, int repl_semi_after_send_event(Binlog_transmit_param *param, const char *event_buf, unsigned long len) { + if (repl_semisync.is_semi_sync_slave()) + { + THD *thd= current_thd; + /* + Possible errors in reading slave reply are ignored deliberately + because we do not want dump thread to quit on this. Error + messages are already reported. + */ + (void) repl_semisync.readSlaveReply(&thd->net, + param->server_id, event_buf); + thd->clear_error(); + } return 0; } @@ -142,11 +162,6 @@ static void fix_rpl_semi_sync_master_enabled(MYSQL_THD thd, void *ptr, const void *val); -static void fix_rpl_semi_sync_master_reply_log_file_pos(MYSQL_THD thd, - SYS_VAR *var, - void *ptr, - const void *val); - static MYSQL_SYSVAR_BOOL(enabled, rpl_semi_sync_master_enabled, PLUGIN_VAR_OPCMDARG, "Enable semi-synchronous replication master (disabled by default). ", @@ -168,22 +183,10 @@ static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_master_trace_level, &fix_rpl_semi_sync_master_trace_level, // update 32, 0, ~0L, 1); -/* - Use a SESSION instead of GLOBAL variable for slave to send reply to - avoid requiring SUPER privilege. -*/ -static MYSQL_THDVAR_STR(reply_log_file_pos, - PLUGIN_VAR_NOCMDOPT, - "The log filename and position slave has queued to relay log.", - NULL, // check - &fix_rpl_semi_sync_master_reply_log_file_pos, - ""); - static SYS_VAR* semi_sync_master_system_vars[]= { MYSQL_SYSVAR(enabled), MYSQL_SYSVAR(timeout), MYSQL_SYSVAR(trace_level), - MYSQL_SYSVAR(reply_log_file_pos), NULL, }; @@ -228,19 +231,6 @@ static void fix_rpl_semi_sync_master_enabled(MYSQL_THD thd, return; } -static void fix_rpl_semi_sync_master_reply_log_file_pos(MYSQL_THD thd, - SYS_VAR *var, - void *ptr, - const void *val) -{ - const char *log_file_pos= *(char **)val; - - if (repl_semisync.reportReplyBinlog(log_file_pos)) - sql_print_error("report slave binlog reply failed."); - - return; -} - Trans_observer trans_observer = { sizeof(Trans_observer), // len diff --git a/plugin/semisync/semisync_slave.cc b/plugin/semisync/semisync_slave.cc index 3298ce316a8..6e773b2f743 100644 --- a/plugin/semisync/semisync_slave.cc +++ b/plugin/semisync/semisync_slave.cc @@ -104,19 +104,45 @@ int ReplSemiSyncSlave::slaveStop(Binlog_relay_IO_param *param) return 0; } -int ReplSemiSyncSlave::slaveReply(const char *log_name, my_off_t log_pos) +int ReplSemiSyncSlave::slaveReply(MYSQL *mysql, + const char *binlog_filename, + my_off_t binlog_filepos) { - char query[FN_REFLEN + 100]; - sprintf(query, "SET SESSION rpl_semi_sync_master_reply_log_file_pos='%llu:%s'", - (unsigned long long)log_pos, log_name); - if (mysql_real_query(mysql_reply, query, strlen(query))) + const char *kWho = "ReplSemiSyncSlave::slaveReply"; + NET *net= &mysql->net; + uchar reply_buffer[REPLY_MAGIC_NUM_LEN + + REPLY_BINLOG_POS_LEN + + REPLY_BINLOG_NAME_LEN]; + int reply_res, name_len = strlen(binlog_filename); + + function_enter(kWho); + + /* Prepare the buffer of the reply. */ + reply_buffer[REPLY_MAGIC_NUM_OFFSET] = kPacketMagicNum; + int8store(reply_buffer + REPLY_BINLOG_POS_OFFSET, binlog_filepos); + memcpy(reply_buffer + REPLY_BINLOG_NAME_OFFSET, + binlog_filename, + name_len + 1 /* including trailing '\0' */); + + if (trace_level_ & kTraceDetail) + sql_print_information("%s: reply (%s, %lu)", kWho, + binlog_filename, (ulong)binlog_filepos); + + net_clear(net, 0); + /* Send the reply. */ + reply_res = my_net_write(net, reply_buffer, + name_len + REPLY_BINLOG_NAME_OFFSET); + if (!reply_res) { - sql_print_error("Set 'rpl_semi_sync_master_reply_log_file_pos' on master failed"); - mysql_free_result(mysql_store_result(mysql_reply)); - mysql_close(mysql_reply); - mysql_reply= 0; - return 1; + reply_res = net_flush(net); + if (reply_res) + sql_print_error("Semi-sync slave net_flush() reply failed"); } - mysql_free_result(mysql_store_result(mysql_reply)); - return 0; + else + { + sql_print_error("Semi-sync slave send reply failed: %s (%d)", + net->last_error, net->last_errno); + } + + return function_exit(kWho, reply_res); } diff --git a/plugin/semisync/semisync_slave.h b/plugin/semisync/semisync_slave.h index 16fa31c69eb..f212911c49d 100644 --- a/plugin/semisync/semisync_slave.h +++ b/plugin/semisync/semisync_slave.h @@ -57,7 +57,7 @@ public: * payload_len - (IN) payload length * * Return: - * 0: success; -1 or otherwise: error + * 0: success; non-zero: error */ int slaveReadSyncHeader(const char *header, unsigned long total_len, bool *need_reply, const char **payload, unsigned long *payload_len); @@ -67,13 +67,15 @@ public: * binlog position. * * Input: - * log_name - (IN) the reply point's binlog file name - * log_pos - (IN) the reply point's binlog file offset + * mysql - (IN) the mysql network connection + * binlog_filename - (IN) the reply point's binlog file name + * binlog_filepos - (IN) the reply point's binlog file offset * * Return: - * 0: success; -1 or otherwise: error + * 0: success; non-zero: error */ - int slaveReply(const char *log_name, my_off_t log_pos); + int slaveReply(MYSQL *mysql, const char *binlog_filename, + my_off_t binlog_filepos); /* Connect to master for sending reply diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc index ffc663c9bdb..40c6ed9838c 100644 --- a/plugin/semisync/semisync_slave_plugin.cc +++ b/plugin/semisync/semisync_slave_plugin.cc @@ -45,13 +45,6 @@ int repl_semi_slave_request_dump(Binlog_relay_IO_param *param, if (!repl_semisync.getSlaveEnabled()) return 0; - /* - Create the connection that is used to send slave ACK replies to - master - */ - if (repl_semisync.slaveReplyConnect()) - return 1; - /* Check if master server has semi-sync plugin installed */ query= "SHOW VARIABLES LIKE 'rpl_semi_sync_master_enabled'"; if (mysql_real_query(mysql, query, strlen(query)) || @@ -106,7 +99,8 @@ int repl_semi_slave_queue_event(Binlog_relay_IO_param *param, uint32 flags) { if (rpl_semi_sync_slave_status && semi_sync_need_reply) - return repl_semisync.slaveReply(param->master_log_name, + return repl_semisync.slaveReply(param->mysql, + param->master_log_name, param->master_log_pos); return 0; } From 7d3d0fc303183ef50a343680ce70df71d5675cd1 Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Mon, 12 Oct 2009 20:57:30 +0800 Subject: [PATCH 84/88] Backport Bug#45852 Semisynch: Last_IO_Error: Fatal error: Failed to run 'after_queue_event' hook Errors when send reply to master should never cause the IO thread to stop, because master can fall back to async replication if it does not get reply from slave. The problem is fixed by deliberately ignoring the return value of slaveReply. --- plugin/semisync/semisync_slave_plugin.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc index 40c6ed9838c..ef508596698 100644 --- a/plugin/semisync/semisync_slave_plugin.cc +++ b/plugin/semisync/semisync_slave_plugin.cc @@ -99,9 +99,16 @@ int repl_semi_slave_queue_event(Binlog_relay_IO_param *param, uint32 flags) { if (rpl_semi_sync_slave_status && semi_sync_need_reply) - return repl_semisync.slaveReply(param->mysql, + { + /* + We deliberately ignore the error in slaveReply, such error + should not cause the slave IO thread to stop, and the error + messages are already reported. + */ + (void) repl_semisync.slaveReply(param->mysql, param->master_log_name, param->master_log_pos); + } return 0; } From 64fc766c93e4a5c9835af091d9adbb0799a301ad Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Mon, 12 Oct 2009 21:03:04 +0800 Subject: [PATCH 85/88] BUG#45674 FLUSH STATUS does not reset semisynchronous counters Semi-sync status were not reset by FLUSH STATUS, this was because all semi-sync status variables are defined as SHOW_FUNC and FLUSH STATUS could only reset SHOW_LONG type variables. This problem is fixed by change all status variables that should be reset by FLUSH STATUS from SHOW_FUNC to SHOW_LONG. After the fix, the following status variables will be reset by FLUSH STATUS: Rpl_semi_sync_master_yes_tx Rpl_semi_sync_master_no_tx Note: normally, FLUSH STATUS itself will be written into binlog and be replicated, so after FLUSH STATS, one of Rpl_semi_sync_master_yes_tx Rpl_semi_sync_master_no_tx can be 1 dependent on the semi-sync status. So it's recommended to use FLUSH NO_WRITE_TO_BINLOG STATUS to avoid this. --- mysql-test/suite/rpl/r/rpl_semi_sync.result | 18 ++++ mysql-test/suite/rpl/t/rpl_semi_sync.test | 14 +++ plugin/semisync/semisync_master.cc | 94 ++++++++------------- plugin/semisync/semisync_master.h | 27 ++---- plugin/semisync/semisync_master_plugin.cc | 79 ++++++++++------- 5 files changed, 123 insertions(+), 109 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result index ea8a2592852..6e57086a639 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -204,6 +204,24 @@ Rpl_semi_sync_master_clients 1 drop table t1; [ on slave ] include/stop_slave.inc +# +# Flush status +# +[ Semi-sync master status variables before FLUSH STATUS ] +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 3 +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 302 +FLUSH NO_WRITE_TO_BINLOG STATUS; +[ Semi-sync master status variables after FLUSH STATUS ] +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +Variable_name Value +Rpl_semi_sync_master_no_tx 0 +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; +Variable_name Value +Rpl_semi_sync_master_yes_tx 0 [ on master ] show master logs; Log_name master-bin.000001 diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index cadbb69e47d..52e6a309b12 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -287,6 +287,20 @@ echo [ on slave ]; source include/stop_slave.inc; +--echo # +--echo # Flush status +--echo # +connection master; +echo [ Semi-sync master status variables before FLUSH STATUS ]; +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; +# Do not write the FLUSH STATUS to binlog, to make sure we'll get a +# clean status after this. +FLUSH NO_WRITE_TO_BINLOG STATUS; +echo [ Semi-sync master status variables after FLUSH STATUS ]; +SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; +SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; + connection master; echo [ on master ]; diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index decab205674..a51c1e5bc5c 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -30,16 +30,16 @@ unsigned long rpl_semi_sync_master_yes_transactions = 0; unsigned long rpl_semi_sync_master_no_transactions = 0; unsigned long rpl_semi_sync_master_off_times = 0; unsigned long rpl_semi_sync_master_timefunc_fails = 0; -unsigned long rpl_semi_sync_master_num_timeouts = 0; +unsigned long rpl_semi_sync_master_wait_timeouts = 0; unsigned long rpl_semi_sync_master_wait_sessions = 0; -unsigned long rpl_semi_sync_master_back_wait_pos = 0; -unsigned long rpl_semi_sync_master_trx_wait_time = 0; +unsigned long rpl_semi_sync_master_wait_pos_backtraverse = 0; +unsigned long rpl_semi_sync_master_avg_trx_wait_time = 0; unsigned long long rpl_semi_sync_master_trx_wait_num = 0; -unsigned long rpl_semi_sync_master_net_wait_time = 0; +unsigned long rpl_semi_sync_master_avg_net_wait_time = 0; unsigned long long rpl_semi_sync_master_net_wait_num = 0; unsigned long rpl_semi_sync_master_clients = 0; -unsigned long long rpl_semi_sync_master_net_wait_total_time = 0; -unsigned long long rpl_semi_sync_master_trx_wait_total_time = 0; +unsigned long long rpl_semi_sync_master_net_wait_time = 0; +unsigned long long rpl_semi_sync_master_trx_wait_time = 0; static int getWaitTime(const struct timeval& start_tv); @@ -379,16 +379,6 @@ ReplSemiSyncMaster::ReplSemiSyncMaster() master_enabled_(false), wait_timeout_(0L), state_(0), - enabled_transactions_(0), - disabled_transactions_(0), - switched_off_times_(0), - timefunc_fails_(0), - wait_sessions_(0), - wait_backtraverse_(0), - total_trx_wait_num_(0), - total_trx_wait_time_(0), - total_net_wait_num_(0), - total_net_wait_time_(0), max_transactions_(0L) { strcpy(reply_file_name_, ""); @@ -611,7 +601,7 @@ int ReplSemiSyncMaster::reportReplyBinlog(uint32 server_id, log_file_name, (unsigned long)log_file_pos); } - if (wait_sessions_ > 0) + if (rpl_semi_sync_master_wait_sessions > 0) { /* Let us check if some of the waiting threads doing a trx * commit can now proceed. @@ -707,7 +697,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, strcpy(wait_file_name_, trx_wait_binlog_name); wait_file_pos_ = trx_wait_binlog_pos; - wait_backtraverse_++; + rpl_semi_sync_master_wait_pos_backtraverse++; if (trace_level_ & kTraceDetail) sql_print_information("%s: move back wait position (%s, %lu),", kWho, wait_file_name_, (unsigned long)wait_file_pos_); @@ -752,7 +742,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, * when replication has progressed far enough, we will release * these waiting threads. */ - wait_sessions_++; + rpl_semi_sync_master_wait_sessions++; if (trace_level_ & kTraceDetail) sql_print_information("%s: wait %lu ms for binlog sent (%s, %lu)", @@ -760,7 +750,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, wait_file_name_, (unsigned long)wait_file_pos_); wait_result = cond_timewait(&abstime); - wait_sessions_--; + rpl_semi_sync_master_wait_sessions--; if (wait_result != 0) { @@ -769,7 +759,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, "semi-sync up to file %s, position %lu.", trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos, reply_file_name_, (unsigned long)reply_file_pos_); - total_wait_timeouts_++; + rpl_semi_sync_master_wait_timeouts++; /* switch semi-sync off */ switch_off(); @@ -788,12 +778,12 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, "wait position (%s, %lu)", trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos); } - timefunc_fails_++; + rpl_semi_sync_master_timefunc_fails++; } else { - total_trx_wait_num_++; - total_trx_wait_time_ += wait_time; + rpl_semi_sync_master_trx_wait_num++; + rpl_semi_sync_master_trx_wait_time += wait_time; } } } @@ -806,7 +796,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, "wait position (%s, %lu)", trx_wait_binlog_name, (unsigned long)trx_wait_binlog_pos); } - timefunc_fails_++; + rpl_semi_sync_master_timefunc_fails++; /* switch semi-sync off */ switch_off(); @@ -823,9 +813,9 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, /* Update the status counter. */ if (is_on() && rpl_semi_sync_master_clients) - enabled_transactions_++; + rpl_semi_sync_master_yes_transactions++; else - disabled_transactions_++; + rpl_semi_sync_master_no_transactions++; /* The lock held will be released by thd_exit_cond, so no need to call unlock() here */ @@ -865,7 +855,7 @@ int ReplSemiSyncMaster::switch_off() assert(active_tranxs_ != NULL); result = active_tranxs_->clear_active_tranx_nodes(NULL, 0); - switched_off_times_++; + rpl_semi_sync_master_off_times++; wait_file_name_inited_ = false; reply_file_name_inited_ = false; sql_print_information("Semi-sync replication switched OFF."); @@ -1232,16 +1222,16 @@ int ReplSemiSyncMaster::resetMaster() reply_file_name_inited_ = false; commit_file_name_inited_ = false; - enabled_transactions_ = 0; - disabled_transactions_ = 0; - switched_off_times_ = 0; - timefunc_fails_ = 0; - wait_sessions_ = 0; - wait_backtraverse_ = 0; - total_trx_wait_num_ = 0; - total_trx_wait_time_ = 0; - total_net_wait_num_ = 0; - total_net_wait_time_ = 0; + rpl_semi_sync_master_yes_transactions = 0; + rpl_semi_sync_master_no_transactions = 0; + rpl_semi_sync_master_off_times = 0; + rpl_semi_sync_master_timefunc_fails = 0; + rpl_semi_sync_master_wait_sessions = 0; + rpl_semi_sync_master_wait_pos_backtraverse = 0; + rpl_semi_sync_master_trx_wait_num = 0; + rpl_semi_sync_master_trx_wait_time = 0; + rpl_semi_sync_master_net_wait_num = 0; + rpl_semi_sync_master_net_wait_time = 0; unlock(); @@ -1253,26 +1243,14 @@ void ReplSemiSyncMaster::setExportStats() lock(); rpl_semi_sync_master_status = state_ && rpl_semi_sync_master_clients; - rpl_semi_sync_master_yes_transactions = enabled_transactions_; - rpl_semi_sync_master_no_transactions = disabled_transactions_; - rpl_semi_sync_master_off_times = switched_off_times_; - rpl_semi_sync_master_timefunc_fails = timefunc_fails_; - rpl_semi_sync_master_num_timeouts = total_wait_timeouts_; - rpl_semi_sync_master_wait_sessions = wait_sessions_; - rpl_semi_sync_master_back_wait_pos = wait_backtraverse_; - rpl_semi_sync_master_trx_wait_num = total_trx_wait_num_; - rpl_semi_sync_master_trx_wait_time = - ((total_trx_wait_num_) ? - (unsigned long)((double)total_trx_wait_time_ / - ((double)total_trx_wait_num_)) : 0); - rpl_semi_sync_master_net_wait_num = total_net_wait_num_; - rpl_semi_sync_master_net_wait_time = - ((total_net_wait_num_) ? - (unsigned long)((double)total_net_wait_time_ / - ((double)total_net_wait_num_)) : 0); - - rpl_semi_sync_master_net_wait_total_time = total_net_wait_time_; - rpl_semi_sync_master_trx_wait_total_time = total_trx_wait_time_; + rpl_semi_sync_master_avg_trx_wait_time= + ((rpl_semi_sync_master_trx_wait_num) ? + (unsigned long)((double)rpl_semi_sync_master_trx_wait_time / + ((double)rpl_semi_sync_master_trx_wait_num)) : 0); + rpl_semi_sync_master_avg_net_wait_time= + ((rpl_semi_sync_master_net_wait_num) ? + (unsigned long)((double)rpl_semi_sync_master_net_wait_time / + ((double)rpl_semi_sync_master_net_wait_num)) : 0); unlock(); } diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h index 50a4665efb8..28c0041ff72 100644 --- a/plugin/semisync/semisync_master.h +++ b/plugin/semisync/semisync_master.h @@ -175,19 +175,7 @@ class ReplSemiSyncMaster volatile bool master_enabled_; /* semi-sync is enabled on the master */ unsigned long wait_timeout_; /* timeout period(ms) during tranx wait */ - /* All status variables. */ bool state_; /* whether semi-sync is switched */ - unsigned long enabled_transactions_; /* semi-sync'ed tansactions */ - unsigned long disabled_transactions_; /* non-semi-sync'ed tansactions */ - unsigned long switched_off_times_; /* how many times are switched off? */ - unsigned long timefunc_fails_; /* how many time function fails? */ - unsigned long total_wait_timeouts_; /* total number of wait timeouts */ - unsigned long wait_sessions_; /* how many sessions wait for replies? */ - unsigned long wait_backtraverse_; /* wait position back traverses */ - unsigned long long total_trx_wait_num_; /* total trx waits: non-timeout ones */ - unsigned long long total_trx_wait_time_; /* total trx wait time: in us */ - unsigned long long total_net_wait_num_; /* total network waits */ - unsigned long long total_net_wait_time_; /* total network wait time */ /* The number of maximum active transactions. This should be the same as * maximum connections because MySQL does not do connection sharing now. @@ -356,22 +344,23 @@ class ReplSemiSyncMaster /* System and status variables for the master component */ extern char rpl_semi_sync_master_enabled; +extern char rpl_semi_sync_master_status; +extern unsigned long rpl_semi_sync_master_clients; extern unsigned long rpl_semi_sync_master_timeout; extern unsigned long rpl_semi_sync_master_trace_level; -extern char rpl_semi_sync_master_status; extern unsigned long rpl_semi_sync_master_yes_transactions; extern unsigned long rpl_semi_sync_master_no_transactions; extern unsigned long rpl_semi_sync_master_off_times; +extern unsigned long rpl_semi_sync_master_wait_timeouts; extern unsigned long rpl_semi_sync_master_timefunc_fails; extern unsigned long rpl_semi_sync_master_num_timeouts; extern unsigned long rpl_semi_sync_master_wait_sessions; -extern unsigned long rpl_semi_sync_master_back_wait_pos; -extern unsigned long rpl_semi_sync_master_trx_wait_time; -extern unsigned long rpl_semi_sync_master_net_wait_time; +extern unsigned long rpl_semi_sync_master_wait_pos_backtraverse; +extern unsigned long rpl_semi_sync_master_avg_trx_wait_time; +extern unsigned long rpl_semi_sync_master_avg_net_wait_time; extern unsigned long long rpl_semi_sync_master_net_wait_num; extern unsigned long long rpl_semi_sync_master_trx_wait_num; -extern unsigned long long rpl_semi_sync_master_net_wait_total_time; -extern unsigned long long rpl_semi_sync_master_trx_wait_total_time; -extern unsigned long rpl_semi_sync_master_clients; +extern unsigned long long rpl_semi_sync_master_net_wait_time; +extern unsigned long long rpl_semi_sync_master_trx_wait_time; #endif /* SEMISYNC_MASTER_H */ diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc index 9c76b5369b6..4b98ec5d835 100644 --- a/plugin/semisync/semisync_master_plugin.cc +++ b/plugin/semisync/semisync_master_plugin.cc @@ -268,45 +268,60 @@ Binlog_transmit_observer transmit_observer = { return 0; \ } -DEF_SHOW_FUNC(clients, SHOW_LONG) -DEF_SHOW_FUNC(net_wait_time, SHOW_LONG) -DEF_SHOW_FUNC(net_wait_total_time, SHOW_LONGLONG) -DEF_SHOW_FUNC(net_wait_num, SHOW_LONGLONG) -DEF_SHOW_FUNC(off_times, SHOW_LONG) -DEF_SHOW_FUNC(no_transactions, SHOW_LONG) DEF_SHOW_FUNC(status, SHOW_BOOL) -DEF_SHOW_FUNC(timefunc_fails, SHOW_LONG) -DEF_SHOW_FUNC(trx_wait_time, SHOW_LONG) -DEF_SHOW_FUNC(trx_wait_total_time, SHOW_LONGLONG) +DEF_SHOW_FUNC(clients, SHOW_LONG) +DEF_SHOW_FUNC(trx_wait_time, SHOW_LONGLONG) DEF_SHOW_FUNC(trx_wait_num, SHOW_LONGLONG) -DEF_SHOW_FUNC(back_wait_pos, SHOW_LONG) -DEF_SHOW_FUNC(wait_sessions, SHOW_LONG) -DEF_SHOW_FUNC(yes_transactions, SHOW_LONG) +DEF_SHOW_FUNC(net_wait_time, SHOW_LONGLONG) +DEF_SHOW_FUNC(net_wait_num, SHOW_LONGLONG) +DEF_SHOW_FUNC(avg_net_wait_time, SHOW_LONG) +DEF_SHOW_FUNC(avg_trx_wait_time, SHOW_LONG) /* plugin status variables */ static SHOW_VAR semi_sync_master_status_vars[]= { - {"Rpl_semi_sync_master_clients", (char*) &SHOW_FNAME(clients), SHOW_FUNC}, - {"Rpl_semi_sync_master_net_avg_wait_time", - (char*) &SHOW_FNAME(net_wait_time), SHOW_FUNC}, - {"Rpl_semi_sync_master_net_wait_time", - (char*) &SHOW_FNAME(net_wait_total_time), SHOW_FUNC}, - {"Rpl_semi_sync_master_net_waits", (char*) &SHOW_FNAME(net_wait_num), SHOW_FUNC}, - {"Rpl_semi_sync_master_no_times", (char*) &SHOW_FNAME(off_times), SHOW_FUNC}, - {"Rpl_semi_sync_master_no_tx", (char*) &SHOW_FNAME(no_transactions), SHOW_FUNC}, - {"Rpl_semi_sync_master_status", (char*) &SHOW_FNAME(status), SHOW_FUNC}, - {"Rpl_semi_sync_master_timefunc_failures", - (char*) &SHOW_FNAME(timefunc_fails), SHOW_FUNC}, - {"Rpl_semi_sync_master_tx_avg_wait_time", - (char*) &SHOW_FNAME(trx_wait_time), SHOW_FUNC}, - {"Rpl_semi_sync_master_tx_wait_time", - (char*) &SHOW_FNAME(trx_wait_total_time), SHOW_FUNC}, - {"Rpl_semi_sync_master_tx_waits", (char*) &SHOW_FNAME(trx_wait_num), SHOW_FUNC}, - {"Rpl_semi_sync_master_wait_pos_backtraverse", - (char*) &SHOW_FNAME(back_wait_pos), SHOW_FUNC}, + {"Rpl_semi_sync_master_status", + (char*) &SHOW_FNAME(status), + SHOW_FUNC}, + {"Rpl_semi_sync_master_clients", + (char*) &SHOW_FNAME(clients), + SHOW_FUNC}, + {"Rpl_semi_sync_master_yes_tx", + (char*) &rpl_semi_sync_master_yes_transactions, + SHOW_LONG}, + {"Rpl_semi_sync_master_no_tx", + (char*) &rpl_semi_sync_master_no_transactions, + SHOW_LONG}, {"Rpl_semi_sync_master_wait_sessions", - (char*) &SHOW_FNAME(wait_sessions), SHOW_FUNC}, - {"Rpl_semi_sync_master_yes_tx", (char*) &SHOW_FNAME(yes_transactions), SHOW_FUNC}, + (char*) &rpl_semi_sync_master_wait_sessions, + SHOW_LONG}, + {"Rpl_semi_sync_master_no_times", + (char*) &rpl_semi_sync_master_off_times, + SHOW_LONG}, + {"Rpl_semi_sync_master_timefunc_failures", + (char*) &rpl_semi_sync_master_timefunc_fails, + SHOW_LONG}, + {"Rpl_semi_sync_master_wait_pos_backtraverse", + (char*) &rpl_semi_sync_master_wait_pos_backtraverse, + SHOW_LONG}, + {"Rpl_semi_sync_master_tx_wait_time", + (char*) &SHOW_FNAME(trx_wait_time), + SHOW_FUNC}, + {"Rpl_semi_sync_master_tx_waits", + (char*) &SHOW_FNAME(trx_wait_num), + SHOW_FUNC}, + {"Rpl_semi_sync_master_tx_avg_wait_time", + (char*) &SHOW_FNAME(avg_trx_wait_time), + SHOW_FUNC}, + {"Rpl_semi_sync_master_net_wait_time", + (char*) &SHOW_FNAME(net_wait_time), + SHOW_FUNC}, + {"Rpl_semi_sync_master_net_waits", + (char*) &SHOW_FNAME(net_wait_num), + SHOW_FUNC}, + {"Rpl_semi_sync_master_net_avg_wait_time", + (char*) &SHOW_FNAME(avg_net_wait_time), + SHOW_FUNC}, {NULL, NULL, SHOW_LONG}, }; From b92ec529153d9b45cb3db1a5c1ee74d87590aa7a Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Mon, 12 Oct 2009 21:15:32 +0800 Subject: [PATCH 86/88] Backport BUG#47298 Semisync: always wait until timeout if no semi-sync slave available Add an option to control whether the master should keep waiting until timeout when it detected that there is no semi-sync slave available. The bool option 'rpl_semi_sync_master_wait_no_slave' is 1 by defalt, and will keep waiting until timeout. When set to 0, the master will switch to asynchronous replication immediately when no semi-sync slave is available. --- mysql-test/suite/rpl/r/rpl_semi_sync.result | 14 ++++++------- mysql-test/suite/rpl/t/rpl_semi_sync.test | 7 +++++-- plugin/semisync/semisync_master.cc | 23 ++++++++++++++------- plugin/semisync/semisync_master.h | 8 +++++++ plugin/semisync/semisync_master_plugin.cc | 10 ++++++++- plugin/semisync/semisync_slave_plugin.cc | 7 ++++--- 6 files changed, 49 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result index 6e57086a639..607b77fbd04 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result @@ -29,13 +29,13 @@ set global rpl_semi_sync_master_enabled = 1; show variables like 'rpl_semi_sync_master_enabled'; Variable_name Value rpl_semi_sync_master_enabled ON -[ status of semi-sync on master should be OFF without any semi-sync slaves ] +[ status of semi-sync on master should be ON even without any semi-sync slaves ] show status like 'Rpl_semi_sync_master_clients'; Variable_name Value Rpl_semi_sync_master_clients 0 show status like 'Rpl_semi_sync_master_status'; Variable_name Value -Rpl_semi_sync_master_status OFF +Rpl_semi_sync_master_status ON show status like 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 0 @@ -210,7 +210,7 @@ include/stop_slave.inc [ Semi-sync master status variables before FLUSH STATUS ] SHOW STATUS LIKE 'Rpl_semi_sync_master_no_tx'; Variable_name Value -Rpl_semi_sync_master_no_tx 3 +Rpl_semi_sync_master_no_tx 302 SHOW STATUS LIKE 'Rpl_semi_sync_master_yes_tx'; Variable_name Value Rpl_semi_sync_master_yes_tx 302 @@ -355,7 +355,7 @@ Variable_name Value Rpl_semi_sync_master_clients 0 show status like 'Rpl_semi_sync_master_status'; Variable_name Value -Rpl_semi_sync_master_status OFF +Rpl_semi_sync_master_status ON set global rpl_semi_sync_master_enabled= 0; [ on slave ] SHOW VARIABLES LIKE 'rpl_semi_sync_slave_enabled'; @@ -364,17 +364,17 @@ rpl_semi_sync_slave_enabled ON include/start_slave.inc [ on master ] insert into t1 values (8); -[ master semi-sync clients should be 0, status should be OFF ] +[ master semi-sync clients should be 1, status should be OFF ] show status like 'Rpl_semi_sync_master_clients'; Variable_name Value -Rpl_semi_sync_master_clients 0 +Rpl_semi_sync_master_clients 1 show status like 'Rpl_semi_sync_master_status'; Variable_name Value Rpl_semi_sync_master_status OFF [ on slave ] show status like 'Rpl_semi_sync_slave_status'; Variable_name Value -Rpl_semi_sync_slave_status OFF +Rpl_semi_sync_slave_status ON include/stop_slave.inc [ on master ] set sql_log_bin=0; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 52e6a309b12..8f1d4ccaa42 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -74,7 +74,7 @@ echo [ enable semi-sync on master ]; set global rpl_semi_sync_master_enabled = 1; show variables like 'rpl_semi_sync_master_enabled'; -echo [ status of semi-sync on master should be OFF without any semi-sync slaves ]; +echo [ status of semi-sync on master should be ON even without any semi-sync slaves ]; show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_yes_tx'; @@ -497,7 +497,10 @@ source include/start_slave.inc; connection master; echo [ on master ]; insert into t1 values (8); -echo [ master semi-sync clients should be 0, status should be OFF ]; +let $status_var= Rpl_semi_sync_master_clients; +let $status_var_value= 1; +source include/wait_for_status_var.inc; +echo [ master semi-sync clients should be 1, status should be OFF ]; show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_status'; sync_slave_with_master; diff --git a/plugin/semisync/semisync_master.cc b/plugin/semisync/semisync_master.cc index a51c1e5bc5c..1a7106621a4 100644 --- a/plugin/semisync/semisync_master.cc +++ b/plugin/semisync/semisync_master.cc @@ -40,6 +40,7 @@ unsigned long long rpl_semi_sync_master_net_wait_num = 0; unsigned long rpl_semi_sync_master_clients = 0; unsigned long long rpl_semi_sync_master_net_wait_time = 0; unsigned long long rpl_semi_sync_master_trx_wait_time = 0; +char rpl_semi_sync_master_wait_no_slave = 1; static int getWaitTime(const struct timeval& start_tv); @@ -525,6 +526,14 @@ void ReplSemiSyncMaster::remove_slave() { lock(); rpl_semi_sync_master_clients--; + + /* If user has chosen not to wait if no semi-sync slave available + and the last semi-sync slave exits, turn off semi-sync on master + immediately. + */ + if (!rpl_semi_sync_master_wait_no_slave && + rpl_semi_sync_master_clients == 0) + switch_off(); unlock(); } @@ -812,7 +821,7 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name, trx_wait_binlog_pos)); /* Update the status counter. */ - if (is_on() && rpl_semi_sync_master_clients) + if (is_on()) rpl_semi_sync_master_yes_transactions++; else rpl_semi_sync_master_no_transactions++; @@ -1078,7 +1087,7 @@ int ReplSemiSyncMaster::writeTranxInBinlog(const char* log_file_name, commit_file_name_inited_ = true; } - if (is_on() && rpl_semi_sync_master_clients) + if (is_on()) { assert(active_tranxs_ != NULL); if(active_tranxs_->insert_tranx_node(log_file_name, log_file_pos)) @@ -1153,7 +1162,7 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id, { sql_print_error("Semi-sync master wait for reply " "gettimeofday fail to get start time"); - timefunc_fails_++; + rpl_semi_sync_master_timefunc_fails++; } else { @@ -1164,12 +1173,12 @@ int ReplSemiSyncMaster::readSlaveReply(NET *net, uint32 server_id, { sql_print_error("Semi-sync master wait for reply " "gettimeofday fail to get wait time."); - timefunc_fails_++; + rpl_semi_sync_master_timefunc_fails++; } else { - total_net_wait_num_++; - total_net_wait_time_ += wait_time; + rpl_semi_sync_master_net_wait_num++; + rpl_semi_sync_master_net_wait_time += wait_time; } } } @@ -1242,7 +1251,7 @@ void ReplSemiSyncMaster::setExportStats() { lock(); - rpl_semi_sync_master_status = state_ && rpl_semi_sync_master_clients; + rpl_semi_sync_master_status = state_; rpl_semi_sync_master_avg_trx_wait_time= ((rpl_semi_sync_master_trx_wait_num) ? (unsigned long)((double)rpl_semi_sync_master_trx_wait_time / diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h index 28c0041ff72..d2b87745600 100644 --- a/plugin/semisync/semisync_master.h +++ b/plugin/semisync/semisync_master.h @@ -363,4 +363,12 @@ extern unsigned long long rpl_semi_sync_master_trx_wait_num; extern unsigned long long rpl_semi_sync_master_net_wait_time; extern unsigned long long rpl_semi_sync_master_trx_wait_time; +/* + This indicates whether we should keep waiting if no semi-sync slave + is available. + 0 : stop waiting if detected no avaialable semi-sync slave. + 1 (default) : keep waiting until timeout even no available semi-sync slave. +*/ +extern char rpl_semi_sync_master_wait_no_slave; + #endif /* SEMISYNC_MASTER_H */ diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc index 4b98ec5d835..d2ef500d932 100644 --- a/plugin/semisync/semisync_master_plugin.cc +++ b/plugin/semisync/semisync_master_plugin.cc @@ -76,7 +76,7 @@ int repl_semi_binlog_dump_start(Binlog_transmit_param *param, /* Let's assume this semi-sync slave has already received all binlog events before the filename and position it requests. - */ + */ repl_semisync.reportReplyBinlog(param->server_id, log_file, log_pos); } sql_print_information("Start %s binlog_dump to slave (server_id: %d), pos(%s, %lu)", @@ -176,6 +176,13 @@ static MYSQL_SYSVAR_ULONG(timeout, rpl_semi_sync_master_timeout, fix_rpl_semi_sync_master_timeout, // update 10000, 0, ~0L, 1); +static MYSQL_SYSVAR_BOOL(wait_no_slave, rpl_semi_sync_master_wait_no_slave, + PLUGIN_VAR_OPCMDARG, + "Wait until timeout when no semi-synchronous replication slave available (enabled by default). ", + NULL, // check + NULL, // update + 1); + static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_master_trace_level, PLUGIN_VAR_OPCMDARG, "The tracing level for semi-sync replication.", @@ -186,6 +193,7 @@ static MYSQL_SYSVAR_ULONG(trace_level, rpl_semi_sync_master_trace_level, static SYS_VAR* semi_sync_master_system_vars[]= { MYSQL_SYSVAR(enabled), MYSQL_SYSVAR(timeout), + MYSQL_SYSVAR(wait_no_slave), MYSQL_SYSVAR(trace_level), NULL, }; diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc index ef508596698..0bd9e1b8b21 100644 --- a/plugin/semisync/semisync_slave_plugin.cc +++ b/plugin/semisync/semisync_slave_plugin.cc @@ -56,10 +56,11 @@ int repl_semi_slave_request_dump(Binlog_relay_IO_param *param, } row= mysql_fetch_row(res); - if (!row || strcmp(row[1], "ON")) + if (!row) { - /* Master does not support or not configured semi-sync */ - sql_print_warning("Master server does not support or not configured semi-sync replication, fallback to asynchronous"); + /* Master does not support semi-sync */ + sql_print_warning("Master server does not support semi-sync, " + "fallback to asynchronous replication"); rpl_semi_sync_slave_status= 0; return 0; } From dab1162b53e25bd1d2510e76b512ba5e1a8c172d Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Mon, 12 Oct 2009 21:21:13 +0800 Subject: [PATCH 87/88] Backport post fix for semisync Remove functions that no longer needed Fix warning suppressions --- mysql-test/suite/rpl/t/rpl_semi_sync.test | 18 +++++++++--------- plugin/semisync/semisync_slave.cc | 10 ---------- plugin/semisync/semisync_slave.h | 5 ----- 3 files changed, 9 insertions(+), 24 deletions(-) diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index 8f1d4ccaa42..faf961bb580 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -7,21 +7,21 @@ source include/master-slave.inc; let $engine_type= InnoDB; #let $engine_type= MyISAM; -# After fix of BUG#45848, semi-sync slave should not create any extra -# connections on master, save the count of connections before start -# semi-sync slave for comparison below. -let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); - # Suppress warnings that might be generated during the test disable_query_log; connection master; call mtr.add_suppression("Timeout waiting for reply of binlog"); +call mtr.add_suppression("Read semi-sync reply"); connection slave; -call mtr.add_suppression("Master server does not support"); -# These will be removed after fix bug#45852 -call mtr.add_suppression("Set 'rpl_semi_sync_master_reply_log_file_pos' on master failed"); -call mtr.add_suppression("Slave I/O: Fatal error: Failed to run 'after_queue_event' hook, Error_code: 1593"); +call mtr.add_suppression("Master server does not support semi-sync"); +call mtr.add_suppression("Semi-sync slave .* reply"); enable_query_log; +connection master; + +# After fix of BUG#45848, semi-sync slave should not create any extra +# connections on master, save the count of connections before start +# semi-sync slave for comparison below. +let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connected', Value, 1); --echo # --echo # Uninstall semi-sync plugins on master and slave diff --git a/plugin/semisync/semisync_slave.cc b/plugin/semisync/semisync_slave.cc index 6e773b2f743..109577fb688 100644 --- a/plugin/semisync/semisync_slave.cc +++ b/plugin/semisync/semisync_slave.cc @@ -39,16 +39,6 @@ int ReplSemiSyncSlave::initObject() return result; } -int ReplSemiSyncSlave::slaveReplyConnect() -{ - if (!mysql_reply && !(mysql_reply= rpl_connect_master(NULL))) - { - sql_print_error("Semisync slave connect to master for reply failed"); - return 1; - } - return 0; -} - int ReplSemiSyncSlave::slaveReadSyncHeader(const char *header, unsigned long total_len, bool *need_reply, diff --git a/plugin/semisync/semisync_slave.h b/plugin/semisync/semisync_slave.h index f212911c49d..19ea43e2653 100644 --- a/plugin/semisync/semisync_slave.h +++ b/plugin/semisync/semisync_slave.h @@ -77,11 +77,6 @@ public: int slaveReply(MYSQL *mysql, const char *binlog_filename, my_off_t binlog_filepos); - /* - Connect to master for sending reply - */ - int slaveReplyConnect(); - int slaveStart(Binlog_relay_IO_param *param); int slaveStop(Binlog_relay_IO_param *param); From c1584c98010515b3c51c1d0987b824182e0610aa Mon Sep 17 00:00:00 2001 From: He Zhenxing Date: Wed, 14 Oct 2009 13:24:47 +0800 Subject: [PATCH 88/88] Postfix after merge semi-sync with heartbeat Use ev_offset instead of 1 as the packet header offset when getting log position from events for heartbeat call reset_transmit_packet before calling send_heartbeat_event --- sql/sql_repl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 20ac7b01eda..9e4ef364408 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -427,7 +427,6 @@ static int send_heartbeat_event(NET* net, String* packet, { DBUG_RETURN(-1); } - packet->set("\0", 1, &my_charset_bin); DBUG_RETURN(0); } @@ -689,7 +688,7 @@ impossible position"; log's filename does not change while it's active */ if (coord) - coord->pos= uint4korr(packet->ptr() + 1 + LOG_POS_OFFSET); + coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET); event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]); if (event_type == FORMAT_DESCRIPTION_EVENT) @@ -849,6 +848,9 @@ impossible position"; sql_print_information("the rest of heartbeat info skipped ..."); } #endif + /* reset transmit packet for the heartbeat event */ + if (reset_transmit_packet(thd, flags, &ev_offset, &errmsg)) + goto err; if (send_heartbeat_event(net, packet, coord)) { errmsg = "Failed on my_net_write()";