Server IP : 172.67.216.182 / Your IP : 172.70.208.141 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/binlog/r/ |
Upload File : |
# ==== Initialize ==== CREATE TABLE t1 (a INT); CREATE TABLE t2 (a INT); PREPARE stmt1 FROM 'INSERT INTO t1 VALUES (1)'; CREATE PROCEDURE p1 () BEGIN INSERT INTO t2 VALUES(2); END $ CREATE PROCEDURE p2 () BEGIN EXECUTE stmt1; END $ # ==== Case 1 ==== # Test case to verify gtid_next update with prepared statement re-prepare. SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:1'; BEGIN; EXECUTE stmt1; COMMIT; SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:2'; TRUNCATE TABLE t1; SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:3'; # Without fix, following statement execution fails. EXECUTE stmt1; # ==== Case 2 ==== # Test case to verify gtid_next update with stored procedure statement # re-prepare. SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:4'; CALL p1(); SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:5'; TRUNCATE TABLE t2; SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:6'; # Without fix, following statement execution fails. CALL p1(); # ==== Case 3 ==== # Test case to verify gtid_next update with prepared statement re-prepare # in stored procedure. SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:7'; CALL p2(); SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:8'; TRUNCATE TABLE t1; SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:9'; # Without fix, following statement execution fails. CALL p2(); # === Case 4 === # Test case to verify gtid_next update with prepared statement max # re-prepare attempt hits. SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:10'; TRUNCATE TABLE t1; # Adding debug point 'simulate_max_reprepare_attempts_hit_case' to @@SESSION.debug SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:11'; # Error is reported when max re-prepare limit is hit. Transaction is # rolled back and gtid_next is updated. EXECUTE stmt1; ERROR HY000: Prepared statement needs to be re-prepared INSERT INTO t1 VALUES(10); ERROR HY000: When @@SESSION.GTID_NEXT is set to a GTID, you must explicitly set it to a different value after a COMMIT or ROLLBACK. Please check GTID_NEXT variable manual page for detailed explanation. Current @@SESSION.GTID_NEXT is 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:11'. # === Case 5 === # Test case to verify gtid_next update with stored procedure statement # max re-prepare attempt hits. SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:12'; TRUNCATE TABLE t2; SET gtid_next = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:13'; # Error is reported when max re-prepare limit is hit. Transaction is # rolled back and gtid_next is updated. CALL p1; ERROR HY000: Prepared statement needs to be re-prepared INSERT INTO t2 VALUES(10); ERROR HY000: When @@SESSION.GTID_NEXT is set to a GTID, you must explicitly set it to a different value after a COMMIT or ROLLBACK. Please check GTID_NEXT variable manual page for detailed explanation. Current @@SESSION.GTID_NEXT is 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa:13'. # ==== Cleanup ==== SET gtid_next = DEFAULT; # Removing debug point 'simulate_max_reprepare_attempts_hit_case' from @@SESSION.debug DEALLOCATE PREPARE stmt1; DROP TABLE t1, t2; DROP PROCEDURE p1; DROP PROCEDURE p2;