MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Victoria Reznichenko Date:July 12 2002 10:55am
Subject:Re: Bug with AUTO_INCREMENT
View as plain text  
Steve,
Wednesday, July 10, 2002, 11:12:48 AM, you wrote:

SH> Continuing my troubles with AUTO_INCREMENT (which nobody has yet 
SH> responded to), I've now ruled the Perl DBI out of the equation and 
SH> reproduced the same problem using the "mysql.exe" command-line tool.

SH> Hopefully somebody will be tempted to help this time now that there is 
SH> no Perl involved to put people off?

SH> The bug can be reproduced as follows:

SH> Create the following simple database containing just one BDB table:

SH>     CREATE DATABASE test;

SH>     CREATE TABLE foo (
SH>        id INT NOT NULL AUTO_INCREMENT,
SH>        num INT,
SH>        str VARCHAR(10),
SH>        PRIMARY KEY (id)
SH>     ) TYPE=BDB;

SH> Now start two "mysql.exe" sessions running with the "-f" flag to ignore 
SH> errors.

SH> Set each one into "no auto-commit" mode with:

SH>     SET AUTOCOMMIT=0;

SH> and then feed each of them the following two lines 50,000 times each:

SH>     INSERT INTO foo (num, str) VALUES (1, 'a');
SH>     COMMIT;

[skip]

SH> When I inspect the output collected in these log files I find, not 
SH> unexpectedly, that there are many "deadlock" errors (which I'm quite 
SH> comfortable with, and can handle in my real software by simply retrying 
SH> the transaction), but that there are also a few of the following error:

SH>     Duplicate entry '1' for key 1

SH> Surely this is a bug isn't it?

SH> The transaction that is being performed 50,000 times each by the two 
SH> "mysql.exe" sessions doesn't specify any value for the AUTO_INCREMENT 
SH> column "id" - it just leaves it up to the database to choose the "next" 
SH> value.

SH> This error suggests that the database has wrongly chosen the value '1', 
SH> and then (rightly) complains that it is already used!

SH> I would really appreciate a response on this one as I'm now at the end 
SH> of my tether trying to work out what is wrong.

Steve, I tested your example with PHP script, but I didn't get any
Duplicate entry error ...
(I tested with BDB tables and SET AUTOCOMMIT=0).




-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   Victoria.Reznichenko@stripped
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com



Thread
Bug with AUTO_INCREMENTSteve Hay10 Jul
  • Re: Bug with AUTO_INCREMENTRichard Fox10 Jul
  • Re: Bug with AUTO_INCREMENTSteve Hay10 Jul
    • Re: Bug with AUTO_INCREMENTThomas Spahni10 Jul
  • Re: Bug with AUTO_INCREMENTVictoria Reznichenko12 Jul
  • Re: Bug with AUTO_INCREMENTSteve Hay12 Jul
Re: Bug with AUTO_INCREMENTSteve Hay10 Jul
Re: Bug with AUTO_INCREMENTMark Matthews10 Jul
Re: Bug with AUTO_INCREMENTSteve Hay12 Jul