Comment #3 on issue 130 by
elisa.fe...@gmail.com: cannot create index
Yes- I tried both with the REPAIR sql command and the myisamchk -r command.
I verified the hard drive is not full. Strangely, the CHECK and myisamchk
-e commands show that the the table is Ok, so I'm perplexed why the table
is marked as crashed.
Here are the REPAIR commands I've issued along with the output:
sudo /usr/local/mysql/bin/myisamchk -r
/usr/local/mysql/data/wiki_20140502/revisions
- recovering (with sort)
MyISAM-table '/usr/local/mysql/data/wiki_20140502/revisions'
Data records: 6926824
- Fixing index 1
mysql> REPAIR Table revisions;
+-------------------------+--------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+-------------------------+--------+----------+----------+
| wiki_20140502.revisions | repair | status | OK |
+-------------------------+--------+----------+----------+
1 row in set (1 min 26.25 sec)
But creating the index still fails:
mysql> CREATE UNIQUE INDEX revisionIdx ON revisions(RevisionID);
ERROR 1194 (HY000): Table 'revisions' is marked as crashed and should be
repaired
Even though the check table is OK:
mysql> CHECK table revisions extended;
+-------------------------+-------+----------+----------+
| Table | Op | Msg_type | Msg_text |
+-------------------------+-------+----------+----------+
| wiki_20140502.revisions | check | status | OK |
+-------------------------+-------+----------+----------+
1 row in set (27.11 sec)
$ sudo /usr/local/mysql/bin/myisamchk -e
/usr/local/mysql/data/wiki_20140502/revisions
Checking MyISAM file: /usr/local/mysql/data/wiki_20140502/revisions
Data records: 6926824 Deleted blocks: 0
- check file-size
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
- check records and index references
I can display the columns in the table:mysql> show columns from revisions;
+-------------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default |
Extra |
+-------------------------+------------------+------+-----+---------+----------------+
| PrimaryKey | int(10) unsigned | NO | PRI | NULL |
auto_increment |
| FullRevisionID | int(10) unsigned | NO | | NULL
| |
| RevisionCounter | int(10) unsigned | NO | | NULL
| |
| RevisionID | int(10) unsigned | NO | | NULL
| |
| ArticleID | int(10) unsigned | NO | | NULL
| |
| Timestamp | bigint(20) | NO | | NULL
| |
| Revision | mediumtext | NO | | NULL
| |
| Comment | mediumtext | YES | | NULL
| |
| Minor | tinyint(4) | NO | | NULL
| |
| ContributorName | text | NO | | NULL
| |
| ContributorId | int(10) unsigned | YES | | NULL
| |
| ContributorIsRegistered | tinyint(4) | NO | | NULL
| |
+-------------------------+------------------+------+-----+---------+----------------+
12 rows in set (0.00 sec)
And I can see the primary key index:
mysql> show index from revisions;
+-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name |
Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
Index_comment |
+-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| revisions | 0 | PRIMARY | 1 | PrimaryKey |
A | 6926824 | NULL | NULL | | BTREE |
| |
+-----------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
1 row in set (0.00 sec)
Sorry this might seem like a mysql issue but I just can't figure out why
the revisions table is having trouble when creating the index. Note that I
can continue to add more wikipedia revisions with the "load data" command
without any issues. It's only creating the index that gives me problems.