From 7e8884632374ea719ac163e6ce1f700c2e55a834 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Tue, 16 Feb 2010 22:34:34 +0300 Subject: [PATCH 1/4] Bug#48308. 1. Now test use fake_relay_log primitive 2. Added RESET SLAVE to include/setup_fake_relay_log.inc for removing relay log info file 3. Added RESET SLAVE to include/cleanup_fake_relay_log.inc 4. Test moved to rpl suite as rpl_binlog_auto_inc_bug33029.test 5. Updated result file --- mysql-test/include/cleanup_fake_relay_log.inc | 4 + mysql-test/include/setup_fake_relay_log.inc | 28 +++---- .../t/binlog_auto_increment_bug33029.test | 74 ------------------- .../r/rpl_binlog_auto_inc_bug33029.result} | 9 +-- .../rpl_binlog_auto_inc_bug33029-master.opt} | 0 .../rpl/t/rpl_binlog_auto_inc_bug33029.test | 42 +++++++++++ 6 files changed, 58 insertions(+), 99 deletions(-) delete mode 100644 mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test rename mysql-test/suite/{binlog/r/binlog_auto_increment_bug33029.result => rpl/r/rpl_binlog_auto_inc_bug33029.result} (61%) rename mysql-test/suite/{binlog/t/binlog_auto_increment_bug33029-master.opt => rpl/t/rpl_binlog_auto_inc_bug33029-master.opt} (100%) create mode 100644 mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test diff --git a/mysql-test/include/cleanup_fake_relay_log.inc b/mysql-test/include/cleanup_fake_relay_log.inc index 43aa46cb657..000c80f3761 100644 --- a/mysql-test/include/cleanup_fake_relay_log.inc +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -12,5 +12,9 @@ remove_file $_fake_relay_log; remove_file $_fake_relay_index; --disable_query_log +--disable_warnings +STOP SLAVE SQL_THREAD; +RESET SLAVE; eval SET @@global.relay_log_purge= $_fake_relay_log_purge; +--enable_warnings --enable_query_log diff --git a/mysql-test/include/setup_fake_relay_log.inc b/mysql-test/include/setup_fake_relay_log.inc index 9510a557159..86a5da328af 100644 --- a/mysql-test/include/setup_fake_relay_log.inc +++ b/mysql-test/include/setup_fake_relay_log.inc @@ -66,8 +66,16 @@ let $_fake_relay_index= $MYSQLD_DATADIR/$_fake_filename.index; # CHANGE MASTER modifies it (see the manual for CHANGE MASTER). let $_fake_relay_log_purge= `SELECT @@global.relay_log_purge`; +# Reset slave and remove relay log and index files if they exist +RESET SLAVE; +error 0,1; +remove_file $MYSQLD_DATADIR/$_fake_filename.000001; +error 0,1; +remove_file $MYSQLD_DATADIR/$_fake_filename.index; + # Create relay log file. copy_file $fake_relay_log $_fake_relay_log; + # Create relay log index. # After patch for BUG#12190, the filename used in CHANGE MASTER @@ -77,28 +85,12 @@ copy_file $fake_relay_log $_fake_relay_log; if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`) { - -- let $_index_entry= ./$_fake_filename-fake.000001 + 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`) { - -- let $_index_entry= .\\\\$_fake_filename-fake.000001 -} - -if (`SELECT LENGTH(@@secure_file_priv) > 0`) -{ - -- let $_file_priv_dir= `SELECT @@secure_file_priv`; - -- let $_suffix= `SELECT UUID()` - -- let $_tmp_file= $_file_priv_dir/fake-index.$_suffix - - -- eval select '$_index_entry\n' into dumpfile '$_tmp_file' - -- copy_file $_tmp_file $_fake_relay_index - -- remove_file $_tmp_file -} - -if (`SELECT LENGTH(@@secure_file_priv) = 0`) -{ - -- eval select '$_index_entry\n' into dumpfile '$_fake_relay_index' + eval select '.\\\\$_fake_filename-fake.000001\n' into dumpfile '$_fake_relay_index'; } # Setup replication from existing relay log. diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test b/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test deleted file mode 100644 index 19137066429..00000000000 --- a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029.test +++ /dev/null @@ -1,74 +0,0 @@ -# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting -# using a trig in SP - -# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, -# if one statement in a SP generated AUTO_INCREMENT value by the top -# statement, all statements after it would be considered generated -# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID -# value might be associated with these statement, which could cause -# duplicate entry error and stop the slave. - -# Test if the slave can replicate from such a buggy master - -# The bug33029-slave-relay-bin.000001 file is the -# slave-replay-bin.000003 file generated by run the -# rpl_auto_increment_bug33029.test with clean up statements at the end -# of the test case removed on a buggy 5.0 server - -source include/have_log_bin.inc; - -# Need to restore this at the end; CHANGE MASTER modifies it (see the -# manual for CHANGE MASTER). -SET @old_relay_log_purge= @@global.relay_log_purge; - -let $MYSQLD_DATADIR= `select @@datadir`; - -copy_file $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 $MYSQLD_DATADIR/slave-relay-bin.000001; - - -# 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', - RELAY_LOG_FILE='slave-relay-bin.000001', - RELAY_LOG_POS=4; - -start slave sql_thread; -disable_result_log; -select MASTER_POS_WAIT('master-bin.000001', 3776); -enable_result_log; - -echo # Result on slave; -SELECT * FROM t1; -SELECT * FROM t2; - -# clean up -disable_warnings; -DROP TABLE IF EXISTS t1, t2; -DROP PROCEDURE IF EXISTS p1; -DROP PROCEDURE IF EXISTS p2; -DROP FUNCTION IF EXISTS f1; -DROP TRIGGER IF EXISTS tr1; -enable_warnings; - -stop slave sql_thread; -reset slave; -source include/wait_for_slave_sql_to_stop.inc; -remove_file $MYSQLD_DATADIR/slave-relay-bin.000001; -remove_file $MYSQLD_DATADIR/slave-relay-bin.index; - -SET @@global.relay_log_purge= @old_relay_log_purge; diff --git a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_binlog_auto_inc_bug33029.result similarity index 61% rename from mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result rename to mysql-test/suite/rpl/r/rpl_binlog_auto_inc_bug33029.result index 8226469fcf7..f0fdd5eaa1f 100644 --- a/mysql-test/suite/binlog/r/binlog_auto_increment_bug33029.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_auto_inc_bug33029.result @@ -1,8 +1,4 @@ -SET @old_relay_log_purge= @@global.relay_log_purge; -change master to -MASTER_HOST='dummy.localdomain', -RELAY_LOG_FILE='slave-relay-bin.000001', -RELAY_LOG_POS=4; +Setting up fake replication from MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001 start slave sql_thread; select MASTER_POS_WAIT('master-bin.000001', 3776); # Result on slave @@ -38,5 +34,4 @@ DROP PROCEDURE IF EXISTS p2; DROP FUNCTION IF EXISTS f1; DROP TRIGGER IF EXISTS tr1; stop slave sql_thread; -reset slave; -SET @@global.relay_log_purge= @old_relay_log_purge; +Cleaning up after setup_fake_relay_log.inc diff --git a/mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt b/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029-master.opt similarity index 100% rename from mysql-test/suite/binlog/t/binlog_auto_increment_bug33029-master.opt rename to mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029-master.opt diff --git a/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test b/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test new file mode 100644 index 00000000000..dbdd96347a2 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_binlog_auto_inc_bug33029.test @@ -0,0 +1,42 @@ +# BUG#33029 5.0 to 5.1 replication fails on dup key when inserting +# using a trig in SP + +# For all 5.0 up to 5.0.58 exclusive, and 5.1 up to 5.1.12 exclusive, +# if one statement in a SP generated AUTO_INCREMENT value by the top +# statement, all statements after it would be considered generated +# AUTO_INCREMENT value by the top statement, and a erroneous INSERT_ID +# value might be associated with these statement, which could cause +# duplicate entry error and stop the slave. + +# Test if the slave can replicate from such a buggy master + +# The bug33029-slave-relay-bin.000001 file is the +# slave-replay-bin.000003 file generated by run the +# rpl_auto_increment_bug33029.test with clean up statements at the end +# of the test case removed on a buggy 5.0 server + +source include/have_log_bin.inc; + +let $fake_relay_log= $MYSQL_TEST_DIR/std_data/bug33029-slave-relay-bin.000001; +source include/setup_fake_relay_log.inc; + +start slave sql_thread; +disable_result_log; +select MASTER_POS_WAIT('master-bin.000001', 3776); +enable_result_log; + +echo # Result on slave; +SELECT * FROM t1; +SELECT * FROM t2; + +# clean up +disable_warnings; +DROP TABLE IF EXISTS t1, t2; +DROP PROCEDURE IF EXISTS p1; +DROP PROCEDURE IF EXISTS p2; +DROP FUNCTION IF EXISTS f1; +DROP TRIGGER IF EXISTS tr1; +enable_warnings; + +stop slave sql_thread; +source include/cleanup_fake_relay_log.inc; From de554de6677ea6a7476738ea0904112bc19b560f Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Wed, 17 Feb 2010 22:17:17 +0100 Subject: [PATCH 2/4] Bug#47017 rpl_timezone fails on PB-2 with mismatch error This is a post-fix cleanup to move rpl.rpl_timezone out of 'experimental' state. --- mysql-test/collections/default.experimental | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 4460262cfa8..fa9c3d75b7f 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -24,7 +24,6 @@ rpl.rpl_plugin_load* @solaris # Bug#47146 rpl.rpl_row_sp011* @solaris # Bug#47791 2010-01-31 alik Several test cases fail on Solaris with error Thread stack overrun rpl.rpl_slave_load_remove_tmpfile @windows # Bug#50474 2010-01-28 alik rpl_slave_load_remove_tmpfile failed on windows debug enabled binary rpl.rpl_sync* @windows # Bug#50473 2010-01-31 alik rpl_sync fails on windows debug enabled binaries -rpl.rpl_timezone* # Bug#47017 2009-10-27 alik rpl_timezone fails on PB-2 with mismatch error # Declare all NDB-tests in ndb and rpl_ndb test suites experimental. # Usually the test cases from ndb and rpl_ndb test suites are not run in PB, From e03e842371e842b2f316e1299e964cb4fe51eb67 Mon Sep 17 00:00:00 2001 From: Serge Kozlov Date: Fri, 19 Feb 2010 22:37:23 +0300 Subject: [PATCH 3/4] Bug#48308. Post-fix Removed --remove_file in cleanup procedure --- mysql-test/include/cleanup_fake_relay_log.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/mysql-test/include/cleanup_fake_relay_log.inc b/mysql-test/include/cleanup_fake_relay_log.inc index 000c80f3761..269cd04ca34 100644 --- a/mysql-test/include/cleanup_fake_relay_log.inc +++ b/mysql-test/include/cleanup_fake_relay_log.inc @@ -8,9 +8,6 @@ --echo Cleaning up after setup_fake_relay_log.inc -# Remove files. -remove_file $_fake_relay_log; -remove_file $_fake_relay_index; --disable_query_log --disable_warnings STOP SLAVE SQL_THREAD; From e210d409d92658c73fcc9eae50ba0c87d360f19e Mon Sep 17 00:00:00 2001 From: Luis Soares Date: Mon, 22 Feb 2010 00:26:29 +0000 Subject: [PATCH 4/4] Post-push fix for BUG#50364. There was an erroneous parameter when calling flush_master_info from write_ignored_events_info_to_relay_log which could lead to a server crash. This happens because the I/O thread releases the log_lock before calling the flush_master_info. Set the function to call flush_master_info with third parameter to true, so that the mutex is properly taken. --- sql/slave.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/slave.cc b/sql/slave.cc index 3678c2497de..f88a961815f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1726,7 +1726,7 @@ static void write_ignored_events_info_to_relay_log(THD *thd, Master_info *mi) " to the relay log, SHOW SLAVE STATUS may be" " inaccurate"); rli->relay_log.harvest_bytes_written(&rli->log_space_total); - if (flush_master_info(mi, TRUE, FALSE)) + if (flush_master_info(mi, TRUE, TRUE)) sql_print_error("Failed to flush master info file"); delete ev; }