List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 19 1999 3:25pm
Subject:ISAMCHK deleted most of my table!
View as plain text  
>>>>> "Sargent" == Sargent Hatch <sarge@stripped> writes:

Sargent> Version: mysql 3.22.21
Sargent> Synopsis: Performing a scheduled and routine ISAMCHK on my table with 533450
Sargent> records wiped out all but 603 records. Since I don't have a clue as to what
Sargent> happened I will provide the log of my actions and hope that someone has seen
Sargent> this before and can offer some advice as to what needs to be done in order
Sargent> to avoid this in the future.

Sargent> ----------------------------------------------------------------
Sargent> [mysql@mysql bin]# isamchk ../data/king/websites2.ISM
Sargent> Checking ISAM file: ../data/king/websites2.ISM
Sargent> Data records:  533450   Deleted blocks:       0
Sargent> - check file-size
Sargent> - check delete-chain
Sargent> - check index reference
Sargent> - check data record references index: 1

Sargent> isamchk: error: Found 533453 keys of 533450
Sargent> - check record links
Sargent> isamchk: error: Keypointers and records dosen't match
Sargent> ISAM-table '../data/king/websites2.ISM' is corrupted
Sargent> Fix it using switch "-r" or "-o"
Sargent> [mysql@mysql bin]#
Sargent> [mysql@mysql bin]# isamchk -r ../data/king/websites2.ISM
Sargent> - recovering ISAM-table '../data/king/websites2.ISM'
Sargent> Data records: 533450
Sargent> - Fixing index 1
Sargent> - Fixing index 2
Sargent> - Fixing index 3
Sargent> isamchk: warning: Dupplicate key for record at  115355606 against record at
Sargent> 111499679
Sargent> isamchk: warning: Dupplicate key for record at  159290416 against record at
Sargent> 131798772
Sargent> isamchk: warning: Dupplicate key for record at  152834934 against record at
Sargent> 149743197
Sargent> isamchk: warning: Dupplicate key for record at  176914176 against record at
Sargent> 48445272
Sargent> Data records: 533446
Sargent> isamchk: warning: 4 records have been removed
Sargent> [mysql@mysql bin]#./mysql king
mysql> select count(id) from websites2;
Sargent> +-----------+
Sargent> | count(id) |
Sargent> +-----------+
Sargent> |       603 |
Sargent> +-----------+
Sargent> 1 row in set (0.00 sec)
Sargent> ----------------------------------------------------------------


Is 'id' a NOT NULL column ?  If not, then it doesn't give you the
number of rows in the table.

Did you run 'mysqladmin flush-tables' after you run isamchk ?


isamchk -dv table_name

This will always give you the correct number of rows in the table. If you get a
different number of rows in MySQL, then your tables on disk is not in
sync with the tables in memory.  mysqladmin flush-tables will force
MySQL to close all tables, which should fix this problem.

ISAMCHK deleted most of my table!Sargent Hatch19 Sep
  • ISAMCHK deleted most of my table!Michael Widenius19 Sep