# # Test that a joiner performing IST can be killed and restarted with no adverse consequences. # This is achieved by using the recv_IST_after_apply_trx Galera dbug sync point to block IST after # one transaction has been applied. When IST blocks, we kill and restart the joiner # --source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_debug_sync.inc --source suite/galera/include/galera_have_debug_sync.inc CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a'); # Disconnect node #2 --connection node_2 --source suite/galera/include/galera_unload_provider.inc --connection node_1 UPDATE t1 SET f2 = 'b' WHERE f1 > 1; # Wait until node #1 has left --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc UPDATE t1 SET f2 = 'c' WHERE f1 > 2; --connection node_2 # Make sure IST will block ... --let $galera_sync_point = recv_IST_after_apply_trx --source include/galera_set_sync_point.inc SET SESSION wsrep_sync_wait = 0; # Write file to make mysql-test-run.pl expect the crash, but don't start it --let $_server_id= `SELECT @@server_id` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect --exec echo "wait" > $_expect_file_name --let KILL_NODE_PIDFILE = `SELECT @@pid_file` # ... and restart provider to force IST --echo Loading wsrep_provider ... --disable_query_log --eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; --eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; --enable_query_log # We can not use a wait_condition on SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS as such queries are blocked during IST # so we perform a simple sleep and SHOW instead --sleep 5 SHOW STATUS LIKE 'wsrep_debug_sync_waiters'; --connection node_1 # Perform DML and DDL while IST is in progress --connection node_1 UPDATE t1 SET f2 = 'd' WHERE f1 > 3; CREATE TABLE t2 (f1 INTEGER); # Kill node #2 while IST is in progress --connection node_2 # Kill the connected server --disable_reconnect --perl my $pid_filename = $ENV{'KILL_NODE_PIDFILE'}; my $mysqld_pid = `cat $pid_filename`; chomp($mysqld_pid); system("kill -9 $mysqld_pid"); exit(0); EOF --source include/wait_until_disconnected.inc --connection node_1 --source include/wait_until_connected_again.inc --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc # Perform DML and DDL while node #2 is down UPDATE t1 SET f2 = 'e' WHERE f1 > 4; CREATE TABLE t3 (f1 INTEGER); --connection node_2 --let $galera_wsrep_recover_server_id=2 --source suite/galera/include/galera_wsrep_recover.inc --echo Starting server ... --source include/start_mysqld.inc --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc --connection node_1 UPDATE t1 SET f2 = 'f' WHERE f1 > 5; SELECT * FROM t1; --connection node_2 SELECT * FROM t1; SELECT COUNT(*) = 0 FROM t2; SELECT COUNT(*) = 0 FROM t3; --connection node_1 DROP TABLE t1, t2, t3;