126 lines
4.0 KiB
Plaintext
126 lines
4.0 KiB
Plaintext
# WL#6591 Restore backup on existing GTID-aware server - make
|
|
# GTID_PURGED settable always
|
|
#
|
|
# The tests demonstrate GTID_PURGED is indeed settable
|
|
# through mysqldump restore despite GTID_EXECUTED is not empty.
|
|
# Specifically a backup could be restored at any point in run time
|
|
# provided that its gtid description satisfy constraints specified by the WL.
|
|
# Namely,
|
|
# In the append syntax case of
|
|
# SET GTID_PURGED = "+<gtid_set>"
|
|
# which is generated by mysqldump the assigned value must be disjoint with
|
|
# the current values of @@GLOBAL.GTID_EXECUTED and @@GLOBAL.GTID_OWNED.
|
|
#
|
|
# The result of the assignment operator and the function work shall be:
|
|
# - GTID_PURGED becomes the union of GTID_PURGED and <gtid_set>.
|
|
# - GTID_EXECUTED becomes the union of GTID_EXECUTED and <gtid_set>.
|
|
#
|
|
# NOTE that the test needs the master side opt file to require the master server
|
|
# restart to ensure no, even zombie, dump thread crawls into its
|
|
# execution environment from a previous test.
|
|
# That would prevent a successful PURGE.
|
|
|
|
--source include/not_group_replication_plugin.inc
|
|
--let $rpl_skip_start_slave= 1
|
|
--source include/master-slave.inc
|
|
|
|
# The following steps are performed below.
|
|
#
|
|
# 1. On master, create backup which will have SET @@GTID_PURGED
|
|
# (the gtid signature).
|
|
# 2. On the slave server, restore it.
|
|
# 3. On the slave server, configure auto-position=on connection to the master
|
|
# and successfully start replication.
|
|
#
|
|
# Step 1 verifies
|
|
# the increment syntax of GTID_PURGED assignment. Such way
|
|
# composed assignment must be always accepted on a slave; and
|
|
# Step 2 is supposed to prove GTID_PURGED settability in spite of non-empty
|
|
# GTID_EXECUTED.
|
|
# Step 3 is to prove dump restore is compable with auto-position replication.
|
|
#
|
|
|
|
# The slave is clean
|
|
--source include/rpl_connection_slave.inc
|
|
--source include/gtid_utils.inc
|
|
--let $rpl_only_running_threads= 1
|
|
--let $rpl_no_start_slave=1
|
|
--source include/rpl_reset.inc
|
|
|
|
# Step 1, dump
|
|
|
|
--source include/rpl_connection_master.inc
|
|
RESET MASTER;
|
|
|
|
# Dump's data
|
|
CREATE DATABASE db;
|
|
CREATE TABLE db.t (a INT);
|
|
INSERT INTO db.t SET a=1;
|
|
FLUSH LOGS;
|
|
--let $new_log=query_get_value(SHOW MASTER STATUS, File, 1)
|
|
--eval PURGE BINARY LOGS TO '$new_log'
|
|
# Purge may be ineffective, make sure that's not the case with the following show:
|
|
SHOW WARNINGS;
|
|
|
|
--exec $MYSQL_DUMP --compact --set-gtid-purged=auto --databases db > $MYSQL_TMP_DIR/wl6591_db_dump.sql
|
|
|
|
# Step 2, restore.
|
|
|
|
--source include/rpl_connection_slave.inc
|
|
|
|
# Make the slave to execute some gtids
|
|
SET @@GTID_NEXT='11111111-1111-1111-1111-111111111111:1';
|
|
BEGIN;
|
|
COMMIT;
|
|
SET @@GTID_NEXT=AUTOMATIC;
|
|
|
|
--exec $MYSQL_SLAVE --force < $MYSQL_TMP_DIR/wl6591_db_dump.sql
|
|
--remove_file $MYSQL_TMP_DIR/wl6591_db_dump.sql
|
|
|
|
# Step 3, replication part.
|
|
|
|
--source include/rpl_connection_slave.inc
|
|
CHANGE MASTER TO MASTER_AUTO_POSITION= 1;
|
|
--source include/start_slave.inc
|
|
|
|
--source include/rpl_connection_master.inc
|
|
DROP DATABASE db;
|
|
|
|
--source include/sync_slave_sql_with_master.inc
|
|
|
|
# Conclusion:
|
|
# Executed and Purged on the master and the slave are equal
|
|
|
|
--source include/rpl_connection_master.inc
|
|
|
|
# Sync with the slave that earlier executed this following trx:
|
|
SET @@GTID_NEXT='11111111-1111-1111-1111-111111111111:1';
|
|
BEGIN;
|
|
COMMIT;
|
|
SET @@GTID_NEXT=AUTOMATIC;
|
|
|
|
--source include/sync_slave_sql_with_master.inc
|
|
|
|
--source include/rpl_connection_master.inc
|
|
|
|
--let $master_gtid_purged=`SELECT @@GLOBAL.gtid_purged`
|
|
--let $master_gtid_executed=`SELECT @@GLOBAL.gtid_executed`
|
|
|
|
--source include/rpl_connection_slave.inc
|
|
|
|
--let $is_equal= `SELECT GTID_IS_EQUAL('$master_gtid_purged', @@GLOBAL.gtid_purged)`
|
|
--let $assert_text= The slave's GTID_PURGED must be equal to the master's one
|
|
--let $assert_cond= $is_equal
|
|
--source include/assert.inc
|
|
|
|
--let $is_equal= `SELECT GTID_IS_EQUAL('$master_gtid_executed', @@GLOBAL.gtid_executed)`
|
|
--let $assert_text= The slave's GTID_EXECUTED must be equal to the master's one
|
|
--let $assert_cond= $is_equal
|
|
--source include/assert.inc
|
|
|
|
--source include/gtid_utils_end.inc
|
|
|
|
# Cleanup: is already done
|
|
|
|
--source include/rpl_end.inc
|