Server IP : 172.67.216.182 / Your IP : 172.69.176.171 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/innodb/t/ |
Upload File : |
--source include/have_innodb.inc --source include/have_debug.inc # Save the initial number of concurrent sessions --source include/count_sessions.inc SET @debug_saved = @@global.debug; --echo START TRANSACTION; --echo CREATE TABLE t1(a INT PRIMARY KEY AUTO_INCREMENT, b VARCHAR(255)) engine = innodb; --echo INSERT INTO t1(b) VALUES ('aaa'); INSERT INTO t1(b) VALUES ('bbb'); INSERT INTO t1(b) VALUES ('ccc'); --echo COMMIT; ########################################################################### --echo --echo # 1. Start outer transaction with SERIALIZABLE isolation level. --echo # Check that SELECT in inner transaction will not take locks. --echo --echo # Start transaction. SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; START TRANSACTION; --echo # Insert a new row into t1. INSERT INTO t1(b) VALUES ('ddd'); SELECT * FROM t1; --echo --echo # [another connection] --connect (con1,localhost,root,,) --echo SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; START TRANSACTION; SET @@global.debug = '+d,use_attachable_trx'; SELECT * FROM t1; SET @@global.debug = '-d,use_attachable_trx'; --disconnect con1 --echo --echo # [default connection] --connection default --echo ROLLBACK; ########################################################################### --echo --echo # 2. Check that inner transaction has different visibility scope than --echo # the outer transaction. --echo # Start READ ONLY transaction. SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; START TRANSACTION READ ONLY; --echo # SELECT to actually start a transaction. SELECT * FROM t1; --echo --echo # [another connection] --connect (con1,localhost,root,,) --echo START TRANSACTION; UPDATE t1 SET b = 'zzz' WHERE a = 2; COMMIT; --disconnect con1 --echo --echo # [default connection] --connection default --echo --echo # SELECT in the outer transaction doesn't see the changes. SELECT * FROM t1; --echo --echo # SELECT in the inner transaction sees the changes. SET @@global.debug = '+d,use_attachable_trx'; SELECT * FROM t1; SET @@global.debug = '-d,use_attachable_trx'; --echo --echo # COMMIT the outer transaction. COMMIT; --echo # SELECT in the outer transaction now sees the changes. SELECT * FROM t1; COMMIT; ########################################################################### --echo --echo # 3. Check that the inner transaction does not reset a save point set in --echo # the outer transaction. --echo --echo # Start transaction. SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; START TRANSACTION; SELECT * FROM t1; --echo --echo # Set save point. SAVEPOINT sp1; --echo --echo # Do some changes. UPDATE t1 SET b = 'xxx' WHERE a = 2; SELECT * FROM t1; --echo --echo # Do anything in the inner transaction. SET @@global.debug = '+d,use_attachable_trx'; SELECT * FROM t1; SET @@global.debug = '-d,use_attachable_trx'; --echo --echo # Just make sure the changes are still there. SELECT * FROM t1; --echo --echo # Rollback to the save point to make sure it was not reset. ROLLBACK TO SAVEPOINT sp1; --echo --echo # Check that the changes have been reverted. SELECT * FROM t1; --echo --echo # Commit. COMMIT; ########################################################################### --echo --echo # Cleanup. DROP TABLE t1; --echo SET @@global.debug = @debug_saved; # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc