| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Verify that GTID_EXECUTED and GTID_PURGED are correctly restored by |
| 4 |
# mysqlpump, even after a restart. |
| 5 |
# |
| 6 |
# ==== Implementation ==== |
| 7 |
# |
| 8 |
# Execute some transactions in different binary logs, purge some of them. |
| 9 |
# Take a dump. Drop the table and RESET MASTER. Verify that |
| 10 |
# GTID_EXECUTED and GTID_PURGED after the dump equal GTID_EXECUTED before |
| 11 |
# the dump. Restart server. Repeat the check. |
| 12 |
# |
| 13 |
# ==== Bugs ==== |
| 14 |
# |
| 15 |
# BUG#24590891: RESTARTING A SLAVE AFTER SEEDING IT WITH A MYSQLDUMP LOSES IT'S POSITION |
| 16 |
|
| 17 |
# Agnostic to binlog_format. |
| 18 |
--source include/have_binlog_format_statement.inc |
| 19 |
|
| 20 |
--echo ==== Initialize ==== |
| 21 |
|
| 22 |
CREATE TABLE t1 (a INT); |
| 23 |
FLUSH LOGS; |
| 24 |
--let $current_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) |
| 25 |
--replace_result $current_binlog_file <CURRENT_BINLOG> |
| 26 |
eval PURGE BINARY LOGS TO '$current_binlog_file'; |
| 27 |
INSERT INTO t1 VALUES (1); |
| 28 |
FLUSH LOGS; |
| 29 |
INSERT INTO t1 VALUES (2); |
| 30 |
--let $gtid_executed= `SELECT @@GLOBAL.GTID_EXECUTED` |
| 31 |
|
| 32 |
--let $name= pump |
| 33 |
# Skip routines to workaround BUG#25292963 |
| 34 |
--let $program= $MYSQL_PUMP --add-drop-table --all-databases --include-routines=o |
| 35 |
|
| 36 |
--echo ==== $name and restore ==== |
| 37 |
|
| 38 |
--echo # $name |
| 39 |
# Apparently mysql.proc is not fully restored on the slave, so |
| 40 |
# unless we remove it from the dump, check-testcase will fail. |
| 41 |
--exec $PROGRAM >> $MYSQL_TMP_DIR/mysql$name.sql |
| 42 |
|
| 43 |
DROP TABLE t1; |
| 44 |
RESET MASTER; |
| 45 |
|
| 46 |
--echo # restore |
| 47 |
--exec $MYSQL < $MYSQL_TMP_DIR/mysql$name.sql |
| 48 |
|
| 49 |
--echo ==== Verify after restoring from $name ==== |
| 50 |
|
| 51 |
--let $assert_text= GTID_EXECUTED should equal master GTID_EXECUTED after $name restored |
| 52 |
--let $assert_cond= @@GLOBAL.GTID_EXECUTED = "$gtid_executed" |
| 53 |
--source include/assert.inc |
| 54 |
--let $assert_text= GTID_PURGED should equal master GTID_EXECUTED after $name restored |
| 55 |
--let $assert_cond= @@GLOBAL.GTID_PURGED = "$gtid_executed" |
| 56 |
--source include/assert.inc |
| 57 |
|
| 58 |
--source include/restart_mysqld.inc |
| 59 |
|
| 60 |
--let $assert_text= GTID_EXECUTED should equal master GTID_EXECUTED after server restarted |
| 61 |
--let $assert_cond= @@GLOBAL.GTID_EXECUTED = "$gtid_executed" |
| 62 |
--source include/assert.inc |
| 63 |
--let $assert_text= GTID_PURGED should equal master GTID_EXECUTED after server restarted |
| 64 |
--let $assert_cond= @@GLOBAL.GTID_PURGED = "$gtid_executed" |
| 65 |
--source include/assert.inc |
| 66 |
|
| 67 |
--echo ==== Clean up ==== |
| 68 |
|
| 69 |
DROP TABLE t1; |
| 70 |
--remove_file $MYSQL_TMP_DIR/mysql$name.sql |