Server IP : 104.21.38.3 / Your IP : 162.158.108.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/engines/rr_trx/t/ |
Upload File : |
################################################################################ # # Executes INSERT ... SELECT statements. # ################################################################################ SET autocommit = 0; START TRANSACTION; # We need this to determine how many rows to update after insert (we may insert mulitple rows). let $pk_before= `SELECT MAX(`pk`) FROM t1`; # Insert rows unless we have duplicate values in unique indexes. # WHERE conditions are more or less arbitrary. --error 0, ER_LOCK_DEADLOCK, ER_LOCK_WAIT_TIMEOUT, ER_CHECKREAD, ER_DUP_ENTRY INSERT INTO t1 (`id`, `int1`, `int1_key`, `int1_unique`, `int2`, `int2_key`, `int2_unique`, `for_update`, `is_uncommitted`, `is_consistent`) SELECT src.`id`, src.`int1`, src.`int1_key`, src.`int1_unique`, src.`int2`, src.`int2_key`, src.`int2_unique`, src.`for_update`, src.`is_uncommitted`, src.`is_consistent` FROM t1 AS src WHERE (src.`pk` BETWEEN 1000 AND 1049) AND (src.`id` > 0) AND (src.`is_consistent` = 1) AND (src.`int1_unique` MOD 8 = 0) ON DUPLICATE KEY UPDATE `int1_unique`= src.`int1_unique` + CONNECTION_ID() + 1000, `int2_unique`= src.`int2_unique` - (CONNECTION_ID()+1000); --source suite/engines/rr_trx/include/check_for_error_rollback.inc # ROW_COUNT may be negative. If positive (and non-zero), update the rows we inserted. let $rows = `SELECT @rows:=ROW_COUNT()`; # Make sure $rows is never negative (to avoid infitite loop below). if(`SELECT IF(@rows < 1, 1, 0)`) { let $rows = 0; } --echo *** Updating id and connection_id if we actually inserted something (query log disabled)... # Conditional, so skip query log --disable_query_log # We risk duplicate entries... in that case @@last_insert_id is 0 while ($rows) { # We actually inserted a row, so update id, conn_id, timestamp --error 0, ER_LOCK_DEADLOCK, ER_LOCK_WAIT_TIMEOUT, ER_CHECKREAD eval UPDATE t1 SET `connection_id` = CONNECTION_ID(), `id` = 2 WHERE `pk` = $pk_before + $rows; --dec $rows } --enable_query_log COMMIT;