Hi ,
Here is the current deadlock log I meeted recent days:
In my understanding, delete/update statement will only apply the X lock to change the record.
Is the situation as a common deadlock?
*** (1) TRANSACTION: --T1
TRANSACTION 5E11A2B67, ACTIVE 0 sec, process no 7948, OS thread id 1556810048 starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 376, 1 row lock(s)
MySQL thread id 1258846, query id 231368675 192.168.8.101 user1 Updating
UPDATE TB1 SET updated_time=NOW() WHERE id=287605 and updated_time<='2013-08-25 09:18:25'
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 758 page no 5 n bits 80 index `PRIMARY` of table `DB3`.`TB1` trx id 5E11A2B67 lock_mode X locks rec but not gap waiting
*** (2) TRANSACTION: --T2
TRANSACTION 5E11A2B66, ACTIVE 0 sec, process no 7948, OS thread id 1504360768 starting index read
mysql tables in use 1, locked 1
4 lock struct(s), heap size 1248, 2 row lock(s), undo log entries 1
MySQL thread id 1264549, query id 231368678 192.168.8.102 user1 updating
DELETE FROM TB1 WHERE id = 287605
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 758 page no 5 n bits 80 index `PRIMARY` of table `DB3`.`YTB1` trx id 5E11A2B66 lock mode S locks rec but not gap
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 758 page no 5 n bits 80 index `PRIMARY` of table `DB3`.`TB1` trx id 5E11A2B66 lock_mode X locks rec but not gap waiting
*** WE ROLL BACK TRANSACTION (1)
mysql> show variables like "%iso%";
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| tx_isolation | REPEATABLE-READ |
+---------------+-----------------+
Here is the current deadlock log I meeted recent days:
In my understanding, delete/update statement will only apply the X lock to change the record.
Is the situation as a common deadlock?
*** (1) TRANSACTION: --T1
TRANSACTION 5E11A2B67, ACTIVE 0 sec, process no 7948, OS thread id 1556810048 starting index read
mysql tables in use 1, locked 1
LOCK WAIT 2 lock struct(s), heap size 376, 1 row lock(s)
MySQL thread id 1258846, query id 231368675 192.168.8.101 user1 Updating
UPDATE TB1 SET updated_time=NOW() WHERE id=287605 and updated_time<='2013-08-25 09:18:25'
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 758 page no 5 n bits 80 index `PRIMARY` of table `DB3`.`TB1` trx id 5E11A2B67 lock_mode X locks rec but not gap waiting
*** (2) TRANSACTION: --T2
TRANSACTION 5E11A2B66, ACTIVE 0 sec, process no 7948, OS thread id 1504360768 starting index read
mysql tables in use 1, locked 1
4 lock struct(s), heap size 1248, 2 row lock(s), undo log entries 1
MySQL thread id 1264549, query id 231368678 192.168.8.102 user1 updating
DELETE FROM TB1 WHERE id = 287605
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 758 page no 5 n bits 80 index `PRIMARY` of table `DB3`.`YTB1` trx id 5E11A2B66 lock mode S locks rec but not gap
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 758 page no 5 n bits 80 index `PRIMARY` of table `DB3`.`TB1` trx id 5E11A2B66 lock_mode X locks rec but not gap waiting
*** WE ROLL BACK TRANSACTION (1)
mysql> show variables like "%iso%";
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| tx_isolation | REPEATABLE-READ |
+---------------+-----------------+