dbTalk Databases Forums  

Defect Transactions isolation level

comp.databases.mysql comp.databases.mysql


Discuss Defect Transactions isolation level in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
carlo
 
Posts: n/a

Default Defect Transactions isolation level - 09-27-2006 , 06:32 PM






"carlo" <spammer.rea... (AT) googlemail (DOT) com> wrote:

Quote:
Have I found a serious error in mysql's handling of transactions and
threads?

No. You detected your ignor^Wmisunderstanding of MySQL :-)
Thanks for your reply, but lets put your comment to the test.. ! ;-)

Quote:
the code spawns two threads which each reads a column, decrements it by
1 and writes it back... unfortunately both threads reads e.g. 10 and
writes 9... clearly the end result should have been 8! Any comment is
welcome
1. Transactions are supported for InnoDB tables only. You do not
specify the ENGINE in CREATE TABLE. What is the default engine in
your MySQL installation? (the default default is MyISAM)


The table is a innoDB, from version 5 of mysql, as default innoDB is
used.


2. Nobody does SELECT + decrement + UPDATE separately. Just use
UPDATE stock SET physical=physical-1 WHERE id=1
This is atomic and works across all engines.

Of course you just did a test. But keep in mind: atomic operations
save some locks and avoid possible deadlock situations.

yes, that is all nice, but the fact is that such updates are not always
possible. sometimes updates do require many selects and various
interactions with user input which is hard to place in one
transaction.. such as getting user input on several screens before the
update... I just try to simulate real-life situation.



3. You connect to the DBMS as superuser. Never do that (except for
administrative tasks)!

I can hardly believe that should change the functionality of the
transactions... and no my password is not root on my machine!



4. You INSERT into a table without a column list. This is dangerous!
Especially if CREATE TABLE and INSERT are in different parts of the
code. You might change one and forget the other.

its just setting up the test code...



5. Your cut&paste is broken. Class User does not have a start() method.
I guess you meaned run().

no, in java you invoke start() rather than run. Otherwise you do not
get a parallel execution of the code.



Quote:
Axel Schwenke, Senior Software Developer, MySQL AB
Are you working for mysql? I think you should have a serious look at
the jdbc driver implementation for various transactions levels... both
the v3 and v5 drivers are flawed!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.