Skip to content
/ server Public

Commit 63a7517

Browse files
Resolved comments
1 parent 19592c6 commit 63a7517

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

mysql-test/suite/innodb/r/deadlock_session_info.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ LOCK WAIT 3 lock struct(s), heap size 1144, 2 row lock(s)
3131
MariaDB thread id TID, OS thread handle TID, query id QID localhost root Statistics
3232
SELECT * FROM t WHERE a = 2 FOR UPDATE
3333
*** WAITING FOR THIS LOCK TO BE GRANTED:
34-
RECORD LOCKS space id 8 page no 3 n bits 320 index PRIMARY of table `test`.`t` trx id TRX_ID lock_mode X locks rec but not gap waiting
35-
Record lock,
34+
RECORD LOCKS space id ID page no 3 n bits 320 index PRIMARY of table `test`.`t` trx id TRX_ID lock_mode X locks rec but not gap waiting
35+
3636
Error 1213 Deadlock found when trying to get lock; try restarting transaction
3737
ROLLBACK;
3838
connection con2;

mysql-test/suite/innodb/t/deadlock_session_info.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ SET debug_dbug = '+d,innodb_deadlock_victim_self';
3131
--error ER_LOCK_DEADLOCK
3232
SELECT * FROM t WHERE a = 2 FOR UPDATE;
3333

34-
--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/TIMESTAMP/ /0x[0-9a-f]+/0xTHD/ /OS thread handle [0-9]+/OS thread handle TID/ /thread id [0-9]+/thread id TID/ /query id [0-9]+/query id QID/ /trx id [0-9]+/trx id TRX_ID/ /TRANSACTION [0-9]+/TRANSACTION TRX_ID/
34+
--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/TIMESTAMP/ /0x[0-9a-f]+/0xTHD/ /OS thread handle [0-9]+/OS thread handle TID/ /thread id [0-9]+/thread id TID/ /query id [0-9]+/query id QID/ /trx id [0-9]+/trx id TRX_ID/ /TRANSACTION [0-9]+/TRANSACTION TRX_ID/ /space id [0-9]+/space id ID/ /Rec.*//
3535
SHOW WARNINGS;
3636

3737
ROLLBACK;

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,9 +2104,8 @@ convert_error_code_to_mysql(
21042104
/* Since we rolled back the whole transaction, the
21052105
cached binlog must be emptied. */
21062106
innodb_transaction_abort(thd, true, error);
2107-
if (error == DB_DEADLOCK)
2108-
return HA_ERR_LOCK_DEADLOCK;
2109-
return HA_ERR_RECORD_CHANGED;
2107+
return error == DB_DEADLOCK
2108+
? HA_ERR_LOCK_DEADLOCK : HA_ERR_RECORD_CHANGED;
21102109

21112110
case DB_LOCK_WAIT_TIMEOUT:
21122111
/* Starting from 5.0.13, we let MySQL just roll back the

storage/innobase/lock/lock0lock.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7309,8 +7309,7 @@ and less modified rows. Bit 0 is used to prefer orig_trx in case of a tie.
73097309

73107310
if (srv_print_all_deadlocks)
73117311
{
7312-
rewind(lock_latest_err_file);
7313-
fseek(lock_latest_err_file, 0, SEEK_END);
7312+
fflush(lock_latest_err_file);
73147313
long file_size= ftell(lock_latest_err_file);
73157314
if (file_size > 0)
73167315
{
@@ -7344,8 +7343,11 @@ and less modified rows. Bit 0 is used to prefer orig_trx in case of a tie.
73447343

73457344
if (deadlock_info && victim == trx && trx->mysql_thd)
73467345
{
7347-
push_warning_printf(trx->mysql_thd, Sql_condition::WARN_LEVEL_NOTE,
7348-
ER_LOCK_DEADLOCK, "%s", deadlock_info);
7346+
while (deadlock_info_len > 0 && deadlock_info[deadlock_info_len - 1] == '\n')
7347+
deadlock_info[--deadlock_info_len]= '\0';
7348+
if (deadlock_info_len > 0)
7349+
push_warning(trx->mysql_thd, Sql_condition::WARN_LEVEL_NOTE,
7350+
ER_LOCK_DEADLOCK, deadlock_info);
73497351
}
73507352
ut_free(deadlock_info);
73517353

0 commit comments

Comments
 (0)