473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Deadlock handling in InnoDB

I was hoping someone could confirm my understanding of how InnoDB
handles deadlocks (error 1213) and timeouts (error 1206). The way I
understand it, with AUTOCOMMIT=0, if I issue 3 SQL statements
(updates), A, B, and C (in that order), and get one of the errors above
while issuing statement C, InnoDB will have rolled back statements A
and B. To recover from this error condition, I need to re-issue
statements A and B, followed by C. Then, if all three go through, I
can call COMMIT and have A, B, and C committed. Is this correct?

Thank you in advance,

Alex

Sep 7 '05 #1
2 3504
Alex wrote:
I was hoping someone could confirm my understanding of how InnoDB
handles deadlocks (error 1213) and timeouts (error 1206). The way I
understand it, with AUTOCOMMIT=0, if I issue 3 SQL statements
(updates), A, B, and C (in that order), and get one of the errors above
while issuing statement C, InnoDB will have rolled back statements A
and B. To recover from this error condition, I need to re-issue
statements A and B, followed by C. Then, if all three go through, I
can call COMMIT and have A, B, and C committed. Is this correct?


Read these pages:
http://dev.mysql.com/doc/mysql/en/in...-handling.html
http://dev.mysql.com/doc/mysql/en/in...detection.html

"A transaction deadlock or a timeout in a lock wait causes InnoDB to
roll back the whole transaction."

That seems to support your understanding. Yes, if statement C in your
scenario causes a deadlock or timeout error, then the whole transaction
is rolled back. This includes the uncommitted work done in the same
transaction by the statements A and B.

The documentation admits that this behavior is not in accordance with
the SQL standard.

Regards,
Bill K.
Sep 7 '05 #2
Thank you, Bill. My understanding comes from the same docs you're
citing. I at one point was misinterpreting the above, thinking that
only statement C would need to be re-issued, so wanted to confirm that
my newfangled interpretation was correct. Sounds like there's at least
one other person who understands it the same way I do. :-)

Can anyone else offer a 'definitive' confirmation or refutal?

Thank you in advance,

Alex

Sep 7 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andy Tran | last post by:
I built a system using mysql innodb to archive SMS messages but the innodb databases are not keeping up with the number of SMS messages coming in. I'm looking for performance of 200 msgs/sec where...
5
by: Eddie | last post by:
I have a MySQL-server running Innodb. We have installed ~ 2GB of memory in the server. In spite of this MySQL keeps crashing due to out-of-memory errors. The server is a dual xeon i686 running...
0
by: steven | last post by:
In both mysql version 4.0.16 and 4.1.8 I'm running into deadlock behavior that I don't understand: can anyone explain why the following happens? Heres a basic table definition that exhibits the...
2
by: Hugo Flores | last post by:
Hi, I'm getting a deadlock on my database. Let me first tell you that this is a test database on a Win XP Professional. The SP where I'm getting the deadlock is this: PROCEDURE...
0
by: fuzzybr80 | last post by:
Hi, I am working with an application with a high rate of inserts/updates/deletes into a particular table, and recently am getting the following error code. My table uses InnoDB engine. ERROR...
0
by: cwho.work | last post by:
Hi! We are using apache ibatis with our MySQL 5.0 database (using innodb tables), in our web application running on Tomcat 5. Recently we started getting a number of errors relating to...
2
by: Dragan | last post by:
Hi, We're working in VS 2005, Team edition, if it makes any difference at all (should be up-to-date and all that, but could not guarantee it is 100%). We've implemented a simple generic wrapper...
1
by: DennBen | last post by:
I am doing an update to set a field value = anothe field value (in the same table) where it is not supplied. I'm handling this in the trigger, but am getting deadlocks. Do you see anything...
0
by: Caper | last post by:
Hello everyone, I am a bit confused about Innodb deadlock and the "SELECT…FOR UPDATE” statement. 1. Here is a deadlock example 1) Create actor table CREATE TABLE actor(actor_id INT...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.