################################################################################ # Validate the correct behaviour when a member joins a group while there is a # transaction with group_replication_consistency= 'AFTER' ongoing. # # Test: # 00. The test requires three servers: M1, M2 and M3. # 01. Bootstrap group with M1, add M2. # 02. Create table t1 with group_replication_consistency= 'AFTER' # 03. Lock table t1 on server2 to block a future update. # 04. Execute transaction T1, the transaction will block since # server2 cannot prepare. # 05. Execute START GR on M3. # The member will be in RECOVERING until T1 is complete. # 06. On M2: Unlock t1. # 07. server3 will change to ONLINE state. # 08. Validate data. # 09. Clean up. ################################################################################ --source include/big_test.inc --source include/not_have_privilege_checks_user.inc --source include/have_group_replication_plugin.inc --let $rpl_server_count= 3 --let $rpl_skip_group_replication_start= 1 --source include/group_replication.inc --echo --echo ############################################################ --echo # 01. Bootstrap group with M1, add M2. --source include/start_and_bootstrap_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/start_group_replication.inc --echo --echo ############################################################ --echo # 02. Create table t1 with group_replication_consistency= 'AFTER' --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET @@SESSION.group_replication_consistency= 'AFTER'; CREATE TABLE t1 (a INT PRIMARY KEY); --echo --echo ############################################################ --echo # 03. Lock table t1 on server2 to block a future update. --let $rpl_connection_name= server2 --source include/rpl_connection.inc LOCK table t1 READ; --echo --echo ############################################################ --echo # 04. Execute transaction T1, the transaction will block since --echo # server2 cannot prepare. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --send INSERT INTO t1 VALUES (11) --let $rpl_connection_name= server_1 --source include/rpl_connection.inc --let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE user='root' AND state='waiting for handler commit' AND info='INSERT INTO t1 VALUES (11)' --source include/wait_condition.inc --let $rpl_connection_name= server_2 --source include/rpl_connection.inc --let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist WHERE user='system user' AND state='Waiting for table metadata lock' --source include/wait_condition.inc --echo --echo ############################################################ --echo # 05. Execute START GR on M3. --echo # The member will be in RECOVERING until T1 is complete. --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $group_replication_start_member_state= RECOVERING --source include/start_group_replication.inc --echo --echo ############################################################ --echo # 06. On M2: Unlock t1. --let $rpl_connection_name= server2 --source include/rpl_connection.inc UNLOCK tables; --echo --echo ############################################################ --echo # 07. server3 will change to ONLINE state. --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $group_replication_member_state= ONLINE --source include/gr_wait_for_member_state.inc --echo --echo ############################################################ --echo # 08. Validate data. --let $rpl_connection_name= server1 --source include/rpl_connection.inc --reap --let $assert_text= 'There is 1 value in table t1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=11, count, 1] = 1 --source include/assert.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $assert_text= 'There is 1 value in table t1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=11, count, 1] = 1 --source include/assert.inc # server3 was not considered on the consistent transactions. --source include/rpl_sync.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $assert_text= 'There is 1 value in table t1' --let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=11, count, 1] = 1 --source include/assert.inc --let $diff_tables=server1:t1, server2:t1, server3:t1 --source include/diff_tables.inc --echo --echo ############################################################ --echo # 09. Clean up. --let $rpl_connection_name= server1 --source include/rpl_connection.inc DROP TABLE t1; SET @@SESSION.group_replication_consistency= DEFAULT; --source include/group_replication_end.inc