Server IP : 104.21.38.3 / Your IP : 162.158.108.45 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/mysql-test/suite/group_replication/t/ |
Upload File : |
################################################################################ # Recovery donor failover test # This test focus on the failover mechanism where a joiner changes it's donor # whenever the one in use leaves the group while recovery is happening. # # To test this, a new member is started but recovery blocked. While at this state # the donor is killed, forcing the joiner to change to a new one. As there is # no donor identification as of now, we just unblock and check that recovery # was successful # # Test: # 0. The test requires three servers: M1, M2 and M3. # 1. Bootstrap group on M1. Insert some data. Start GR on M2. # 2. Stop the applier on both servers to block recovery. # 3. Start GR on M3. It should go into RECOVERING state. Identify the DONOR. # 4. Stop GR on the donor making it leave the group. # 5. Unblock recovery i.e. Start the applier on failover member and watch M3 go # ONLINE despite the donor exit. Vaidate data on M3. # 6. Clean up. ################################################################################ --let $group_replication_group_name= 55d07150-9a4d-11e3-a5e2-0800200c9a66 --source ../inc/have_group_replication_plugin.inc --let $rpl_skip_group_replication_start= 1 --let $rpl_server_count= 3 --source ../inc/group_replication.inc --echo # --echo # Setup a new 2 member group --echo # --connection server1 --source ../inc/start_and_bootstrap_group_replication.inc --let $group_replication_number_of_members= 1 --source ../inc/gr_wait_for_number_of_members.inc #insert some data CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); --connection server2 #extract server uuid for calculations below --let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) --source include/start_group_replication.inc --let $group_replication_number_of_members= 2 --source ../inc/gr_wait_for_number_of_members.inc #Stop the applier on both servers to block recovery STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier"; --connection server1 STOP SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier"; --echo # --echo # Start recovery on a new member and kill the donor --echo # --connection server3 SET SESSION sql_log_bin= 0; call mtr.add_suppression(".*Error when configuring the group recovery connection *.*"); SET SESSION sql_log_bin= 1; --let $group_replication_start_member_state= RECOVERING --source include/start_group_replication.inc --echo # Find if server 1 or 2 is the donor #give it time to connect --sleep 5 #Find what member is the donor --let $donor_id= 1 --let $failover= 2 if (`SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status WHERE channel_name='group_replication_recovery' AND service_state='ON' AND source_uuid='$server2_uuid'`) { --let $donor_id= 2 --let $failover= 1 } --echo # Stop group replication on the donor making it leave the group --connection server$donor_id --source include/stop_group_replication.inc --echo # Unblock recovery and watch the member go online despite the donor exit --connection server$failover START SLAVE SQL_THREAD FOR CHANNEL "group_replication_applier"; --connection server3 --let $group_replication_member_state= ONLINE --source ../inc/gr_wait_for_member_state.inc --let $assert_text= On the recovered member, the table should exist and have 1 elements; --let $assert_cond= [select count(*) from t1] = 1; --source include/assert.inc --let $assert_text= On the recovered member, the executed GTID should be the same as on the donor plus the view changes --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "55d07150-9a4d-11e3-a5e2-0800200c9a66:1-5"; --source include/assert.inc --echo # --echo # Cleaning up --echo # --connection server$donor_id --source include/start_group_replication.inc DROP TABLE t1; --source ../inc/group_replication_end.inc