| 1 |
################################################################################ |
| 2 |
# |
| 3 |
# UPDATE using multiple statements. Subtract a value (4) from one field, then |
| 4 |
# add the same value to another field in the same row. |
| 5 |
# |
| 6 |
# Mind any tx errors, ROLLBACK if needed to "equalize" different engines. |
| 7 |
# |
| 8 |
################################################################################ |
| 9 |
|
| 10 |
SET autocommit = 0; |
| 11 |
START TRANSACTION; |
| 12 |
eval SET @conn_id = CONNECTION_ID(), @thread_id = 0; |
| 13 |
|
| 14 |
--error 0, ER_LOCK_DEADLOCK, ER_LOCK_WAIT_TIMEOUT, ER_CHECKREAD |
| 15 |
UPDATE t1 SET `int1` = `int1` - 4, |
| 16 |
`id` = 4, |
| 17 |
`is_consistent` = 0, |
| 18 |
`connection_id` = @conn_id, |
| 19 |
`thread_id` = @thread_id |
| 20 |
WHERE `pk` = 4; |
| 21 |
|
| 22 |
--source suite/engines/rr_trx/include/check_for_error_rollback.inc |
| 23 |
|
| 24 |
--echo *** UPDATEing row with pk = 4 and `int1_key` +=4 if above statement succeeded (query log disabled)... |
| 25 |
|
| 26 |
if (!$error) |
| 27 |
{ |
| 28 |
# This is conditional, so disable query log to avoid irrelevant diffs. |
| 29 |
--disable_query_log |
| 30 |
--error 0, ER_LOCK_DEADLOCK, ER_LOCK_WAIT_TIMEOUT, ER_CHECKREAD |
| 31 |
UPDATE t1 SET `int1_key` = `int1_key` + 4, |
| 32 |
`is_consistent` = 1, |
| 33 |
`connection_id` = @conn_id, |
| 34 |
`thread_id` = @thread_id |
| 35 |
WHERE `pk` = 4; |
| 36 |
|
| 37 |
--source suite/engines/rr_trx/include/check_for_error_rollback.inc |
| 38 |
--enable_query_log |
| 39 |
} |
| 40 |
|
| 41 |
COMMIT; |