################################################################################ # Group Replication: cross-version policies # This test-case makes sure: # 1. Patch version is considered during primary election when all members are # of version >= 8.0.17. # 2. When patch versions are same, member weight is considered among lower # versions members # 3. When patch versions and member weight are same, UUID is considered # # Test: # 0. The test requires four servers: M1, M2, M3, M4 in single primary mode. # 1. Bootstrap M1 and start GR on M2. # Set higher member weight on M3 and start GR with higher patch version. # 2. Stop GR on M1. # M2 becomes primary due to lower version rule. # 3. Set higher member weight on M1 and start GR on M1 and M4. # Stop GR primary member M2. # M1 becomes primary due to lower version and higher member weight. # 4. Start GR on M2. # Stop GR primary member M1. # Lowest server_uuid between M2 or M4 becomes primary. # Server_uuid is considered among same version and member weight. # 5. Cleanup. # ################################################################################ --source include/big_test.inc --source include/have_debug.inc --source include/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --let $rpl_server_count= 4 --let $rpl_group_replication_single_primary_mode=1 --source include/group_replication.inc --echo --echo # 1. Bootstrap M1 and start GR on M2. --echo # Set higher member weight on M3 and start GR with higher patch version. --echo --let $rpl_connection_name= server1 --source include/rpl_connection.inc --let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) SET @debug1_save= @@GLOBAL.DEBUG; --source include/start_and_bootstrap_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) --source include/start_group_replication.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc --let $server3_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) SET @member_weight3_save= @@GLOBAL.group_replication_member_weight; --eval SET GLOBAL group_replication_member_weight= 90 SET @debug3_save= @@GLOBAL.DEBUG; SET @@GLOBAL.DEBUG= 'd,group_replication_compatibility_higher_patch_version'; SET SESSION sql_log_bin = 0; call mtr.add_suppression("Member version is read compatible with the group."); SET SESSION sql_log_bin = 1; --source include/start_group_replication.inc --echo --echo # 2. Stop GR on M1. --echo # M2 becomes primary due to lower version rule. --echo ## STATUS - ASSUMING 8.0.17 is original version # Server - State - Version - Weight - R/W # M1 - ON - 8.0.17 - 50 - P # M2 - ON - 8.0.17 - 50 - S # M3 - ON - 8.0.18 - 90 - S # M4 - OFF - -.-.-- - 50 - S --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/stop_group_replication.inc --let $_primary_member_of_group= $server2_uuid --source include/gr_assert_spm_consistency.inc --echo --echo # 3. Set higher member weight on M1 and start GR on M1 and M4. --echo # Stop GR primary member M2. --echo # M1 becomes primary due to lower version and higher member weight. --echo # Server - State - Version - Weight - R/W # M1 - OFF - 8.0.17 - 50 - S # M2 - ON - 8.0.17 - 50 - P (NEW) # M3 - ON - 8.0.18 - 90 - S # M4 - OFF - -.-.-- - 50 - S --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET @member_weight1_save= @@GLOBAL.group_replication_member_weight; --eval SET GLOBAL group_replication_member_weight= 60 --source include/start_group_replication.inc --let $rpl_connection_name= server4 --source include/rpl_connection.inc --source include/start_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/stop_group_replication.inc --let $_primary_member_of_group= $server1_uuid --source include/gr_assert_spm_consistency.inc --echo --echo # 4. Start GR on M2. --echo # Stop GR primary member M1. --echo # Lowest server_uuid between M2 or M4 becomes primary. --echo # Server_uuid is considered among same version and member weight. --echo # Server - State - Version - Weight - R/W # M1 - ON - 8.0.17 - 60 - P (NEW) # M2 - OFF - 8.0.17 - 50 - S # M3 - ON - 8.0.18 - 90 - S # M4 - ON - 8.0.17 - 50 - S --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/start_group_replication.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc --source include/stop_group_replication.inc --let $rpl_connection_name= server2 --source include/rpl_connection.inc --let $_next_primary_uuid= query_get_value("SELECT Member_id FROM performance_schema.replication_group_members WHERE Member_id <> '$server3_uuid' ORDER BY Member_id ASC LIMIT 1", Member_id, 1) --let $_primary_member_of_group= $_next_primary_uuid --source include/gr_assert_spm_consistency.inc --echo --echo # 5. Cleanup. --echo # Server - State - Version - Weight - R/W # M1 - OFF - 8.0.17 - 60 - S # M2 - ON - 8.0.17 - 50 - P/S (CANDIDATE) # M3 - ON - 8.0.18 - 90 - S # M4 - ON - 8.0.17 - 50 - P/S (CANDIDATE) --let $rpl_connection_name= server4 --source include/rpl_connection.inc --source include/stop_group_replication.inc --let $rpl_connection_name= server1 --source include/rpl_connection.inc SET @@GLOBAL.DEBUG= @debug1_save; SET @@GLOBAL.group_replication_member_weight = @member_weight1_save; --let $rpl_connection_name= server2 --source include/rpl_connection.inc --source include/stop_group_replication.inc --let $rpl_connection_name= server3 --source include/rpl_connection.inc # Stop GR because version is different. --source include/stop_group_replication.inc SET @@GLOBAL.group_replication_member_weight = @member_weight3_save; SET @@GLOBAL.DEBUG= @debug3_save; --let $rpl_group_replication_reset_persistent_vars=1 --source include/group_replication_end.inc