MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Luis Soares Date:June 22 2010 2:04pm
Subject:bzr commit into mysql-trunk-bugfixing branch (luis.soares:3096)
Bug#37666
View as plain text  
#At file:///home/lsoares/Workspace/bzr/work/reviews/b37666/mysql-trunk-bugfixing/ based on revid:alik@stripped

 3096 Luis Soares	2010-06-22
      BUG#37666: Event set to DISABLED and ON COMPLETION NOT PRESERVE is 
      deleted at server start
      
      Some test cases showing how replication and server restarts behaves
      for SLAVESIDE_DISABLED events:
      
        1. There is no implicit drop event when master restarts.
        2. Slave drops SLAVESIDE_DISABLED events if these are set with
           ON_COMPLETION=DROP
        3. Slave preserves SLAVESIDE_DISABLED events if these are set 
           with ON_COMPLETION=PRESERVE

    added:
      mysql-test/suite/rpl/r/rpl_events_dropped.result
      mysql-test/suite/rpl/t/rpl_events_dropped.test
    modified:
      mysql-test/include/restart_mysqld.inc
=== modified file 'mysql-test/include/restart_mysqld.inc'
--- a/mysql-test/include/restart_mysqld.inc	2008-12-25 09:53:24 +0000
+++ b/mysql-test/include/restart_mysqld.inc	2010-06-22 14:04:53 +0000
@@ -1,7 +1,12 @@
 
+if (`SELECT '$shutdown_server_id' = ''`)
+{
+  let $shutdown_server_id= 1;
+}
+
 # Write file to make mysql-test-run.pl expect the "crash", but don't start
 # it until it's told to
---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.$shutdown_server_id.expect
 wait
 EOF
 
@@ -10,7 +15,7 @@ EOF
 shutdown_server 10;
 
 # Write file to make mysql-test-run.pl start up the server again
---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.$shutdown_server_id.expect
 restart
 EOF
 

=== added file 'mysql-test/suite/rpl/r/rpl_events_dropped.result'
--- a/mysql-test/suite/rpl/r/rpl_events_dropped.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_events_dropped.result	2010-06-22 14:04:53 +0000
@@ -0,0 +1,109 @@
+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;
+################################################################
+## CASE #1: NO implicit drop in the binary log on master restart
+################################################################
+#### ON MASTER ####
+CREATE TABLE t1 (a int, b varchar(100));
+CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
+INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
+### BEFORE RESTART
+SELECT name, body, on_completion, status FROM mysql.event;;
+name	justonce
+body	INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce')
+on_completion	DROP
+status	ENABLED
+### AFTER RESTART
+SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED';
+show binlog events in 'master-bin.000001' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int, b varchar(100))
+master-bin.000001	#	Query	#	#	use `test`; CREATE DEFINER=`root`@`localhost` EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
+INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce')
+master-bin.000001	#	Stop	#	#	
+show binlog events in 'master-bin.000002' from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+### MASTER CLEAN UP
+DROP TABLE t1;
+DROP EVENT test.justonce;
+#################################################################################
+## CASE #2: SLAVE DROPS SLAVESIDE_DISABLED EVENTS ON RESTART (ON COMPLETION DROP)
+#################################################################################
+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;
+#### ON MASTER ####
+CREATE TABLE t1 (a int, b varchar(100));
+CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
+INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
+SELECT name, body, on_completion, status FROM mysql.event;;
+name	justonce
+body	INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce')
+on_completion	DROP
+status	ENABLED
+#### ON SLAVE ####
+### SHOWING THE EVENT BEFORE RESTARTING THE SERVER ###
+SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED';
+name	justonce
+body	INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce')
+on_completion	DROP
+status	SLAVESIDE_DISABLED
+include/stop_slave.inc
+### WHERE DID THE EVENT GO? ###
+SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED';
+include/start_slave.inc
+### STILL NO EVENT! ###
+SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED';
+DROP TABLE t1;
+include/stop_slave.inc
+DROP EVENT test.justonce;
+include/start_slave.inc
+#############################################################################################
+## CASE #3: SLAVE DOES NOT DROP SLAVESIDE_DISABLED EVENTS ON RESTART (ON COMPLETION PRESERVE)
+#############################################################################################
+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;
+#### ON MASTER ####
+CREATE TABLE t1 (a int, b varchar(100));
+CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
+INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
+ALTER EVENT test.justonce ON COMPLETION PRESERVE DISABLE ON SLAVE;
+SELECT name, body, on_completion, status FROM mysql.event;;
+name	justonce
+body	INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce')
+on_completion	PRESERVE
+status	SLAVESIDE_DISABLED
+#### ON SLAVE ####
+### SHOWING THE EVENT BEFORE RESTARTING THE SERVER ###
+SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED';
+name	justonce
+body	INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce')
+on_completion	PRESERVE
+status	SLAVESIDE_DISABLED
+include/stop_slave.inc
+### AHA, THE EVENT WAS PRESERVED
+SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED';
+name	justonce
+body	INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce')
+on_completion	PRESERVE
+status	SLAVESIDE_DISABLED
+include/start_slave.inc
+### YEP, STILL THERE
+SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED';
+name	justonce
+body	INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce')
+on_completion	PRESERVE
+status	SLAVESIDE_DISABLED
+DROP TABLE t1;
+DROP EVENT test.justonce;

=== added file 'mysql-test/suite/rpl/t/rpl_events_dropped.test'
--- a/mysql-test/suite/rpl/t/rpl_events_dropped.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_events_dropped.test	2010-06-22 14:04:53 +0000
@@ -0,0 +1,126 @@
+-- source include/master-slave.inc
+-- source include/have_binlog_format_statement.inc
+
+--echo ################################################################
+--echo ## CASE #1: NO implicit drop in the binary log on master restart
+--echo ################################################################
+
+-- echo #### ON MASTER ####
+
+CREATE TABLE t1 (a int, b varchar(100));
+
+CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
+ INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
+
+-- echo ### BEFORE RESTART
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event;
+
+-- source include/restart_mysqld.inc
+
+-- echo ### AFTER RESTART
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED'
+
+-- let $binary_log_file= master-bin.000001
+-- source include/show_binlog_events.inc
+
+-- let $binary_log_file= master-bin.000002
+-- source include/show_binlog_events.inc
+
+-- let $binary_log_file=
+
+-- echo ### MASTER CLEAN UP
+
+DROP TABLE t1;
+DROP EVENT test.justonce;
+
+-- sync_slave_with_master
+
+--echo #################################################################################
+--echo ## CASE #2: SLAVE DROPS SLAVESIDE_DISABLED EVENTS ON RESTART (ON COMPLETION DROP)
+--echo #################################################################################
+
+-- connection master
+-- source include/master-slave-reset.inc
+-- connection master
+
+-- echo #### ON MASTER ####
+
+CREATE TABLE t1 (a int, b varchar(100));
+
+CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
+ INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
+
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event;
+
+-- sync_slave_with_master
+
+-- echo #### ON SLAVE ####
+
+-- echo ### SHOWING THE EVENT BEFORE RESTARTING THE SERVER ###
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED'
+
+-- source include/stop_slave.inc
+
+-- let $shutdown_server_id= `SELECT @@server_id;`
+-- source include/restart_mysqld.inc
+
+-- echo ### WHERE DID THE EVENT GO? ###
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED'
+
+-- source include/start_slave.inc
+
+-- echo ### STILL NO EVENT! ###
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED'
+
+-- connection master
+DROP TABLE t1;
+-- sync_slave_with_master
+-- source include/stop_slave.inc
+-- connection master
+DROP EVENT test.justonce;
+-- connection slave
+-- source include/start_slave.inc
+
+--echo #############################################################################################
+--echo ## CASE #3: SLAVE DOES NOT DROP SLAVESIDE_DISABLED EVENTS ON RESTART (ON COMPLETION PRESERVE)
+--echo #############################################################################################
+
+-- connection master
+-- source include/master-slave-reset.inc
+-- connection master
+
+-- echo #### ON MASTER ####
+
+CREATE TABLE t1 (a int, b varchar(100));
+
+CREATE EVENT test.justonce ON SCHEDULE EVERY 2 SECOND DO
+ INSERT IGNORE INTO t1 (id, c) VALUES (2, 'from justonce');
+
+ALTER EVENT test.justonce ON COMPLETION PRESERVE DISABLE ON SLAVE;
+
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event;
+
+-- sync_slave_with_master
+
+-- echo #### ON SLAVE ####
+
+-- echo ### SHOWING THE EVENT BEFORE RESTARTING THE SERVER ###
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED'
+
+-- source include/stop_slave.inc
+
+-- let $shutdown_server_id= `SELECT @@server_id;`
+-- source include/restart_mysqld.inc
+
+-- echo ### AHA, THE EVENT WAS PRESERVED
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED'
+
+-- source include/start_slave.inc
+
+-- echo ### YEP, STILL THERE
+-- query_vertical SELECT name, body, on_completion, status FROM mysql.event WHERE STATUS = 'SLAVESIDE_DISABLED'
+
+-- connection master
+DROP TABLE t1;
+DROP EVENT test.justonce;
+-- sync_slave_with_master


Attachment: [text/bzr-bundle] bzr/luis.soares@sun.com-20100622140453-yn3hjclamt5w5p4m.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (luis.soares:3096)Bug#37666Luis Soares22 Jun