################################################################################ # Group replication test that asserts that servers do not repeat View change # events in their binlogs. # This happened in: # Recovery rounds where the events were received a second time but not skipped # Plugin restarts where the applier relay log would be replayed. # # To test this, in a group several view changes are executed, and along side # them we check in one of the servers that only the expected view events are # written. # # Test: # 0. The test requires three servers: M1, M2 and M3. # 1. Bootstrap group with M1. Create table t1 on M1. Start GR on M2. Check that # M2 recieves view change from M1, create table, view change by M2. # 2. Make M2 leave and join again. Check that exists one more event after join # in the binlog. # 3. Stop GR on M2. Join and leave M3. Start GR on M2. Check on M2 it should # receive 1 view change transaction from M3 and write 1 other. # 4. Clean up. ################################################################################ --source include/big_test.inc --source include/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --let $rpl_server_count= 3 --source include/group_replication.inc # The sequence of events that make up a View Change --let $vcle_seq= Gtid # Query/BEGIN # View_change # Query/COMMIT --echo # --echo # Setup a new group with two servers. --echo # Check that server 2 receives a view event and writes another one --echo # --connection server1 --echo server1 --source include/start_and_bootstrap_group_replication.inc CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; --connection server2 --echo server2 --source include/start_group_replication.inc # View change (received from s1) # Create table # View change (written by s2) --let $event_sequence= $vcle_seq # !Gtid_transaction # $vcle_seq --source include/assert_binlog_events.inc --echo # --echo # Make server 2 leave and enter generating one more view change event --echo # Check that only one view change transaction is written to the binlog --echo # --connection server2 --echo server2 --source include/stop_group_replication.inc # No event should be written in the binlog --let $event_sequence= $event_sequence --source include/assert_binlog_events.inc --source include/start_group_replication.inc # One more event after joining: # Previous events # View change (s2 joined) --let $event_sequence= $event_sequence # $vcle_seq --source include/assert_binlog_events.inc --echo # --echo # Make server 3 join and leave while server 2 was away --echo # Server 2 should receive 1 view change transaction from recovery and --echo # write another --echo # --connection server2 --echo server2 --source include/stop_group_replication.inc --connection server3 --echo server3 --source include/start_group_replication.inc --source include/stop_group_replication.inc --connection server2 --echo server2 --source include/start_group_replication.inc # Previous events # View change (3 joined) # View change (2 joined) --let $event_sequence= $event_sequence # $vcle_seq # $vcle_seq --source include/assert_binlog_events.inc --echo # --echo # Cleaning up --echo # --connection server3 --echo server3 --source include/start_group_replication.inc DROP TABLE t1; --source include/group_replication_end.inc