List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:April 24 2001 6:08pm
Subject:Re: duplicate key error on autoincrement field while inserting
View as plain text  
What operating system are you running, and how big are these files and
indicies?

Is this a 2 Gig file size limit problem?

You are getting near the limit to the size of an unsigned mediumint.


Dan Shapella wrote:
> 
> I have a weird one here.
> 
> I have an application that inserts records into one of 2 different tables.
> The other day, an insert attempt on one of the tables failed with a
> duplicate key error on key 1, an autoincrement field.  About a minute later,
> an insert attempt on the other table failed similarly.  But, when a SELECT
> was done on each table for the key value in question, no record was found.
> 
> The autoincrement values in question were 16288908 for the first table, and
> 11339940 for the second table.  These tables handle thousands of inserts per
> day, and all other table activity is read-only via SELECT statements.
> 
> Does anyone have any idea what may have caused this and what can be done to
> prevent it?  It is as if MySQL built the record with key value 16288908,
> placed it in the table cache, built another record with the same key, tried
> to place that in the table cache and failed, reported the error, and then
> deleted the record from the table cache before it was written into the
> actual table.
> 
> I did a "myisamchk -i" on the first table, which generated the following:
> 
> Checking MyISAM file: attempt.MYI
> Data records: 16288907   Deleted blocks:       0
> /usr/local/bin/myisamchk: warning: Table is marked as crashed
> /usr/local/bin/myisamchk: warning: 1 clients is using or hasn't closed the
> table properly
> - check file-size
> - check key delete-chain
> - check record delete-chain
> - check index reference
> - check data record references index: 1
> /usr/local/bin/myisamchk: error: Found key at page 280732672 that points to
> record outside datafile
> - check record links
> /usr/local/bin/myisamchk: error: Checksum for key:  1 doesn't match checksum
> for records
> /usr/local/bin/myisamchk: error: Checksum for key:  2 doesn't match checksum
> for records
> 
> Record blocks:    16288907    Delete blocks:         0
> Record data:    1829202488    Deleted data:          0
> Lost space:       12006835    Linkdata:       61081997
> MyISAM-table 'attempt.MYI' is corrupted
> Fix it using switch "-r" or "-o"
> 
> Any suggestions would be greatly appreciated. Thanks!
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <mysql-thread72314@stripped>
> To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Thread
duplicate key error on autoincrement field while insertingDan Shapella24 Apr
  • Re: duplicate key error on autoincrement field while insertingGerald Clark24 Apr
Re: duplicate key error on autoincrement field while insertingDan Shapella24 Apr