403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.163.135
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_transaction_ctx_service.test
#
# The purpose of this test is to demonstrate:
# 1) The behaviour of the before_commit hook placed in binlog.cc and all
#    possible return values.
# 2) All the possible ramifications of the execution of the Transaction Context
#    Service and its behaviour in the server.
#
# One will then test:
# 1) before_commit failure
# 2) Transaction Context Service reports that parameters are invalid
# 3) Transaction Context Service reports that the transaction must abort
# 4) Transaction Context Service reports OK without generating a GTID
# 5) Transaction Context Service reports OK generating a GTID internally
#

--source include/not_embedded.inc
--source include/have_debug.inc
--source include/have_gtid.inc
--source include/not_group_replication_plugin.inc

--source include/install_replication_observers_example.inc

--let $rpl_gtid_utils=1
--source include/master-slave.inc

--echo #
--echo # Set up test
--echo #

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

CREATE TABLE t1 (c1 INT PRIMARY KEY) Engine=InnoDB;

--echo #
--echo # Case 1. This will cause the before_commit hook to fail. As a
--echo # consequence, the whole transaction shall fail.
--echo #

SET @debug_saved= @@GLOBAL.DEBUG;
SET @@GLOBAL.DEBUG= '+d,force_error_on_before_commit_listener';

SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Run function 'before_commit' in plugin");
SET SESSION sql_log_bin= 1;

BEGIN;
INSERT t1 VALUES(1);
--error ER_RUN_HOOK_ERROR
COMMIT;

--error ER_RUN_HOOK_ERROR
INSERT t1 VALUES(2);

--let $assert_text= GTID_EXECUTED must remain the same
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$master_uuid:1")
--source include/assert.inc

--let $assert_text= Table must remain empty
--let $assert_cond= "[SELECT COUNT(*) FROM t1]" = "0"
--source include/assert.inc

--source include/sync_slave_sql_with_master.inc

--let $assert_text= GTID_EXECUTED must remain the same
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$master_uuid:1")
--source include/assert.inc

--let $assert_text= Table must remain empty
--let $assert_cond= "[SELECT COUNT(*) FROM t1]" = "0"
--source include/assert.inc

--connection master

SET @@GLOBAL.DEBUG='';


--echo #
--echo # Case 2. This will force the Transaction Context to report an invalid
--echo # transaction certification outcome,
--echo #

SET @@GLOBAL.DEBUG= '+d,force_invalid_certification_outcome';

SET SESSION sql_log_bin= 0;
call mtr.add_suppression("Plugin replication_observers_example reported: 'Unable to update transaction context service on server, thread_id:.*");
SET SESSION sql_log_bin= 1;

BEGIN;
INSERT t1 VALUES(1);
--error ER_RUN_HOOK_ERROR
COMMIT;

--error ER_RUN_HOOK_ERROR
INSERT t1 VALUES(2);

--let $assert_text= GTID_EXECUTED must remain the same
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$master_uuid:1")
--source include/assert.inc

--let $assert_text= Table must remain empty
--let $assert_cond= "[SELECT COUNT(*) FROM t1]" = "0"
--source include/assert.inc

--source include/sync_slave_sql_with_master.inc

--let $assert_text= GTID_EXECUTED must remain the same
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$master_uuid:1")
--source include/assert.inc

--let $assert_text= Table must remain empty
--let $assert_cond= "[SELECT COUNT(*) FROM t1]" = "0"
--source include/assert.inc

--connection master

SET @@GLOBAL.DEBUG='';


--echo #
--echo # Case 3. This will force the Transaction Context to report an negative
--echo # transaction certification outcome,
--echo #

SET @@GLOBAL.DEBUG= '+d,force_negative_certification_outcome';

BEGIN;
INSERT t1 VALUES(1);
--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT
COMMIT;

--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT
INSERT t1 VALUES(2);

--let $assert_text= GTID_EXECUTED must remain the same
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$master_uuid:1")
--source include/assert.inc

--let $assert_text= Table must remain empty
--let $assert_cond= "[SELECT COUNT(*) FROM t1]" = "0"
--source include/assert.inc

--source include/sync_slave_sql_with_master.inc

--let $assert_text= GTID_EXECUTED must remain the same
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$master_uuid:1")
--source include/assert.inc

--let $assert_text= Table must remain empty
--let $assert_cond= "[SELECT COUNT(*) FROM t1]" = "0"
--source include/assert.inc

--connection master

SET @@GLOBAL.DEBUG='';

--echo #
--echo # Case 4. This will force the Transaction Context to report a valid
--echo # outcome without generating a GTID.
--echo #

SET @@GLOBAL.DEBUG= '+d,force_positive_certification_outcome_without_gtid';

BEGIN;
INSERT t1 VALUES(1);
COMMIT;

INSERT t1 VALUES(2);

--query_vertical SELECT * FROM t1;

--let $assert_text= At this point we should have 2 successful operations
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-3"
--source include/assert.inc

--source include/sync_slave_sql_with_master.inc

--let $assert_text= At this point we should have 2 successful operations
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-3"
--source include/assert.inc

--connection master

SET @@GLOBAL.DEBUG='';

--echo #
--echo # Case 5. This will force the Transaction Context to report a valid
--echo # outcome generating a GTID
--echo #

SET @@GLOBAL.DEBUG= '+d,force_positive_certification_outcome_with_gtid';

BEGIN;
INSERT t1 VALUES(3);
COMMIT;

INSERT t1 VALUES(4);

--query_vertical SELECT * FROM t1;

--let $assert_text= GTID_EXECUTED must contain all GTIDs with the server id and with the fake id
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$master_uuid:1-3,$uuida:1-2")
--source include/assert.inc

--source include/sync_slave_sql_with_master.inc

--let $assert_text= GTID_EXECUTED must contain all GTIDs with the server id and with the fake id
--let $assert_cond= GTID_IS_EQUAL(@@GLOBAL.GTID_EXECUTED, "$master_uuid:1-3,$uuida:1-2")
--source include/assert.inc

--echo #
--echo # Clean up
--echo #

--connection master

SET @@GLOBAL.DEBUG= @debug_saved;

DROP TABLE t1;

--source include/rpl_end.inc

--source include/uninstall_replication_observers_example.inc

--echo End of test

Youez - 2016 - github.com/yon3zu
LinuXploit