diff options
Diffstat (limited to 'mysql-test/suite/wsrep')
24 files changed, 371 insertions, 75 deletions
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def index 27f3f9287b6..276ed34f747 100644 --- a/mysql-test/suite/wsrep/disabled.def +++ b/mysql-test/suite/wsrep/disabled.def @@ -12,3 +12,5 @@ foreign_key : Sporadic failure "WSREP has not yet prepared node for application use" variables : MDEV-19746 Galera test failures because of wsrep_slave_threads identification +wsrep.pool_of_threads : Sporadic failure "WSREP has not yet prepared node for application use" +wsrep.variables : Global wsrep_on manipulation causes debug asserts diff --git a/mysql-test/suite/wsrep/my.cnf b/mysql-test/suite/wsrep/my.cnf index 7e51b0750a1..e90686850a9 100644 --- a/mysql-test/suite/wsrep/my.cnf +++ b/mysql-test/suite/wsrep/my.cnf @@ -1,10 +1,8 @@ # Use default setting for mysqld processes !include include/default_mysqld.cnf -[mysqld] -wsrep-on=1 - [mysqld.1] +wsrep-on=OFF #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port diff --git a/mysql-test/suite/wsrep/r/mdev_7798.result b/mysql-test/suite/wsrep/r/mdev_7798.result index 83a02f3a606..ec906ccd8a2 100644 --- a/mysql-test/suite/wsrep/r/mdev_7798.result +++ b/mysql-test/suite/wsrep/r/mdev_7798.result @@ -7,6 +7,7 @@ SELECT @@GLOBAL.WSREP_ON; 1 SET GLOBAL WSREP_ON= 0; Restart the node. +# restart SELECT @@GLOBAL.WSREP_ON; @@GLOBAL.WSREP_ON 1 diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff index 5bf6502d0d8..596abf9c681 100644 --- a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff +++ b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff @@ -1,17 +1,19 @@ ---- r/wsrep-recover-v25.result 2019-01-27 15:38:58.819204748 +0200 -+++ r/wsrep-recover-v25.reject 2019-01-27 15:39:49.967358994 +0200 -@@ -18,11 +18,10 @@ - connection default; - SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached"; - # Kill the server --Expect seqno 3 --3 --Expect 5 7 -+Expect seqno 2 -+2 +--- r/wsrep-recover-v25.result 2019-02-28 09:20:56.153775856 +0200 ++++ r/wsrep-recover-v25.reject 2019-02-28 09:22:16.578113115 +0200 +@@ -12,4 +12,16 @@ + SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; + expect 6 + 6 ++connect con1, localhost, root; ++SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue"; ++INSERT INTO t1 VALUES (7); ++connection default; ++SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached"; ++# Kill the server ++Expect seqno 6 ++6 +Expect 5 - SELECT * FROM t1; - f1 - 5 --7 ++SELECT * FROM t1; ++f1 ++5 DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-v25.result b/mysql-test/suite/wsrep/r/wsrep-recover-v25.result index 6d146f67bdf..c6e9246a753 100644 --- a/mysql-test/suite/wsrep/r/wsrep-recover-v25.result +++ b/mysql-test/suite/wsrep/r/wsrep-recover-v25.result @@ -1,28 +1,15 @@ # Kill the server -Expect seqno 0 -0 -CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; -# Kill the server Expect seqno 1 1 -INSERT INTO t1 VALUES (5); -# Kill the server -Expect seqno 2 -2 -SELECT VARIABLE_VALUE `expect 2` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; -expect 2 -2 -connect con1, localhost, root; -SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue"; -INSERT INTO t1 VALUES (7); -connection default; -SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached"; +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; # Kill the server Expect seqno 3 3 -Expect 5 7 -SELECT * FROM t1; -f1 +INSERT INTO t1 VALUES (5); +# Kill the server +Expect seqno 5 5 -7 +SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; +expect 6 +6 DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/r/wsrep-recover.result b/mysql-test/suite/wsrep/r/wsrep-recover.result new file mode 100644 index 00000000000..44b50a752d9 --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep-recover.result @@ -0,0 +1,64 @@ +# Kill the server +Expect seqno 1 +1 +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +# Kill the server +Expect seqno 3 +3 +INSERT INTO t1 VALUES (5); +# Kill the server +Expect seqno 5 +5 +SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; +expect 6 +6 +connect con1, localhost, root; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue"; +INSERT INTO t1 VALUES (7); +connect con_ctrl, localhost, root; +SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +connect con2, localhost, root; +SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached WAIT_FOR continue"; +INSERT INTO t1 VALUES (8); +connection con_ctrl; +SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached"; +connection default; +# Kill the server +Expect seqno 6 +6 +disconnect con1; +disconnect con2; +disconnect con_ctrl; +connection default; +SELECT VARIABLE_VALUE `expect 7` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; +expect 7 +7 +connect con1, localhost, root; +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; +SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_1 WAIT_FOR continue_before_commit_order_1"; +INSERT INTO t1 VALUES (9); +connect con_ctrl, localhost, root; +SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; +connect con2, localhost, root; +SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_2 WAIT_FOR continue_before_commit_order_2"; +INSERT INTO t1 VALUES (10); +connection con_ctrl; +SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_2"; +SET DEBUG_SYNC = "now SIGNAL continue_after_certification"; +SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1"; +connection default; +# Kill the server +Expect seqno 7 +7 +disconnect con1; +disconnect con2; +disconnect con_ctrl; +connection default; +SELECT VARIABLE_VALUE `expect 8` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; +expect 8 +8 +Expect row 5 +SELECT * FROM t1; +f1 +5 +DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/t/binlog_format.cnf b/mysql-test/suite/wsrep/t/binlog_format.cnf new file mode 100644 index 00000000000..7ec24c14d80 --- /dev/null +++ b/mysql-test/suite/wsrep/t/binlog_format.cnf @@ -0,0 +1,8 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// +innodb_autoinc_lock_mode=2 + diff --git a/mysql-test/suite/wsrep/t/binlog_format.opt b/mysql-test/suite/wsrep/t/binlog_format.opt deleted file mode 100644 index e3f2470c6e5..00000000000 --- a/mysql-test/suite/wsrep/t/binlog_format.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// diff --git a/mysql-test/suite/wsrep/t/binlog_format.test b/mysql-test/suite/wsrep/t/binlog_format.test index 07001b17a84..695859a2ad3 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.test +++ b/mysql-test/suite/wsrep/t/binlog_format.test @@ -1,3 +1,4 @@ +--source include/have_innodb.inc --source include/have_wsrep_provider.inc --source include/have_binlog_format_row.inc diff --git a/mysql-test/suite/wsrep/t/mdev_10186.cnf b/mysql-test/suite/wsrep/t/mdev_10186.cnf new file mode 100644 index 00000000000..3c4ca003f76 --- /dev/null +++ b/mysql-test/suite/wsrep/t/mdev_10186.cnf @@ -0,0 +1,6 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=OFF +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// diff --git a/mysql-test/suite/wsrep/t/mdev_10186.opt b/mysql-test/suite/wsrep/t/mdev_10186.opt deleted file mode 100644 index e2655959c62..00000000000 --- a/mysql-test/suite/wsrep/t/mdev_10186.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=0 diff --git a/mysql-test/suite/wsrep/t/mdev_10186.test b/mysql-test/suite/wsrep/t/mdev_10186.test index 63d34db7c42..0f0aa287086 100644 --- a/mysql-test/suite/wsrep/t/mdev_10186.test +++ b/mysql-test/suite/wsrep/t/mdev_10186.test @@ -1,3 +1,4 @@ +--source include/have_innodb.inc --source include/have_wsrep_provider.inc --source include/have_binlog_format_row.inc diff --git a/mysql-test/suite/wsrep/t/mdev_6832.cnf b/mysql-test/suite/wsrep/t/mdev_6832.cnf new file mode 100644 index 00000000000..0bf01f81fc5 --- /dev/null +++ b/mysql-test/suite/wsrep/t/mdev_6832.cnf @@ -0,0 +1,7 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// + diff --git a/mysql-test/suite/wsrep/t/mdev_6832.opt b/mysql-test/suite/wsrep/t/mdev_6832.opt deleted file mode 100644 index 16f8962dba2..00000000000 --- a/mysql-test/suite/wsrep/t/mdev_6832.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 diff --git a/mysql-test/suite/wsrep/t/mdev_6832.test b/mysql-test/suite/wsrep/t/mdev_6832.test index 9efccface57..226be1b788c 100644 --- a/mysql-test/suite/wsrep/t/mdev_6832.test +++ b/mysql-test/suite/wsrep/t/mdev_6832.test @@ -1,3 +1,4 @@ +--source include/have_innodb.inc --source include/have_wsrep_provider.inc --source include/have_binlog_format_row.inc diff --git a/mysql-test/suite/wsrep/t/mdev_7798.cnf b/mysql-test/suite/wsrep/t/mdev_7798.cnf new file mode 100644 index 00000000000..0bf01f81fc5 --- /dev/null +++ b/mysql-test/suite/wsrep/t/mdev_7798.cnf @@ -0,0 +1,7 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// + diff --git a/mysql-test/suite/wsrep/t/mdev_7798.opt b/mysql-test/suite/wsrep/t/mdev_7798.opt deleted file mode 100644 index 1007d5c0b78..00000000000 --- a/mysql-test/suite/wsrep/t/mdev_7798.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 diff --git a/mysql-test/suite/wsrep/t/mdev_7798.test b/mysql-test/suite/wsrep/t/mdev_7798.test index 9dfff0959bc..b9938d936cc 100644 --- a/mysql-test/suite/wsrep/t/mdev_7798.test +++ b/mysql-test/suite/wsrep/t/mdev_7798.test @@ -1,3 +1,4 @@ +--source include/have_innodb.inc --source include/have_wsrep_provider.inc --source include/have_binlog_format_row.inc diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.cnf b/mysql-test/suite/wsrep/t/pool_of_threads.cnf new file mode 100644 index 00000000000..b63e3324796 --- /dev/null +++ b/mysql-test/suite/wsrep/t/pool_of_threads.cnf @@ -0,0 +1,8 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// +thread_handling=pool-of-threads + diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.opt b/mysql-test/suite/wsrep/t/pool_of_threads.opt deleted file mode 100644 index 814417e5b0f..00000000000 --- a/mysql-test/suite/wsrep/t/pool_of_threads.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-v25.test b/mysql-test/suite/wsrep/t/wsrep-recover-v25.test index cfd77fbdef4..743e2795c1c 100644 --- a/mysql-test/suite/wsrep/t/wsrep-recover-v25.test +++ b/mysql-test/suite/wsrep/t/wsrep-recover-v25.test @@ -37,9 +37,11 @@ if ($log_bin) { # The expected recovered seqno is 1 corresponding to initial cluster # configuration change. # +let $restart_noprint=2; + --source include/kill_mysqld.inc --source wsrep-recover-step.inc ---echo Expect seqno 0 +--echo Expect seqno 1 --echo $wsrep_recover_start_position_seqno --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno @@ -48,13 +50,15 @@ if ($log_bin) { # # Senario 2 -# The expected recovered seqno is 1 corresponding to CREATE TABLE +# The expected recovered seqno is 3 corresponding to two configuration +# changes and CREATE TABLE # CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +let $restart_noprint=2; --source include/kill_mysqld.inc --source wsrep-recover-step.inc ---echo Expect seqno 1 +--echo Expect seqno 3 --echo $wsrep_recover_start_position_seqno --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno @@ -63,57 +67,53 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; # # Scenario 3 -# The expected recovered seqno is 2 corresponding to CREATE TABLE and INSERT. +# The expected recovered seqno is 5 corresponding to three configuration +# changes, CREATE TABLE and INSERT. # -# The expected wsrep_last_committed after the server is restarted is 2. +# The expected wsrep_last_committed after the server is restarted is 6. # INSERT INTO t1 VALUES (5); +let $restart_noprint=2; --source include/kill_mysqld.inc --source wsrep-recover-step.inc ---echo Expect seqno 2 +--echo Expect seqno 5 --echo $wsrep_recover_start_position_seqno --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno --source include/start_mysqld.inc --source include/wait_wsrep_ready.inc -SELECT VARIABLE_VALUE `expect 2` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; +SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; # # Scenario 4 # # The INSERT gets prepared but not committed. # -# If binlog is off, the expected outcome is that the INSERT gets committed -# since it is already committed in the cluster. If binlog is on, the INSERT +# This scenario is not applicable if binlog is not on since the +# commit is not 2PC. +# +# If binlog is on, the INSERT # should be rolled back during recovery phase since it has not yet # been logged into binlog. # ---connect con1, localhost, root -SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue"; ---send INSERT INTO t1 VALUES (7) - ---connection default -SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached"; ---source include/kill_mysqld.inc ---source wsrep-recover-step.inc if ($log_bin) { - --echo Expect seqno 2 -} -if (!$log_bin) { - --echo Expect seqno 3 -} ---echo $wsrep_recover_start_position_seqno ---let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno ---source include/start_mysqld.inc ---source include/wait_wsrep_ready.inc + --connect con1, localhost, root + SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL after_prepare_reached WAIT_FOR continue"; + --send INSERT INTO t1 VALUES (7) -if ($log_bin) { - --echo Expect 5 -} -if (!$log_bin) { - --echo Expect 5 7 + --connection default + let $restart_noprint=2; + SET DEBUG_SYNC = "now WAIT_FOR after_prepare_reached"; + --source include/kill_mysqld.inc + --source wsrep-recover-step.inc + --echo Expect seqno 6 + --echo $wsrep_recover_start_position_seqno + --let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno + --source include/start_mysqld.inc + --source include/wait_wsrep_ready.inc + --echo Expect 5 + SELECT * FROM t1; } -SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.cnf b/mysql-test/suite/wsrep/t/wsrep-recover.cnf new file mode 100644 index 00000000000..19986cd97bc --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover.cnf @@ -0,0 +1,9 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +binlog-format=ROW +innodb-flush-log-at-trx-commit=1 +wsrep-cluster-address=gcomm:// +wsrep-provider=@ENV.WSREP_PROVIDER +innodb-autoinc-lock-mode=2
\ No newline at end of file diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.combinations b/mysql-test/suite/wsrep/t/wsrep-recover.combinations new file mode 100644 index 00000000000..1ce3b45aa1a --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover.combinations @@ -0,0 +1,4 @@ +[binlogon] +log-bin + +[binlogoff] diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.test b/mysql-test/suite/wsrep/t/wsrep-recover.test new file mode 100644 index 00000000000..75271e45b15 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover.test @@ -0,0 +1,194 @@ +# +# Verify that the wsrep XID gets updated in InnoDB rollback segment +# properly and can be recovered with --wsrep-recover +# +# The test runs the following scenarios: +# +# 1) The server is started but no SQL is run +# 2) DDL is executed +# 3) INSERT is executed +# 4) Two INSERTs are executed so that the first one in order will be +# blocked after certification and the second one before entering +# commit order critical section. +# 5) Two DMLs are executed so that the prepare step is run out of order. +# Both transactions are blocked before commit order critical section. +# +# After each scenario server is killed and the recovered position +# is validated. +# + +--source include/have_wsrep.inc +--source include/have_innodb.inc +--source include/have_wsrep_provider.inc +--source include/have_debug_sync.inc + +# Binlog option for recovery run. This must be set in the test because +# combinations file causes log-bin option to be set from command line, +# not via my.cnf. +# +--let $log_bin = `SELECT @@log_bin` +if ($log_bin) { +--let $wsrep_recover_binlog_opt = --log-bin +} + +# +# Scenario 1 +# The expected recovered seqno is 1 corresponding to initial cluster +# configuration change. +# +let $restart_noprint=2; +--source include/kill_mysqld.inc +--source wsrep-recover-step.inc +--echo Expect seqno 1 +--echo $wsrep_recover_start_position_seqno + +--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno +--source include/start_mysqld.inc +--source include/wait_wsrep_ready.inc + +# +# Senario 2 +# The expected recovered seqno is 3 corresponding to two configuration +# change events and CREATE TABLE. +# +let $restart_noprint=2; + +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +--source include/kill_mysqld.inc +--source wsrep-recover-step.inc +--echo Expect seqno 3 +--echo $wsrep_recover_start_position_seqno + +--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno +--source include/start_mysqld.inc +--source include/wait_wsrep_ready.inc + +# +# Scenario 3 +# The expected recovered seqno is 5 corresponding to three configuration +# change events, CREATE TABLE and INSERT. +# +# The expected wsrep_last_committed after the server is restarted is 6. +# +let $restart_noprint=2; + +INSERT INTO t1 VALUES (5); +--source include/kill_mysqld.inc +--source wsrep-recover-step.inc +--echo Expect seqno 5 +--echo $wsrep_recover_start_position_seqno +--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno +--source include/start_mysqld.inc +--source include/wait_wsrep_ready.inc + +SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; + +# +# Scenario 4 +# +# This will cause the following +# +# Seqno 7 - the first INSERT is blocked after it is certified but before +# it gets prepared +# Seqno 8 - the second INSERT is blocked before it will be ordered for +# commit, so it becomes prepared +# +# As an outcome, the recovery process should return seqno 6 because +# the range of prepared transactions found after the crash recovery +# is not continuous up to 8. +# +# The expected wsrep_last_committed after server is restarted is 7. +# + +# Send INSERT which will block after certification +--connect con1, localhost, root +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue"; +--send INSERT INTO t1 VALUES (7) + +--connect con_ctrl, localhost, root +SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; + +# Send INSERT which will block before commit order critical section +--connect con2, localhost, root +SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached WAIT_FOR continue"; +--send INSERT INTO t1 VALUES (8) + +--connection con_ctrl +SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached"; + +--connection default +let $restart_noprint=2; +--source include/kill_mysqld.inc +--source wsrep-recover-step.inc +--echo Expect seqno 6 +--echo $wsrep_recover_start_position_seqno +--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno +--source include/start_mysqld.inc +--source include/wait_wsrep_ready.inc + +--disconnect con1 +--disconnect con2 +--disconnect con_ctrl +--connection default + +SELECT VARIABLE_VALUE `expect 7` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; + +# +# Scenario 5 +# +# This scenario will run two INSERTs in parallel so that they are +# prepared out of order. The execution is stopped before commit +# and the server is killed. +# +# The transactions will be recovered from InnoDB but +# will be rolled back: +# - If binlog is on, the binlog acts as a transaction coordinator. +# The transaction is not logged into binlog, so the transaction is rolled +# back. +# - If binlog is not on, the transaction is 1PC and the wsrep XID +# is not persisted before commit is complete. +# + +--connect con1, localhost, root +SET DEBUG_SYNC = "wsrep_after_certification SIGNAL after_certification_reached WAIT_FOR continue_after_certification"; +SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_1 WAIT_FOR continue_before_commit_order_1"; +--send INSERT INTO t1 VALUES (9) + +--connect con_ctrl, localhost, root +SET DEBUG_SYNC = "now WAIT_FOR after_certification_reached"; + +--connect con2, localhost, root +SET DEBUG_SYNC = "wsrep_before_commit_order_enter SIGNAL before_commit_order_reached_2 WAIT_FOR continue_before_commit_order_2"; +--send INSERT INTO t1 VALUES (10) + +--connection con_ctrl +SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_2"; +SET DEBUG_SYNC = "now SIGNAL continue_after_certification"; +SET DEBUG_SYNC = "now WAIT_FOR before_commit_order_reached_1"; + +--connection default +let $restart_noprint=2; +--source include/kill_mysqld.inc +--source wsrep-recover-step.inc +--echo Expect seqno 7 + +--echo $wsrep_recover_start_position_seqno +--let $restart_parameters = --wsrep-start-position=$wsrep_recover_start_position_uuid:$wsrep_recover_start_position_seqno +--source include/start_mysqld.inc +--source include/wait_wsrep_ready.inc + +--disconnect con1 +--disconnect con2 +--disconnect con_ctrl +--connection default + + +SELECT VARIABLE_VALUE `expect 8` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; + +# +# Final sanity check: The successful inserts into t1 should result single row +# +--echo Expect row 5 +SELECT * FROM t1; + +DROP TABLE t1; |