|
Home >> FAQs/Tutorials >> MySQL Tutorials >> Index
MySQL FAQs - Transaction Management: Commit or Rollback
By: FYIcenter.com
Part:
1
2
3
4
5
6
7
8
9
10
(Continued from previous part...)
What Happens to Your Transactions When ERROR 1213 Occurred?
If your transaction receives the "Deadlock found when trying to get lock" - ERROR 1213,
MySQL server automatically terminates your transaction and rolls back your data changes of the entire transaction.
This is why the error messages tells you to "try restarting transaction".
At the same time, locks owned by the terminated (rolled back) transaction will be released.
MySQL server will not touch the other transaction. But the block will be removed, since
the lock owned the terminated transaction is released. The other transaction will be able
to continue normally.
Note that MySQL server automatically detects dead locks and resolved them by rollback actions.
What Are the Impacts on Applications from Locks, Timeouts, and DeadLocks?
If you are using transactions with REPEATABLE READ isolation level and transaction safe storage engines
in your applications, data locks, lock timeouts, and dead lock detections will impact your application
in a concurrent multi-user environment like Web sites in several ways:
- Data Locks - Helping your application to maintain data integrity and keep each user session consistent.
But data locks also slows down your applications, since one user session may need to wait for other sessions
to release locks before continuing some data operations.
- Lock Timeouts - Helping your application to avoid long waits and improve response time to user actions.
But your application code must catch the lock timeout errors, and deal with them properly, like asking your
user to cancel and restart the process.
- Dead Lock Detections - Helping your application to avoid dead user sessions and improve response time to user actions.
But your application code must catch the dead lock errors, and deal with them properly, like asking your
user to cancel and restart the process.
Part:
1
2
3
4
5
6
7
8
9
10
|