- ------------------------
- LATEST detected DEADLOCK
- ------------------------
- 140824 1:01:24
- (1) TRANSACTION:
- TRANSACTION 110E, active starting SEC index Read # # transaction id=110E, active 73s
- MySQL tables in use 1, locked 1
- Lock WAIT 3 lock struct (s), Heap size 376, 2 row lock (s) # # There are 2 row locks
- MySQL thread ID 1, OS thread handle 0x7f55ea639700, query ID bayi localhost root updating # # threads for the transaction id=1
- Delete from T1 where a=1 # # This is the SQL that the current transaction executes
- (1) Waiting for the lock to be granted: # # above SQL waits for the locking information
- RECORD LOCKS Space ID page No 3 n bits index ' PRIMARY ' of table ' test '. ' T1 ' Trx ID 110E lock_mode X LOCKS Rec But no T gap waiting
- Record Lock, Heap No 2 physical record:n_fields 4; Compact format; Info bits 32 # # Wait on the primary key on page num=3 with an X lock (not gap waiting), lock the bits
- 0:len 4; Hex 80000001; ASC;;
- 1:len 6; Hex 00000000110c; ASC;;
- 2:len 7; Hex 0d000002350084; ASC 5;;
- 3:len 4; Hex 80000001; ASC;;
- (2) TRANSACTION:
- TRANSACTION 110C, active 1716 SEC starting index read, thread declared inside InnoDB 500 # # transactions id=110C, active 1716s /c1>
- MySQL tables in use 1, locked 1
- 3 lock struct (s), Heap size 376, 2 row lock (s), undo log Entries 1 # # 3 lock, 2 row lock, 1 undo Log
- MySQL thread ID 2, OS thread handle 0x7f563c05e700, query ID of updating localhost root # # # threads for the transaction id=2
- Delete from T1 where a=3 # # This is the SQL that the current transaction executes
- (2) holds the Lock (S): # # This transaction holds the lock information
- RECORD LOCKS Space ID page No 3 n bits index ' PRIMARY ' of table ' test '. ' T1 ' Trx ID 110C lock_mode X LOCKS Rec But no T gap
- Record Lock, Heap No 2 physical record:n_fields 4; Compact format; Info bits 32 # # on the primary key on page num=3 already holds an X lock (not gap), lock the bits
- 0:len 4; Hex 80000001; ASC;;
- 1:len 6; Hex 00000000110c; ASC;;
- 2:len 7; Hex 0d000002350084; ASC 5;;
- 3:len 4; Hex 80000001; ASC;;
- (2) Waiting for the lock to be granted: # # at the same time this transaction also waits for the locking information
- RECORD LOCKS Space ID page No 3 n bits index ' PRIMARY ' of table ' test '. ' T1 ' Trx ID 110C lock_mode X LOCKS Rec But no T gap waiting
- Record Lock, Heap No 3 physical record:n_fields 4; Compact format; Info bits 0 # # also waits on page num= 3 on the primary key to have an X lock (not gap waiting), lock the bits
- 0:len 4; Hex 80000003; ASC;;
- 1:len 6; Hex 000000000f71; ASC q;;
- 2:len 7; Hex ed0000022f0090; ASC/;;
- 3:len 4; Hex 80000003; ASC;;
- WE Roll Back TRANSACTION (1) # # Here Choose ROLLBACK TRANSACTION 110E.
- In other words, this deadlock uses SQL in transaction 110E without execution and rolls back:
- Delete from T1 where a=1
- The SQL in transaction 110C is executed normally:
- Delete from T1 where a=3
MySQL Deadlock Log Analysis