MINI MINI MANI MO
#
# ==== 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 slave when binlog is enabled and log_slave_updates is diabled.
#
--source include/not_group_replication_plugin.inc
--source include/have_gtid.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $rpl_gtid_utils= 1
--source include/master-slave.inc
--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
CREATE TABLE IF NOT EXISTS t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
--echo #
--echo # Verify that transactions' gtids can be reported
--echo # from global.gtid_executed correctly.
--echo #
--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 #
FLUSH LOGS;
--replace_result $master_uuid MASTER_UUID
SELECT * FROM mysql.gtid_executed;
--source include/sync_slave_sql_with_master.inc
--echo #
--echo # connection slave
--echo #
--let $slave_uuid= `SELECT @@GLOBAL.SERVER_UUID`
--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 # Verify that slave thread stores gtid into gtid_executed table within
--echo # each transaction if binlog is on and log_slave_updated is disabled.
--echo #
--replace_result $master_uuid MASTER_UUID
SELECT * FROM mysql.gtid_executed;
INSERT INTO t1 VALUES(2);
INSERT INTO t2 VALUES(2);
--echo #
--echo # Verify that store gtids SLAVE_UUID:1-2 into gtid_executed table,
--echo # which is also compressed on binlog rotation.
--echo #
SET @old_compression_period= @@GLOBAL.GTID_EXECUTED_COMPRESSION_PERIOD;
SET @@GLOBAL.GTID_EXECUTED_COMPRESSION_PERIOD= 1;
FLUSH LOGS;
SET @@GLOBAL.GTID_EXECUTED_COMPRESSION_PERIOD= @old_compression_period;
--let $table= mysql.gtid_executed
--let $count= 2
--source include/wait_until_rows_count.inc
--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"
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--echo #
--echo # Verify that we can get the correct set of gtid_purged when purging
--echo # logs if binlog is enabled and log_slave_updates is disabled.
--echo #
--eval PURGE BINARY LOGS TO '$binlog_file'
--let $assert_text= purged gtids SLAVE_UUID:1-2,MASTER_UUID:1-4
--let $assert_cond= GTID_IS_EQUAL("[SELECT @@GLOBAL.GTID_PURGED]", "$slave_uuid:1-2,$master_uuid:1-4")
--source include/assert.inc
--echo #
--echo # Verify that we can get the correct set from 'gtid_executed' table
--echo # when executing a big transaction that exceeds the max size of the
--echo # binlog if binlog is enabled and log_slave_updates is disabled.
--echo #
SET @SIZE_DEFAULT=@@MAX_BINLOG_SIZE;
SET GLOBAL MAX_BINLOG_SIZE=4096;
SET @@GLOBAL.DEBUG= '+d, dont_compress_gtid_table';
--let $i= 1
BEGIN;
while ($i < 60) {
--eval INSERT INTO t1 VALUES ($i);
--inc $i
}
COMMIT;
SET GLOBAL DEBUG= @debug_save;
SET GLOBAL MAX_BINLOG_SIZE=@SIZE_DEFAULT;
--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
OHA YOOOO