diff options
author | Sujatha <sujatha.sivakumar@mariadb.com> | 2021-04-07 22:38:06 +0530 |
---|---|---|
committer | Sujatha <sujatha.sivakumar@mariadb.com> | 2021-04-07 22:38:06 +0530 |
commit | deab37475edb43d85c1fc802982a2cd8520f7975 (patch) | |
tree | b6d9f9f32455ea6867442649d2ecc0fe4095b23f | |
parent | ee53893834536e6dac77c2ec359fb62329153222 (diff) | |
download | mariadb-git-origin/bb-10.3-MDEV-21117.tar.gz |
MDEV-21117: refine the server binlog-based recovery for semisyncorigin/bb-10.3-MDEV-21117
Fixed test specific review comments.
14 files changed, 106 insertions, 220 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_truncate_active_log.result b/mysql-test/suite/binlog/r/binlog_truncate_active_log.result index b7cf6bc3d20..a22559bf7d6 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_active_log.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_active_log.result @@ -1,10 +1,9 @@ call mtr.add_suppression("Can.t init tc log"); call mtr.add_suppression("Aborting"); -connection default; RESET MASTER; -CREATE TABLE t ( f INT ) ENGINE=INNODB; -CREATE TABLE t2 ( f INT ) ENGINE=INNODB; -CREATE TABLE tm ( f INT ) ENGINE=Aria; +CREATE TABLE t (f INT) ENGINE=INNODB; +CREATE TABLE t2 (f INT) ENGINE=INNODB; +CREATE TABLE tm (f INT) ENGINE=Aria; # Case A. connect master1,localhost,root,,; connect master2,localhost,root,,; @@ -18,26 +17,26 @@ INSERT INTO t VALUES (20); connection master2; SET DEBUG_SYNC= "now WAIT_FOR master1_ready"; SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready"; -DELETE FROM t2 WHERE f = 666 /* no such record */; +DELETE FROM t2 WHERE f = 0 /* no such record */; connection master3; SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; Before the crash 0-1-7 -# Kill the server connection default; +# Kill the server +disconnect master1; +disconnect master2; +disconnect master3; FOUND # /Successfully truncated.*to remove transactions starting from GTID 0-1-6/ in mysqld.1.err SELECT @@global.gtid_binlog_pos as 'After the crash'; After the crash 0-1-5 "One row should be present in table 't'" -SELECT COUNT(*) as 'One' FROM t; -One -1 +SELECT * FROM t; +f +10 DELETE FROM t; -disconnect master1; -disconnect master2; -disconnect master3; # Case B. connect master1,localhost,root,,; connect master2,localhost,root,,; @@ -57,24 +56,24 @@ SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; Before the crash 0-1-10 -# Kill the server connection default; +# Kill the server +disconnect master1; +disconnect master2; +disconnect master3; FOUND # /Successfully truncated.*to remove transactions starting from GTID 0-1-10/ in mysqld.1.err SELECT @@global.gtid_binlog_pos as 'After the crash'; After the crash 0-1-9 "One row should be present in table 't'" -SELECT COUNT(*) as 'One' FROM t; -One -1 +SELECT * FROM t; +f +10 DELETE FROM t; -disconnect master1; -disconnect master2; -disconnect master3; CREATE PROCEDURE sp_blank_xa() BEGIN XA START 'blank'; -DELETE FROM t2 WHERE f = 666 /* no such record */; +DELETE FROM t2 WHERE f = 0 /* no such record */; XA END 'blank'; XA PREPARE 'blank'; END| @@ -98,20 +97,20 @@ SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; Before the crash 0-1-15 -# Kill the server connection default; -NOT FOUND /Successfully truncated.*to remove transactions starting from GTID 0-1-13/ in mysqld.1.err +# Kill the server +disconnect master1; +disconnect master2; +disconnect master3; +FOUND # /Successfully truncated.*to remove transactions starting from GTID 0-1-14/ in mysqld.1.err SELECT @@global.gtid_binlog_pos as 'After the crash'; After the crash 0-1-13 "One row should be present in table 't'" -SELECT COUNT(*) as 'One' FROM t; -One -1 +SELECT * FROM t; +f +10 DELETE FROM t; -disconnect master1; -disconnect master2; -disconnect master3; DROP PROCEDURE sp_blank_xa; # Cleanup DROP TABLE t,t2,tm; diff --git a/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result b/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result index 08cbd078664..60286231cd1 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_multi_engine.result @@ -31,8 +31,7 @@ master-bin.000001 # master-bin.000002 # master-bin.000003 # # restart the server with --rpl-semi-sync-slave-enabled=1 -# the server is crashed -# Kill the server +# the server is restarted connection default; # # *** Summary: 1 row should be present in both tables; binlog is truncated; number of binlogs at reconnect - 3: @@ -105,8 +104,7 @@ master-bin.000001 # master-bin.000002 # master-bin.000003 # # restart the server with --rpl-semi-sync-slave-enabled=1 --debug-dbug=d,binlog_truncate_partial_commit -# the server is crashed -# Kill the server +# the server is restarted connection default; # # *** Summary: 2 rows should be present in both tables; no binlog truncation; one extra binlog file compare with A; number of binlogs at reconnect - 4: @@ -194,5 +192,4 @@ DELETE FROM t2; disconnect con1; # DROP TABLE t1, t2; -SET @@global.max_binlog_size = VALUE_AT_START; # End of the tests diff --git a/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result b/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result index ba87ee9f847..8af3c0b2bc9 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_multi_log.result @@ -31,13 +31,15 @@ master-bin.000003 # SELECT @@global.gtid_binlog_state; @@global.gtid_binlog_state 0-1-6 -# Kill the server connection default; +# Kill the server +disconnect master1; +disconnect master2; FOUND # /truncated binlog file:.*master.*000002/ in mysqld.1.err "One record should be present in table" -SELECT count(*) FROM ti; -count(*) -1 +SELECT * FROM ti; +a b +1 I am gonna survive # The truncated gtid binlog state SELECT @@global.gtid_binlog_state; @@global.gtid_binlog_state @@ -46,6 +48,5 @@ SELECT @@global.gtid_binlog_pos; @@global.gtid_binlog_pos 0-1-4 # Cleanup -SET @@global.max_binlog_size = VALUE_AT_START; DROP TABLE ti; # End of the tests diff --git a/mysql-test/suite/binlog/r/binlog_truncate_multi_log_unsafe.result b/mysql-test/suite/binlog/r/binlog_truncate_multi_log_unsafe.result index 7ea13e2548c..03d3a954f72 100644 --- a/mysql-test/suite/binlog/r/binlog_truncate_multi_log_unsafe.result +++ b/mysql-test/suite/binlog/r/binlog_truncate_multi_log_unsafe.result @@ -30,14 +30,13 @@ SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master3_ready"; INSERT INTO tm VALUES (2); connection default; SET DEBUG_SYNC= "now WAIT_FOR master3_ready"; -# The gtid binlog state prior the crash must be restored at the end of the testSELECT @@global.gtid_binlog_state; +# The gtid binlog state prior the crash must be restored at the end of the test; SELECT @@global.gtid_binlog_state; @@global.gtid_binlog_state 0-1-9 # Kill the server # Failed restart as the semisync slave # Normal restart -connection default; FOUND # /Cannot trim the binary log to file/ in mysqld.1.err # Proof that the in-doubt transactions are recovered by the 2nd normal server restart SELECT COUNT(*) = 5 as 'True' FROM ti; @@ -54,6 +53,5 @@ SELECT @@GLOBAL.gtid_binlog_pos; @@GLOBAL.gtid_binlog_pos 0-1-9 # Cleanup -SET @@global.max_binlog_size = VALUE_AT_START; DROP TABLE ti, tm; End of test diff --git a/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc b/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc index b1ffaf18268..bbc464066fc 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc +++ b/mysql-test/suite/binlog/t/binlog_truncate_active_log.inc @@ -17,54 +17,39 @@ SET DEBUG_SYNC= "commit_before_get_LOCK_commit_ordered SIGNAL master1_ready WAIT SET DEBUG_SYNC= "now WAIT_FOR master1_ready"; if ($pre_q2) { - CALL sp_blank_xa; + eval $pre_q2; } SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready"; # To binlog non-xid transactional group which will be truncated all right --send_eval $query2 - --connection master3 SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; SELECT @@global.gtid_binlog_pos as 'Before the crash'; ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF - +--connection default --source include/kill_mysqld.inc ---source include/wait_until_disconnected.inc +--disconnect master1 +--disconnect master2 +--disconnect master3 + # # Server restart # ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart: --rpl-semi-sync-slave-enabled=1 -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc +--let $restart_parameters= --rpl-semi-sync-slave-enabled=1 +--source include/start_mysqld.inc # Check error log for a successful truncate message. -let $log_error_= `SELECT @@GLOBAL.log_error`; -if(!$log_error_) -{ - # MySQL Server on windows is started with --console and thus - # does not know the location of its .err log, use default location - let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err; -} +--let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err + --let SEARCH_FILE=$log_error_ ---let SEARCH_RANGE=-50000 ---let SEARCH_PATTERN=$this_search_pattern +--let SEARCH_PATTERN=Successfully truncated.*to remove transactions starting from GTID $truncate_gtid_pos --replace_regex /FOUND [0-9]+/FOUND #/ --source include/search_pattern_in_file.inc SELECT @@global.gtid_binlog_pos as 'After the crash'; --echo "One row should be present in table 't'" -SELECT COUNT(*) as 'One' FROM t; +SELECT * FROM t; # Local cleanup DELETE FROM t; ---disconnect master1 ---disconnect master2 ---disconnect master3 diff --git a/mysql-test/suite/binlog/t/binlog_truncate_active_log.test b/mysql-test/suite/binlog/t/binlog_truncate_active_log.test index cf89525dcac..2b794d02dd0 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_active_log.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_active_log.test @@ -2,24 +2,15 @@ # # Test verifies the truncation of single binary log file. # -# ==== Implementation ==== -# -# Steps: -# 0 - Create table t1 and insert/commit a row. -# 1 - Insert an another row such that it gets written to binlog but commit -# in engine fails as server crashed at this point. -# 2 - Restart server with --rpl-semi-sync-slave-enabled=1 -# 3 - Upon server start 'master-bin.000001' will be truncated to contain -# only the first insert -# # ==== References ==== # # MDEV-21117: recovery for --rpl-semi-sync-slave-enabled server --source include/have_innodb.inc --source include/have_aria.inc ---source include/have_log_bin.inc ---source include/have_debug.inc +# File: binlog_truncate_active_log.inc included in test makes use of +# 'debug_sync' facility. +--source include/have_debug_sync.inc --source include/have_binlog_format_statement.inc call mtr.add_suppression("Can.t init tc log"); @@ -30,22 +21,29 @@ call mtr.add_suppression("Aborting"); # B. 2pc transaction follows the blank one # C. Similarly to A, with the XA blank transaction ---connection default RESET MASTER; -CREATE TABLE t ( f INT ) ENGINE=INNODB; -CREATE TABLE t2 ( f INT ) ENGINE=INNODB; -CREATE TABLE tm ( f INT ) ENGINE=Aria; +CREATE TABLE t (f INT) ENGINE=INNODB; +CREATE TABLE t2 (f INT) ENGINE=INNODB; +CREATE TABLE tm (f INT) ENGINE=Aria; --echo # Case A. -# Both are doomed into truncation. ---let $this_search_pattern = Successfully truncated.*to remove transactions starting from GTID 0-1-6 +# Using 'debug_sync' hold 'query1' execution after 'query1' is flushed and +# synced to binary log but not yet committed. In an another connection hold +# 'query2' execution after 'query2' is flushed and synced to binlog. +# Crash and restart server with --rpl-semi-sync-slave-enabled=1 +# +# During recovery of binary log 'query1' status is checked with InnoDB engine, +# it will be in prepared but not yet commited. All transactions starting from +# 'query1' onwards will be removed from the binary log. + +--let $truncate_gtid_pos = 0-1-6 --let $query1 = INSERT INTO t VALUES (20) ---let $query2 = DELETE FROM t2 WHERE f = 666 /* no such record */ +--let $query2 = DELETE FROM t2 WHERE f = 0 /* no such record */ --source binlog_truncate_active_log.inc --echo # Case B. # The inverted sequence ends up to truncate only $query2 ---let $this_search_pattern = Successfully truncated.*to remove transactions starting from GTID 0-1-10 +--let $truncate_gtid_pos = 0-1-10 --let $query1 = DELETE FROM t2 WHERE f = 0 --let $query2 = INSERT INTO t VALUES (20) --source binlog_truncate_active_log.inc @@ -55,7 +53,7 @@ delimiter |; CREATE PROCEDURE sp_blank_xa() BEGIN XA START 'blank'; - DELETE FROM t2 WHERE f = 666 /* no such record */; + DELETE FROM t2 WHERE f = 0 /* no such record */; XA END 'blank'; XA PREPARE 'blank'; END| @@ -63,7 +61,7 @@ delimiter ;| --echo # Case C. ---let $this_search_pattern = Successfully truncated.*to remove transactions starting from GTID 0-1-13 +--let $truncate_gtid_pos = 0-1-14 --let $query1 = INSERT INTO t VALUES (20) --let $pre_q2 = CALL sp_blank_xa --let $query2 = XA COMMIT 'blank' diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc b/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc index c260a7987e2..41ae856dd9d 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc +++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc @@ -16,7 +16,6 @@ FLUSH LOGS; SET GLOBAL max_binlog_size= 4096; connect(con1,localhost,root,,); -#--connection con1 --echo List of binary logs before rotation --source include/show_binary_logs.inc INSERT INTO t1 VALUES (1, REPEAT("x", 1)); @@ -34,17 +33,8 @@ SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; --source include/show_binary_logs.inc --echo # restart the server with $restart_parameters -if ($kill_server) -{ - --echo # the server is crashed - --source include/kill_mysqld.inc - --source include/start_mysqld.inc -} -if (!$kill_server) -{ - --echo # the server is restarted - --source include/restart_mysqld.inc -} +--echo # the server is restarted +--source include/restart_mysqld.inc --connection default --echo # diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.test b/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.test index fe153e5703c..94837e3c3ea 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.test @@ -1,34 +1,14 @@ # ==== Purpose ==== # -# Test verifies truncation of multiple binary logs. -# -# ==== Implementation ==== -# -# Steps: -# 0 - Create two tables in innodb and rocksdb engines, -# -# In loop for A,B,C cases (below) do 1-5: -# 1 - execute FLUSH LOGS command to generate a new binary log. -# Start a transaction inserting rows of sufficient sizes -# so binary log gets rotated at commit -# 2 - Using debug simulation make the server crash at a point where -# the transaction is written to binary log *and* either of -# A. neither of them commits -# B. only one commits -# C. both commit -# 3 - print the # of binlog files before the transaction starts and after its -# commit is submitted -# 4 - Restart server with --tc-heuristic-recover=BINLOG_TRUNCATE -# 5 - Restart normally to print post recovery status. +# Test verifies truncation of multiple binary logs with multiple transactional +# storage engines # # ==== References ==== # # MDEV-21117: recovery for --rpl-semi-sync-slave-enabled server - --source include/have_innodb.inc --source include/have_rocksdb.inc ---source include/have_log_bin.inc --source include/have_debug.inc --source include/have_debug_sync.inc --source include/have_binlog_format_row.inc @@ -44,35 +24,33 @@ CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=rocksdb; --let $case = A: neither engine committed => rollback & binlog truncate # Hold off engine commits after write to binlog and its rotation. # The transaction is killed along with the server after that. ---let $kill_server=1 +--let $shutdown_timeout=0 --let $debug_sync_action = "commit_after_release_LOCK_log SIGNAL con1_ready WAIT_FOR signal_no_signal" --let $restart_parameters = --rpl-semi-sync-slave-enabled=1 --let $test_outcome= 1 row should be present in both tables; binlog is truncated; number of binlogs at reconnect - 3 - --source binlog_truncate_multi_engine.inc +--source binlog_truncate_multi_engine.inc --echo Proof of the truncated binlog file is readable (two transactions must be seen): ---let $MYSQLD_DATADIR = `select @@datadir` --exec $MYSQL_BINLOG --short-form --skip-annotate-row-events $MYSQLD_DATADIR/master-bin.000002 --let $case = B: one engine has committed its transaction branch # Hold off after one engine has committed. ---let $kill_server=1 +--let $shutdown_timeout=0 --let $debug_sync_action = "commit_after_run_commit_ordered SIGNAL con1_ready WAIT_FOR signal_no_signal" ---let $restart_simulate_partial_commit = 1 +# Both debug_sync and debug-dbug are required to make sure Engines remember the commit state +# debug_sync alone will not help. --let $restart_parameters = --rpl-semi-sync-slave-enabled=1 --debug-dbug=d,binlog_truncate_partial_commit --let $test_outcome= 2 rows should be present in both tables; no binlog truncation; one extra binlog file compare with A; number of binlogs at reconnect - 4 - --source binlog_truncate_multi_engine.inc +--source binlog_truncate_multi_engine.inc --let $case = C: both engines have committed its transaction branch # Hold off after both engines have committed. The server is shut down. ---let $kill_server=0 +--let $shutdown_timeout= --let $restart_parameters = --rpl-semi-sync-slave-enabled=1 --let $test_outcome= 2 rows should be present in both tables; no binlog truncation; the same # of binlog files as in B; number of binlogs at reconnect - 4 - --source binlog_truncate_multi_engine.inc +--source binlog_truncate_multi_engine.inc DROP TABLE t1, t2; ---replace_result $old_max_binlog_size VALUE_AT_START ---eval SET @@global.max_binlog_size = $old_max_binlog_size --echo # End of the tests diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test b/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test index 231e90dbdc9..3b557bc89b8 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_log.test @@ -2,29 +2,16 @@ # # Test verifies truncation of multiple binary logs. # -# ==== Implementation ==== -# -# Steps: -# 1 - Set max_binlog_size= 4096, to help a series of inserts into a -# transaction table 'ti' get binlog rotated so many time while the -# transactions won't be committed, being stopped at -# a prior to commit debug_sync point -# 2 - kill and restart the server as semisync slave successfully to -# end with an expected first binlog and the gtid state. -# # ==== References ==== # MDEV-21117: recovery for --rpl-semi-sync-slave-enabled server --source include/have_innodb.inc ---source include/have_log_bin.inc ---source include/have_debug.inc --source include/have_debug_sync.inc --source include/have_binlog_format_row.inc call mtr.add_suppression("Can.t init tc log"); call mtr.add_suppression("Aborting"); ---let $old_max_binlog_size= `select @@global.max_binlog_size` SET @@global.max_binlog_size= 4096; RESET MASTER; @@ -57,49 +44,35 @@ SET DEBUG_SYNC= "now WAIT_FOR master2_ready"; --source include/show_binary_logs.inc --echo # The gtid binlog state prior the crash will be truncated at the end of the test SELECT @@global.gtid_binlog_state; ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF +--connection default --source include/kill_mysqld.inc ---source include/wait_until_disconnected.inc +--disconnect master1 +--disconnect master2 # # Server restart # ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart: --rpl-semi-sync-slave-enabled=1 -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc +--let $restart_parameters= --rpl-semi-sync-slave-enabled=1 +--source include/start_mysqld.inc # Check error log for a successful truncate message. -let $log_error_= `SELECT @@GLOBAL.log_error`; -if(!$log_error_) -{ - # MySQL Server on windows is started with --console and thus - # does not know the location of its .err log, use default location - let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err; -} +let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err; + --let SEARCH_FILE=$log_error_ ---let SEARCH_RANGE=-50000 --let SEARCH_PATTERN=truncated binlog file:.*master.*000002 --replace_regex /FOUND [0-9]+/FOUND #/ --source include/search_pattern_in_file.inc --echo "One record should be present in table" -SELECT count(*) FROM ti; +SELECT * FROM ti; --echo # The truncated gtid binlog state SELECT @@global.gtid_binlog_state; SELECT @@global.gtid_binlog_pos; --echo # Cleanup ---replace_result $old_max_binlog_size VALUE_AT_START ---eval SET @@global.max_binlog_size = $old_max_binlog_size DROP TABLE ti; --echo # End of the tests diff --git a/mysql-test/suite/binlog/t/binlog_truncate_multi_log_unsafe.test b/mysql-test/suite/binlog/t/binlog_truncate_multi_log_unsafe.test index 6aba2935fde..38a9c0832f4 100644 --- a/mysql-test/suite/binlog/t/binlog_truncate_multi_log_unsafe.test +++ b/mysql-test/suite/binlog/t/binlog_truncate_multi_log_unsafe.test @@ -21,16 +21,14 @@ # commits the transaction in doubt. # # ==== References ==== +# # MDEV-21117: recovery for --rpl-semi-sync-slave-enabled server - +# --source include/have_innodb.inc ---source include/have_log_bin.inc ---source include/have_debug.inc --source include/have_debug_sync.inc --source include/have_binlog_format_row.inc ---let $old_max_binlog_size= `select @@global.max_binlog_size` SET @@global.max_binlog_size= 4096; call mtr.add_suppression("Table '.*tm' is marked as crashed and should be repaired"); @@ -51,12 +49,12 @@ CREATE TABLE ti (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; CREATE TABLE tm (f INT) ENGINE=MYISAM; --let $row_count = 5 ---let $i = 3 +--let $i = `select $row_count-2` --disable_query_log while ($i) { --eval INSERT INTO ti VALUES ($i, REPEAT("x", 1)) ---dec $i + --dec $i } --enable_query_log INSERT INTO tm VALUES(1); @@ -84,15 +82,9 @@ SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master3_ready"; --connection default SET DEBUG_SYNC= "now WAIT_FOR master3_ready"; ---echo # The gtid binlog state prior the crash must be restored at the end of the testSELECT @@global.gtid_binlog_state; - ---write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -wait -EOF - +--echo # The gtid binlog state prior the crash must be restored at the end of the test; SELECT @@global.gtid_binlog_state; --source include/kill_mysqld.inc ---source include/wait_until_disconnected.inc # # Server restarts @@ -102,24 +94,12 @@ SELECT @@global.gtid_binlog_state; --exec $MYSQLD_LAST_CMD --rpl-semi-sync-slave-enabled=1 >> $MYSQLTEST_VARDIR/log/mysqld.1.err 2>&1 --echo # Normal restart ---append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -restart: -EOF - -connection default; ---enable_reconnect ---source include/wait_until_connected_again.inc +--source include/start_mysqld.inc # Check error log for correct messages. -let $log_error_= `SELECT @@GLOBAL.log_error`; -if(!$log_error_) -{ - # MySQL Server on windows is started with --console and thus - # does not know the location of its .err log, use default location - let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err; -} +let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err; + --let SEARCH_FILE=$log_error_ ---let SEARCH_RANGE=-50000 --let SEARCH_PATTERN=Cannot trim the binary log to file --replace_regex /FOUND [0-9]+/FOUND #/ --source include/search_pattern_in_file.inc @@ -136,7 +116,5 @@ SELECT @@GLOBAL.gtid_binlog_state; SELECT @@GLOBAL.gtid_binlog_pos; --echo # Cleanup ---replace_result $old_max_binlog_size VALUE_AT_START ---eval SET @@global.max_binlog_size = $old_max_binlog_size DROP TABLE ti, tm; --echo End of test diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result index 8107c8cb454..aebf4f1c32f 100644 --- a/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result +++ b/mysql-test/suite/rpl/r/rpl_semi_sync_fail_over.result @@ -3,8 +3,10 @@ connection server_2; include/stop_slave.inc connection server_1; RESET MASTER; +SET @@global.max_binlog_size= 4096; connection server_2; RESET MASTER; +SET @@global.max_binlog_size= 4096; set @@global.rpl_semi_sync_slave_enabled = 1; set @@global.gtid_slave_pos = ""; CHANGE MASTER TO master_use_gtid= slave_pos; @@ -37,7 +39,7 @@ connection server_2; set global rpl_semi_sync_master_enabled = 1; set global rpl_semi_sync_master_wait_point=AFTER_SYNC; connection server_1; -CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_2, master_user='root', master_use_gtid=SLAVE_POS; +CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_user='root', master_use_gtid=SLAVE_POS; set global rpl_semi_sync_slave_enabled = 1; set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; include/start_slave.inc @@ -81,7 +83,7 @@ connection server_1; set global rpl_semi_sync_master_enabled = 1; set global rpl_semi_sync_master_wait_point=AFTER_SYNC; connection server_2; -CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_use_gtid=SLAVE_POS; +CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_user='root', master_use_gtid=SLAVE_POS; set global rpl_semi_sync_slave_enabled = 1; set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; include/start_slave.inc @@ -118,7 +120,7 @@ connection server_2; set @@global.rpl_semi_sync_master_enabled = 0; set @@global.rpl_semi_sync_slave_enabled = 0; set @@global.rpl_semi_sync_master_wait_point=default; -CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_use_gtid=no; +CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=no; include/start_slave.inc connection default; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc b/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc index 4289df9155f..fead293f15e 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_crash.inc @@ -36,14 +36,12 @@ if (!$failover_to_slave) --connection server_$server_to_crash SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; --source include/kill_mysqld.inc ---source include/wait_until_disconnected.inc --connection server_$server_to_promote --error 2003 --source include/stop_slave.inc SELECT @@GLOBAL.gtid_current_pos; ---let $_expect_file_name=$MYSQLTEST_VARDIR/tmp/mysqld.$server_to_crash.expect --let $restart_parameters=--rpl-semi-sync-slave-enabled=1 --let $allow_rpl_inited=1 --source include/start_mysqld.inc @@ -53,15 +51,8 @@ SELECT @@GLOBAL.gtid_current_pos; --source include/wait_until_connected_again.inc # Check error log for correct messages. -let $log_error_= `SELECT @@GLOBAL.log_error`; -if(!$log_error_) -{ - # MySQL Server on windows is started with --console and thus - # does not know the location of its .err log, use default location - let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.$server_to_crash.err; -} +let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.$server_to_crash.err; --let SEARCH_FILE=$log_error_ ---let SEARCH_RANGE=-50000 --let SEARCH_PATTERN=$log_search_pattern --source include/search_pattern_in_file.inc @@ -80,8 +71,7 @@ if (`select $server_to_crash = 2`) { --let $master_port=$SERVER_MYPORT_1 } ---replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 $SERVER_MYPORT_2 SERVER_MYPORT_2 -eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_user='root', master_use_gtid=SLAVE_POS; +evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$new_master_port, master_user='root', master_use_gtid=SLAVE_POS; set global rpl_semi_sync_slave_enabled = 1; set @@global.gtid_slave_pos=@@global.gtid_binlog_pos; --source include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.cnf b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.cnf index 3518eb95b67..f8312bdc5b8 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.cnf +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.cnf @@ -5,9 +5,7 @@ [mysqld.1] log-slave-updates gtid-strict-mode=1 -max_binlog_size= 4096 [mysqld.2] log-slave-updates gtid-strict-mode=1 -max_binlog_size= 4096 diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test index 972aaf2c8b4..a8b40d6ed05 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_fail_over.test @@ -22,8 +22,6 @@ --source include/have_innodb.inc ---source include/have_log_bin.inc ---source include/have_debug.inc --source include/have_debug_sync.inc --source include/have_binlog_format_row.inc --let $rpl_topology=1->2 @@ -34,9 +32,11 @@ --connection server_1 RESET MASTER; +SET @@global.max_binlog_size= 4096; --connection server_2 RESET MASTER; +SET @@global.max_binlog_size= 4096; set @@global.rpl_semi_sync_slave_enabled = 1; set @@global.gtid_slave_pos = ""; CHANGE MASTER TO master_use_gtid= slave_pos; @@ -133,8 +133,7 @@ set @@global.rpl_semi_sync_master_enabled = 0; set @@global.rpl_semi_sync_slave_enabled = 0; set @@global.rpl_semi_sync_master_wait_point=default; ---replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 -eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=no; +evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=no; --source include/start_slave.inc connection default; |