403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.108.52
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 :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/mysql-test/suite/group_replication/t/gr_crash_donor_server_continuously.test
################################################################################
# This test verifies whether the group_replication works fine if the
# donor servers are killed one after the other while some server is in
# Recovery state.
#
# Test:
# 0. The test requires three servers: M1,M2 and M3.
# 1. Start GR on servers M1 and M2.
# 2. Execute some operations on the group through server M1
#    using procedure dml_operations.
# 3. Join M3 to the group and wait until the server is in Recovery.
# 4. Identify the donor server for M3.
# 5. kill and restart the donor server.
# 6. Again Join the restarted member to the group.
# 7. Repeat the steps 4-6 for several times.
# 8. Wait until all the servers are online.
# 9. Verify that all the members have same data.
# 10.Cleanup
################################################################################

# This test does crashes servers, thence we skip it on asan and valgrind.
--source include/not_asan.inc
--source include/not_valgrind.inc
--source include/big_test.inc
--source include/force_restart.inc

--source ../inc/have_group_replication_plugin.inc
--let $rpl_server_count= 3
--let $rpl_skip_group_replication_start= 1
--source ../inc/group_replication.inc

# START GR on Two servers M1 and M2
--let $rpl_connection_name= server1
--source include/rpl_connection.inc

SET SESSION sql_log_bin=0;
call mtr.add_suppression("\\[Warning\\] InnoDB: Database page corruption or a failed file read of page");
SET SESSION sql_log_bin=1;

# Extract the server_uuid
--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

SET sql_log_bin=0;
CREATE TABLE t1(a int primary key);
SET sql_log_bin=1;

--source ../inc/start_and_bootstrap_group_replication.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc

# Extract the server_uuid
--let $server2_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)

SET sql_log_bin=0;
CREATE TABLE t1(a int primary key);
SET sql_log_bin=1;

--source include/start_group_replication.inc

# Execute the operations on the group through server1 so
# that when server3 joins it will be in RECOVERY for some time.

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

# Create the procedure to perform dml operations
delimiter $$;
CREATE PROCEDURE dml_operations()
     BEGIN
     declare x INT;
     set x=1;
     while x<600 do
     insert into t1 values (x);
     update t1 set a=x+600 where a=x;
     delete from t1 where a<650;
     set x=x+1;
     end  while;
     end$$
delimiter ;$$
--echo

--echo ----call procedure----
call dml_operations();
--echo

# Wait for the data to get synced on server2.
--source include/rpl_sync.inc

# JOIN M3 to the group
--let $rpl_connection_name= server3
--source include/rpl_connection.inc

SET sql_log_bin=0;
CREATE TABLE t1(a int primary key);
SET sql_log_bin=1;
LOCK TABLES t1 READ;

--let $rpl_connection_name= server_3
--source include/rpl_connection.inc

SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Plugin group_replication reported: 'There was an error when connecting to the donor server.*");
call mtr.add_suppression("For details please check performance_schema.replication_connection_status table and error log messages of Slave I/O for channel group_replication_recovery.");
call mtr.add_suppression("Slave I/O for channel 'group_replication_recovery': Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again.*");
SET SESSION sql_log_bin= 1;

--let $group_replication_start_member_state= RECOVERING
--source include/start_group_replication.inc

--let $count=1

--let $wait_timeout= 100
--let $wait_condition= SELECT COUNT(*)=1 FROM performance_schema.replication_connection_status WHERE channel_name='group_replication_recovery' AND service_state='ON'
--source include/wait_condition.inc

while($count<6)
{
  --let $rpl_connection_name= server_3
  --source include/rpl_connection.inc
  # Identify the donor_server for M3
  let $donor_id= 1;
  let $other_id= 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 $other_id= 1;
  }

  --let $rpl_connection_name= server3
  --source include/rpl_connection.inc
  UNLOCK TABLES;

  --let $rpl_connection_silent= 1
  --let $rpl_connection_name= server$donor_id
  --source include/rpl_connection.inc

  # kill the donor server
  --let $group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
  --let $group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
  --let $_group_replication_group_whitelist= `SELECT @@GLOBAL.group_replication_ip_whitelist`
  --let $restart_parameters=restart:--group_replication_local_address=$group_replication_local_address --group_replication_group_seeds=$group_replication_group_seeds --group_replication_group_name=$group_replication_group_name --group_replication_ip_whitelist=$_group_replication_group_whitelist
  --replace_result $group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS $group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_group_whitelist GROUP_REPLICATION_GROUP_WHITELIST
  --source ../inc/kill_and_restart_mysqld.inc

  # Needed as we are not using rpl_restart_server.inc
  --let $rpl_server_number= $donor_id
  --source include/rpl_reconnect.inc

  --let $rpl_connection_name= server3
  --source include/rpl_connection.inc
  LOCK TABLES t1 READ;

  --let $rpl_connection_name= server$other_id
  --source include/rpl_connection.inc

  --let $wait_condition= SELECT COUNT(*) = 2 FROM performance_schema.replication_group_members
  --source include/wait_condition.inc

  # Sleep for some time so that some time elapse before the restarted server rejoins the group.
  --sleep 5

  --let $rpl_connection_name= server$donor_id
  --source include/rpl_connection.inc
  --let $wait_timeout= 100
  --source include/start_group_replication.inc

  --inc $count
  --let $rpl_connection_silent= 0
}

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
UNLOCK TABLES;

# Wait until all the servers are online
--let $wait_timeout=300
--let $wait_condition= SELECT COUNT(*) = 3 FROM performance_schema.replication_group_members where MEMBER_STATE='ONLINE';
--source include/wait_condition.inc
--source include/rpl_sync.inc

# Verify that table t1 has same data on all the servers.
--let $diff_tables=server1:t1, server2:t1, server3:t1
--source include/diff_tables.inc

# Clean up.
drop table t1;
drop procedure dml_operations;
--let $skip_restore_connection= 0
--source ../inc/group_replication_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit