[MDEV-31588] MyISAM: ERROR 126 (HY000): Index for table ... is corrupt followed by ERROR 145 (HY000): Table ... is marked as crashed when using key_cache_segments=1, and 'Got an error from unknown thread' in error log Created: 2023-06-30  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Data Definition - Temporary, Storage Engine - MyISAM
Affects Version/s: 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1

Type: Bug Priority: Minor
Reporter: Roel Van de Paar Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: corruption, unknown_thread


 Description   

CREATE TEMPORARY TABLE t (a INT KEY) ENGINE=MyISAM;
SET GLOBAL key_cache_segments=1;
INSERT INTO t VALUES (1);
SET GLOBAL key_cache_segments=1;
INSERT INTO t VALUES (1);
SET max_session_mem_used=8912;
ALTER TABLE t CHANGE COLUMN a a CHAR(1);
SELECT * FROM t;

Leads to:

11.1.2 3883eb63dc5e663558571c33d086c9fd3aa0cf8f (Debug)

11.1.2-dbg>CREATE TEMPORARY TABLE t (a INT KEY) ENGINE=MyISAM;
Query OK, 0 rows affected (0.002 sec)
 
11.1.2-dbg>SET GLOBAL key_cache_segments=1;
Query OK, 0 rows affected (0.131 sec)
 
11.1.2-dbg>INSERT INTO t VALUES (1);
Query OK, 1 row affected (0.000 sec)
 
11.1.2-dbg>SET GLOBAL key_cache_segments=1;
Query OK, 0 rows affected (0.026 sec)
 
11.1.2-dbg>INSERT INTO t VALUES (1);
ERROR 126 (HY000): Index for table '-mariadb-11.1.2-linux-x86_64-dbg/data/#sql-temptable-b22-4-0.MYI' is corrupt; try to repair it
11.1.2-dbg>SET max_session_mem_used=8912;
Query OK, 0 rows affected (0.001 sec)
 
11.1.2-dbg>ALTER TABLE t CHANGE COLUMN a a CHAR(1);
ERROR 1290 (HY000): The MariaDB server is running with the --max-session-mem-used=8912 option so it cannot execute this statement
11.1.2-dbg>SELECT * FROM t;
ERROR 145 (HY000): Table '0623-mariadb-11.1.2-linux-x86_64-dbg/data/#sql-temptable-b22-4-0' is marked as crashed and should be repaired

And:

11.1.2 3883eb63dc5e663558571c33d086c9fd3aa0cf8f (Debug)

Version: '11.1.2-MariaDB-debug'  socket: '/test/MD220623-mariadb-11.1.2-linux-x86_64-dbg/socket.sock'  port: 12294  MariaDB Server
2023-06-30 14:29:24 4 [ERROR] mariadbd: Index for table 'riadb-11.1.2-linux-x86_64-dbg/data/#sql-temptable-1971bd-4-0.MYI' is corrupt; try to repair it
2023-06-30 14:29:24 4 [ERROR] mariadbd: Index for table 'riadb-11.1.2-linux-x86_64-dbg/data/#sql-temptable-1971bd-4-0.MYI' is corrupt; try to repair it
2023-06-30 14:29:24 4 [ERROR] Got an error from unknown thread, /test/11.1_dbg/storage/myisam/mi_write.c:226
2023-06-30 14:29:24 4 [ERROR] mariadbd: Index for table 't' is corrupt; try to repair it

Bug confirmed present in:
MariaDB: 10.4.31 (dbg), 10.4.31 (opt), 10.5.22 (dbg), 10.5.22 (opt), 10.6.15 (dbg), 10.6.15 (opt), 10.9.8 (dbg), 10.9.8 (opt), 10.10.6 (dbg), 10.10.6 (opt), 10.11.5 (dbg), 10.11.5 (opt), 11.0.3 (dbg), 11.0.3 (opt), 11.1.2 (dbg), 11.1.2 (opt)

Bug (or feature/syntax) confirmed not present in:
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.40 (dbg), 8.0.33 (dbg), 8.0.33 (opt)



 Comments   
Comment by Oleksandr Byelkin [ 2023-09-26 ]

I think it is just general error whyn keycache can not read index due to unreal low memory restriction.

Generated at Thu Feb 08 10:25:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.