Server IP : 104.21.38.3 / Your IP : 162.158.189.18 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/extra/rpl_tests/ |
Upload File : |
# ==== Purpose ==== # # When a client disconnects, temporary tables created by the client # are dropped. This test verifies that this works regardless of what # GTID_NEXT has been set to. # # The following are tested: # # - GTID_NEXT is set and no transaction started. # - GTID_NEXT is set and transaction started but not ended. # - GTID_NEXT is set and transaction committed. # - GTID_NEXT is set and transaction rolled back. # # The test is run both with gtid_mode=on and gtid_mode=off. If # gtid_mode=on, it sets gtid_next='UUID:NUMBER'. If gtid_mode=off, it # sets gtid_next='ANONYMOUS'. # # ==== Implementation ==== # # The core of the logic is: Create a connection. Create a temporary # table on the connection. Set GTID_NEXT. Disconnect. # # The test does this four times, each time doing something different # between set gtid_next and disconnect. # # The test uses include/set_gtid_next_gtid_mode_agnostic.inc to set # gtid_next to 'UUID:NUMBER' if gtid_mode=on and 'ANONYMOUS' if # gtid_mode=off. --source include/not_group_replication_plugin.inc --let $rpl_gtid_utils= 1 --source include/master-slave.inc --let $i= 1 CREATE TABLE t (a INT); while ($i <= 4) { if ($i == 1) { --echo ---- 1. Disconnect after SET GTID_NEXT ---- } if ($i == 2) { --echo ---- 2. Disconnect in the middle of transaction ---- } if ($i == 3) { --echo ---- 3. Disconnect after COMMIT ---- } if ($i == 4) { --echo ---- 4. Disconnect after ROLLBACK ---- } # Create con1. --let $rpl_connection_name= con1 --let $rpl_server_number= 1 --source include/rpl_connect.inc --let $rpl_connection_name= con1 --source include/rpl_connection.inc # Create temp table. CREATE TEMPORARY TABLE tt (a INT); # Set gtid_next --source include/set_gtid_next_gtid_mode_agnostic.inc # Execute (partial) transaction if ($i >= 2) { BEGIN; INSERT INTO t VALUES (1); if ($i == 3) { COMMIT; } if ($i == 4) { ROLLBACK; } } --connection master --source include/save_binlog_position.inc --source include/gtid_step_reset.inc # Disconnect --echo # Disconnecting. --disconnect con1 if (`SELECT @@GLOBAL.binlog_format != 'ROW'`) { # Verify that the binlog contains the expected events. --let $event_sequence= (Anonymous_)?Gtid # !Q(DROP.*TEMPORARY.*) --let $wait_for_binlog_events= 1 --source include/assert_binlog_events.inc } # Sync with slave and assert slave has dropped the temp table. --source include/sync_slave_sql_with_master.inc --let $assert_text= Slave should not have any open temporary tables. --let $assert_cond= VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = "SLAVE_OPEN_TEMP_TABLES" --source include/assert.inc # Verify that one gtid was added if gtid_mode=on --connection master --let $gtid_step_gtid_mode_agnostic= 1 --let $gtid_step_count= 0 if (`SELECT @@GLOBAL.binlog_format != 'ROW'`) { --let $gtid_step_count= 1 } --source include/gtid_step_assert.inc --inc $i } --echo ---- Clean up ---- DROP TABLE t; --source include/sync_slave_sql_with_master.inc --source include/rpl_end.inc