403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.70.92.247
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/src/mysql-test/suite/rpl/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/rpl/t/rpl_change_master_relay_log_purge.test
# ==== Purpose ====
#
# This test script serves as the functionality testing for
# WL#6120- Change master without stopping slave.
#
# This test script does the following:

#  - If at least one of the receiver or applier threads is running, relay logs
#    should not be purged.
#  - If relay_log_file/relay_log_pos options are used, relay logs should
#    not be purged.
#  - If both receiver and applier threads are stopped and there is no use of
#    relay_log_file/relay_log_pos options, relay logs should be
#    purged.
#
#  ==== Related Worklog(s) And Bug(s)====
#
#  WL#6120- Change master without stopping Slave threads.
#

--source include/not_gtid_enabled.inc
--source include/master-slave.inc
--source include/have_binlog_format_mixed.inc

FLUSH BINARY LOGS;

--source include/sync_slave_sql_with_master.inc

#save old values to restore after test in the cleanup section.
let $slave_heartbeat_timeout_before_test= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
let $delay_before_test= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1);

--echo
--echo We now stop the IO thread and ensure that the relaylog files
--echo are not deleted on doing a change master with a running SQL thread.
--echo

# Note down the current relaylog file.
# CM stands for 'change master'.
let $relay_log_file_before_CM= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);

# Execute change master command with running SQL thread.
--source include/stop_slave_io.inc
CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD= 10;

# Note down the active relaylog after change master
let $relay_log_file_after_CM= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);

--let $assert_text= The relaylog file should not change if change master command was executed while SQL thread was running.
--let $assert_cond= "$relay_log_file_before_CM" = "$relay_log_file_after_CM"
--source include/assert.inc

--echo
--echo We now stop the SQL thread and ensure that the relaylog files
--echo are not deleted on doing a change master with a running IO thread.
--echo

--source include/stop_slave_sql.inc
--source include/start_slave_io.inc
CHANGE MASTER TO MASTER_DELAY= 20;

# Note down the active relaylog after change master
let $relay_log_file_after_CM= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);

--let $assert_text= The relaylog file should not change if change master command was executed while IO thread was running.
--let $assert_cond= "$relay_log_file_before_CM" = "$relay_log_file_after_CM"
--source include/assert.inc

--echo
--echo If the relay_log_file and relay_log_pos options are used, we dont purge
--echo relaylogs.
--echo

# Lets stop IO thread again to make sure we are not purging relay logs only
# because we have a use of relay_log_file/relay_log_pos options and not
# because one of the slave threads is running.

--source include/stop_slave_io.inc

let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
replace_result $relay_log_file RELAY_LOG_FILE;
eval CHANGE MASTER TO RELAY_LOG_FILE= '$relay_log_file';

let $relay_log_pos= query_get_value(SHOW SLAVE STATUS, Relay_Log_Pos, 1);
replace_result $relay_log_pos RELAY_LOG_POS;
eval CHANGE MASTER TO RELAY_LOG_POS= $relay_log_pos;

let $relay_log_file_after_CM= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);

--let $assert_text= The relaylog file should not change if change master command contained relay_log_file or relay_log_pos option.
--let $assert_cond= "$relay_log_file_before_CM" = "$relay_log_file_after_CM"
--source include/assert.inc

--echo
--echo With both the threads stopped and no use of relay_log_file or
--echo relay_log_pos options, the relaylogs should be deleted.
--echo

CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD= 20;

let $relay_log_file_after_CM= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);

--let $assert_text= With both the threads stopped and no use of relay_log_file or relay_log_pos options in change master command, the relaylogs should be deleted.
--let $assert_cond= "$relay_log_file_before_CM" != "$relay_log_file_after_CM"
--source include/assert.inc

--echo
--echo cleanup
--echo

# Restore to default values now using the values saved before the tests.
# No need to record the default values in the result file.
--disable_query_log
eval CHANGE MASTER TO MASTER_DELAY= $delay_before_test;
eval CHANGE MASTER TO MASTER_HEARTBEAT_PERIOD= $slave_heartbeat_timeout_before_test;
--enable_query_log

--source include/start_slave.inc
--source include/rpl_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit