Current Path : /home/usr.opt/mysql57/mysql-test/suite/rpl/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/rpl/t/rpl_gtids_table.test |
# # ==== Purpose ==== # # WL#6559 Optimize GTIDs for passive slave - store GTIDs in table # # Verify that we can store gtids into gtid_executed table for transactions # on binlog rotation and report GLOBAL.GTID_EXECUTED and GLOBAL.GTID_PURGED # correctly on master and slave when binlog is enabled. # --source include/not_group_replication_plugin.inc --source include/have_gtid.inc --source include/have_debug.inc --source include/have_debug_sync.inc --source include/master-slave.inc SET @debug_save= @@GLOBAL.DEBUG; call mtr.add_suppression("test the suppression statement"); --let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID` SHOW CREATE TABLE mysql.gtid_executed; --echo # --echo # Verify that the specified gtid to GTID_NEXT can be reported from --echo # global.gtid_executed and is stored into gtid_executed table on --echo # following binlog rotation. --echo # --replace_result $master_uuid MASTER_UUID --eval SET GTID_NEXT='$master_uuid:3' BEGIN; COMMIT; --let $assert_text= committed gtids MASTER_UUID:1:3 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1:3" --source include/assert.inc --eval SET GTID_NEXT='AUTOMATIC' FLUSH LOGS; --echo # --echo # Store gtids MASTER_UUID:1:3 in gtid_executed table on binlog rotation --echo # --replace_result $master_uuid MASTER_UUID SELECT * FROM mysql.gtid_executed; --echo # --echo # Verify that these gtids can be reported from global.gtid_executed and --echo # are stored into gtid_executed table on next rotation for normal DDLs. --echo # CREATE TABLE IF NOT EXISTS t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT) ENGINE=MyISAM; --let $assert_text= committed gtids MASTER_UUID:1-4 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-4" --source include/assert.inc --echo # --echo # Store gtids MASTER_UUID:1-4 in gtid_executed table on binlog rotation --echo # SET @@GLOBAL.DEBUG= '+d,compress_gtid_table'; FLUSH LOGS; SET DEBUG_SYNC='now WAIT_FOR complete_compression'; --replace_result $master_uuid MASTER_UUID SELECT * FROM mysql.gtid_executed; --echo # --echo # Verify that these gtids can be reported from global.gtid_executed --echo # and are stored into gtid_executed table for compound statement with --echo # regular and temporary tables. --echo # CREATE TEMPORARY TABLE tmp1 (c1 INT) Engine=MyISAM; CREATE TABLE t3 (a INT); if (`SELECT @@BINLOG_FORMAT = 'ROW'`) { # We did not generate gtid for above 'CREATE TEMPORARY TABLE' statement # in row format, but we did in statement format. So let the 'INSERT' # statement generate the missed gtid in row format. --disable_query_log INSERT INTO t3 VALUES(1); --enable_query_log } --error ER_BAD_TABLE_ERROR DROP TEMPORARY TABLE tmp1, t3; DROP TABLE t3; --let $assert_text= committed gtids MASTER_UUID:1-8 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-8" --source include/assert.inc --echo # --echo # Store gtids MASTER_UUID:1-8 in gtid_executed table on binlog rotation --echo # SET @@GLOBAL.DEBUG= '+d,compress_gtid_table'; FLUSH LOGS; SET DEBUG_SYNC='now WAIT_FOR complete_compression'; --replace_result $master_uuid MASTER_UUID SELECT * FROM mysql.gtid_executed; --echo # --echo # Verify that transactions' gtids can be reported from --echo # global.gtid_executed correctly and are stored into --echo # gtid_executed table on next binlog rotation. --echo # BEGIN; INSERT INTO t2 VALUES(2); INSERT INTO t1 VALUES(1); INSERT INTO t1 VALUES(2); COMMIT; --echo # --echo # Verify that specified gtid for transaction can be reported from --echo # global.gtid_executed correctly and is stored into gtid_executed --echo # table on next binlog rotation. --echo # --replace_result $master_uuid MASTER_UUID --eval SET @@SESSION.GTID_NEXT= '$master_uuid:11' BEGIN; INSERT INTO t1 VALUES(3); COMMIT; --let $assert_text= committed gtids MASTER_UUID:1-11 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-11" --source include/assert.inc --eval SET GTID_NEXT='AUTOMATIC' SET @@GLOBAL.DEBUG= '+d,compress_gtid_table'; FLUSH LOGS; SET DEBUG_SYNC='now WAIT_FOR complete_compression'; --echo # --echo # Store gtids MASTER_UUID:1-11 in gtid_executed table on binlog rotation --echo # --replace_result $master_uuid MASTER_UUID SELECT * FROM mysql.gtid_executed; --echo # --echo # Verify that transaction's gtid can not be reported from --echo # global.gtid_executed and is not stored into gtid_executed table --echo # on next binlog rotation if the transaction is rollbacked. --echo # BEGIN; INSERT INTO t1 VALUES(4); ROLLBACK; --let $assert_text= committed gtids MASTER_UUID:1-11 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-11" --source include/assert.inc --echo # --echo # Store gtids MASTER_UUID:1-11 in gtid_executed table on binlog rotation --echo # FLUSH LOGS; --replace_result $master_uuid MASTER_UUID SELECT * FROM mysql.gtid_executed; SET GLOBAL DEBUG= @debug_save; --source include/sync_slave_sql_with_master.inc --echo # --echo # connection slave --echo # --let $slave_uuid= `SELECT @@GLOBAL.SERVER_UUID` --echo # --echo # Verify that the transaction is skiped if its specified gtid is --echo # already in global.gtid_executed, although not in gtid_executed table. --echo # --replace_result $master_uuid MASTER_UUID --eval SET @@SESSION.GTID_NEXT= '$master_uuid:6' INSERT INTO t1 VALUES(11); --let $assert_text= Table t1 must not contain 11 --let $assert_cond= "[SELECT a FROM t1 WHERE a=11]" = "" --source include/assert.inc --let $assert_text= committed gtids MASTER_UUID:1-11 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-11" --source include/assert.inc --echo # --echo # The gtid_executed table is empty on slave currently --echo # --replace_result $master_uuid MASTER_UUID SELECT * FROM mysql.gtid_executed; --echo # --echo # Store gtids MASTER_UUID:1-11 in gtid_executed table on binlog rotation --echo # --eval SET GTID_NEXT='AUTOMATIC' FLUSH LOGS; --replace_result $master_uuid MASTER_UUID SELECT * FROM mysql.gtid_executed; --echo # --echo # Verify that the specified gtid to GTID_NEXT is stored into --echo # global.gtid_executed immediately and stored into gtid_executed table --echo # on next binlog rotation. --echo # --replace_result $master_uuid MASTER_UUID --eval SET @@SESSION.GTID_NEXT= '$master_uuid:17' COMMIT; --let $assert_text= committed gtids MASTER_UUID:1-11:17 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-11:17" --source include/assert.inc --echo # --echo # Store gtids MASTER_UUID:1-11:17 in gtid_executed table --echo # on next binlog rotation. --echo # --eval SET GTID_NEXT='AUTOMATIC' FLUSH LOGS; --replace_result $master_uuid MASTER_UUID SELECT * FROM mysql.gtid_executed; --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) --echo # --echo # Verify that we can get the correct set of gtid_purged --echo # when purging logs. --echo # --eval PURGE BINARY LOGS TO '$binlog_file' --let $assert_text= purged gtids MASTER_UUID:1-11:17 --let $assert_cond= "[SELECT @@GLOBAL.GTID_PURGED]" = "$master_uuid:1-11:17" --source include/assert.inc --echo # --echo # Verify that transaction's gtid generated on slave is stored --echo # into gtid_executed table on next binlog rotation. --echo # BEGIN; INSERT INTO t1 VALUES(12); COMMIT; --echo # --echo # Store gtids MASTER_UUID:1-11:17 and SLAVE_UUID:1 --echo # in gtid_executed table on binlog rotation. --echo # FLUSH LOGS; --replace_result $master_uuid MASTER_UUID --eval SELECT * FROM mysql.gtid_executed where source_uuid="$master_uuid" --replace_result $slave_uuid SLAVE_UUID --eval SELECT * FROM mysql.gtid_executed where source_uuid="$slave_uuid" --connection master DROP TABLE t1, t2; --source include/rpl_end.inc