403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.170.96
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/binlog/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/binlog/t/binlog_gtid_simple_recovery.test
# ==== Purpose ====
#
# BUG#16741603: MYSQLD SCANS ALL BINARY LOGS ON CRASH RECOVERY
#
# Verify that the server does not scan more than one binary log
# in every iteration when initializing GTID sets on server start
# if binlog-gtid-simple-recovery is enabled. See implementation
# step 1-8.
#
# Bug #20075721  ASSERTION `LOST_GTIDS->IS_EMPTY()' AT BINLOG.CC:3637
# ON PURGE BINLOG CMD
#
# We are hitting the assertion when purging binary logs and the first
# left binary log just contains a Previous_gtids_log_event. The problem
# is caused by making GOT_PREVIOUS_GTIDS case to execute the assertion.
# This change is added after fixing Bug#16741603, but missed to
# remove the assertion.
#
# Removing the assertion to fix the problem.
#
# See implementation step 9-10.
#
# ==== Implementation ====
#
# 1) Start server and generate four binary logs with gtid_mode off.
# 2) Move master-bin.000002 to master-bin.000002.bkp and
#    master-bin.000003 to master-bin.000003.bkp
# 3) Only master-bin.000001 and master-bin.000004 remain, others are moved
#    , restart the server with enabled binlog-gtid-simple-recovery
#    and gtid_mode on. If the server scans more than one binary log in
#    every iteration, it will cause read error on the 2nd and 3rd files.
# 4) Verify that GLOBAL.GTID_EXECUTED and GLOBAL.GTID_PURGED are empty
#    after server restarts.
# 5) Move master-bin.000004 to master-bin.000004.bkp
# 6) Only master-bin.000001 and master-bin.000005 remain, others are moved
#    , restart the server with enabled binlog-gtid-simple-recovery
#    and gtid_mode on again. If the server scans more than one binary
#    log in every iteration, it will cause read error on the 2nd and
#    4th files.
# 7) Verify that GLOBAL.GTID_EXECUTED contains committed gtid MASTER_UUID:1
#    and GLOBAL.GTID_PURGED is empty after server restarts again.
# 8) Move binary logs back.
#
# 9) PURGE BINARY LOGS TO the last binary log master-bin.000006, which
#    just contains a Previous_gtids_log_event. This will not cause an
#    assertion failure any more.
# 10) Assert that the set of purged gtids is not empty (it is MASTER_UUID:1),
#     since a gtid event is written into master-bin.000004.
#

# Test in this file is binlog format agnostic, thus no need
# to rerun them for every format.
--source include/have_binlog_format_row.inc
--source include/not_gtid_enabled.inc
--source include/force_restart.inc

RESET MASTER;
--let $MYSQLD_DATADIR= `select @@datadir`
--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
CREATE TABLE t1 (
  c1 INT NOT NULL PRIMARY KEY
);

--echo # Generate master-bin.000002
FLUSH LOGS;
INSERT INTO t1 VALUES (1);
--let $binlog_file2= query_get_value(SHOW MASTER STATUS, File, 1)

--echo # Generate master-bin.000003
FLUSH LOGS;
INSERT INTO t1 VALUES (2);
--let $binlog_file3= query_get_value(SHOW MASTER STATUS, File, 1)

--echo # Generate master-bin.000004
FLUSH LOGS;
INSERT INTO t1 VALUES (3);
--let $binlog_file4= query_get_value(SHOW MASTER STATUS, File, 1)

--echo # Move master-bin.000002 to master-bin.000002.bkp and
--echo # master-bin.000003 to master-bin.000003.bkp
--move_file $MYSQLD_DATADIR/$binlog_file2 $MYSQLD_DATADIR/$binlog_file2.bkp
--move_file $MYSQLD_DATADIR/$binlog_file3 $MYSQLD_DATADIR/$binlog_file3.bkp

--echo #
--echo # Only master-bin.000001 and master-bin.000004 remain, others are moved
--echo # , restart the server with enabled binlog-gtid-simple-recovery
--echo # and gtid_mode on. If the server scans more than one binary log in
--echo # every iteration, it will cause read error on the 2nd and 3rd files.
--echo #
--let $restart_parameters=restart:--gtid-mode=on --enforce-gtid-consistency --log-slave-updates --binlog-gtid-simple-recovery=ON
--source include/restart_mysqld.inc

--echo #
--echo # Verify that GLOBAL.GTID_EXECUTED and GLOBAL.GTID_PURGED are empty
--echo # after server restarts.
--echo #
--let $assert_text= GLOBAL.GTID_EXECUTED must be empty.
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = ""
--source include/assert.inc
--let $assert_text= GLOBAL.GTID_PURGED must be empty.
--let $assert_cond= "[SELECT @@GLOBAL.GTID_PURGED]" = ""
--source include/assert.inc

--echo #
--echo # Write one gtid event into master-bin.000004
--echo #
DROP TABLE t1;
--echo # Move master-bin.000004 to master-bin.000004.bkp
--move_file $MYSQLD_DATADIR/$binlog_file4 $MYSQLD_DATADIR/$binlog_file4.bkp

--echo #
--echo # Only master-bin.000001 and master-bin.000005 remain, others are moved
--echo # , restart the server with enabled binlog-gtid-simple-recovery
--echo # and gtid_mode on again. If the server scans more than one binary
--echo # log in every iteration, it will cause read error on the 2nd and
--echo # 4th files.
--echo #
--let $restart_parameters=restart:--gtid-mode=on --enforce-gtid-consistency --log-slave-updates --binlog-gtid-simple-recovery=ON
--source include/restart_mysqld.inc

--echo #
--echo # Verify that GLOBAL.GTID_EXECUTED contains committed gtid MASTER_UUID:1
--echo # and GLOBAL.GTID_PURGED is empty after server restarts again.
--echo #
--let $assert_text= committed gtid MASTER_UUID:1
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1"
--source include/assert.inc
--let $assert_text= GLOBAL.GTID_PURGED is empty
--let $assert_cond= "[SELECT @@GLOBAL.GTID_PURGED]" = ""
--source include/assert.inc

--echo #
--echo # Move binary logs back.
--echo #
--move_file $MYSQLD_DATADIR/$binlog_file2.bkp $MYSQLD_DATADIR/$binlog_file2
--move_file $MYSQLD_DATADIR/$binlog_file3.bkp $MYSQLD_DATADIR/$binlog_file3
--move_file $MYSQLD_DATADIR/$binlog_file4.bkp $MYSQLD_DATADIR/$binlog_file4

--let $binlog_file6= query_get_value(SHOW MASTER STATUS, File, 1)
--echo #
--echo # PURGE BINARY LOGS TO master-bin.000006
--echo #
--eval PURGE BINARY LOGS TO '$binlog_file6'

--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`
--let $assert_text= purged gtids MASTER_UUID:1
--let $assert_cond= "[SELECT @@GLOBAL.GTID_PURGED]" = "$master_uuid:1"
--source include/assert.inc

# clean up
--let $MYSQLD_DATADIR=
--let $master_uuid=
--let $restart_parameters=
--let $binlog_file2=
--let $binlog_file3=
--let $binlog_file4=
--let $binlog_file6=

Youez - 2016 - github.com/yon3zu
LinuXploit