Bug #23175 | MYISAM crash/repair failed during repair | ||
---|---|---|---|
Submitted: | 11 Oct 2006 13:28 | Modified: | 20 Oct 2006 17:41 |
Reporter: | Andrey Hristov | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: MyISAM storage engine | Severity: | S1 (Critical) |
Version: | 5.0.27-BK, 4.1,5.0,5.1 | OS: | Linux (Linux) |
Assigned to: | Sergey Vojtovich | CPU Architecture: | Any |
[11 Oct 2006 13:28]
Andrey Hristov
[12 Oct 2006 14:48]
Valeriy Kravchuk
I had not got any crash with 5.0.27-BK-debug: mysql> REPAIR TABLE t1; +--------+--------+----------+-------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +--------+--------+----------+-------------------------------------------------+ | db2.t1 | repair | error | Internal error: Keys are not in order from sort | | db2.t1 | repair | status | OK | +--------+--------+----------+-------------------------------------------------+ 2 rows in set (1 min 2.99 sec) mysql> select version(); +--------------+ | version() | +--------------+ | 5.0.27-debug | +--------------+ Please, send uname -a results from the system where MySQL server crashed. 1 row in set (0.00 sec)
[12 Oct 2006 20:39]
Sergey Vojtovich
afair it was mysql-4.1 on 32-bit i686 FC5. But anyway repair table error for consistent table matter.
[13 Oct 2006 8:51]
Andrey Hristov
Here is my 5.0 run (pretty fresh tree) mysql> select version(); No connection. Trying to reconnect... Connection id: 1 Current database: db2 +-------------------------------+ | version() | +-------------------------------+ | 5.0.27-valgrind-max-debug-log | +-------------------------------+ 1 row in set (0.00 sec) mysql> drop database if exists db2; ERROR 1010 (HY000): Error dropping database (can't rmdir './db2/', errno: 17) mysql> create database db2; ERROR 1007 (HY000): Can't create database 'db2'; database exists mysql> use db2; Database changed mysql> CREATE TABLE t1(a CHAR(255), KEY(a)); Query OK, 0 rows affected (0.08 sec) mysql> INSERT INTO t1 VALUES(REPEAT('1', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('2', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('3', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('4', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('5', 255)); Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO t1 VALUES(REPEAT('6', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('7', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('8', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('9', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('a', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('b', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('c', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('d', 255)); Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO t1 VALUES(REPEAT('e', 255)); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO t1 VALUES(REPEAT('f', 255)); Query OK, 1 row affected (0.01 sec) mysql> INSERT INTO t1 SELECT * FROM t1; Query OK, 15 rows affected (0.00 sec) Records: 15 Duplicates: 0 Warnings: 0 mysql> INSERT INTO t1 SELECT * FROM t1; Query OK, 30 rows affected (0.01 sec) Records: 30 Duplicates: 0 Warnings: 0 mysql> INSERT INTO t1 SELECT * FROM t1; Query OK, 60 rows affected (0.01 sec) Records: 60 Duplicates: 0 Warnings: 0 mysql> INSERT INTO t1 SELECT * FROM t1; Query OK, 120 rows affected (0.03 sec) Records: 120 Duplicates: 0 Warnings: 0 mysql> SET myisam_sort_buffer_size=4096; Query OK, 0 rows affected (0.00 sec) mysql> SET myisam_repair_threads=2; Query OK, 0 rows affected (0.00 sec) mysql> REPAIR TABLE t1; ERROR 2013 (HY000): Lost connection to MySQL server during query mysql> SET myisam_repair_threads=@@global.myisam_repair_threads; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111) ERROR: Can't connect to the server
[18 Oct 2006 9:09]
Sergey Vojtovich
I was able to make simplier test case which shows, that this affects not only parellel repair, but also regular repair and bulk insert: CREATE TABLE t1(a CHAR(255), KEY(a)); SET myisam_sort_buffer_size=4096; INSERT INTO t1 VALUES ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'),('0'), ('0'),('0'),('0'),('0'),('0'),('0'),('0'); SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size; DROP TABLE t1;
[18 Oct 2006 9:29]
Andrey Hristov
Hi Sergey, yes my observation when tracking down the crashing line was that it happens in the first thread during the first merge of buffers. So, actually it's seems quite possible that it can crash even without threads.
[18 Oct 2006 12:55]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/13866 ChangeSet@1.2530, 2006-10-18 17:57:29+05:00, svoj@mysql.com +3 -0 BUG#23175 - MYISAM crash/repair failed during repair Repair table could crash a server if there is not sufficient memory (myisam_sort_buffer_size) to operate. Affects not only repair, but also all statements that use create index by sort: repair by sort, parallel repair, bulk insert. Return an error if there is not sufficient memory to store at least one key per BUFFPEK. Also fixed memory leak if thr_find_all_keys returns an error.
[20 Oct 2006 9:20]
Ingo Strüwing
Pushed to 5.1.13, 5.0.27, and 4.1.22.
[20 Oct 2006 17:41]
Paul DuBois
Noted in 4.1.22, 5.0.27, 5.1.13 changelogs.
[25 Oct 2006 16:40]
Paul DuBois
The 5.0.x fix is in 5.0.30.