root@localhost[world]> update t2 set val=42 where id =3805;
ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction
+--------------------------+-------+
| Variable_name | Value |
+--------------------------+-------+
| innodb_lock_wait_timeout | 900 |
+--------------------------+-------+
correction, 24 and 25 hit the same id, an started a transaction. B and C are correct except b is NOT correct if 24 commits before timeout. So C happens. And C happens because the updates happen BEFORE 24 commits.
I see I didn't say the answer. No commit is ever executed, so the transactions are in limbo. So E is the correct answer. Eventually a timeout will occur. Auto commit does not matter when you begin a transaction. Both connections hit the same row, and are not committed, so there are lock.
Auto-commit not been disabled hence it should be able to execute all
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
abpg
2 months agoFelipeK
1 year, 2 months agomarklv
1 year, 3 months agomarklv
1 year, 1 month agomarklv
5 months, 4 weeks agoDhanushka
1 year, 5 months ago