Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-33444

MyISAM: ERROR 126 (HY000): Index for table './test/t.MYI' is corrupt; try to repair it on INSERT

Details

    Description

      MTR/CLI testcase (works as given in both):

      SET GLOBAL delay_key_write=ALL;
      CREATE TABLE t (c INT KEY) ENGINE=MyISAM;
      SET GLOBAL key_cache_segments=10;
      INSERT INTO t VALUES (1);
      SET GLOBAL key_cache_segments=10, GLOBAL table_open_cache=1024;
      INSERT INTO t VALUES (1);
      

      Leads to:

      11.4.0 9b1ea6904965dd345478dedd80e181ad54c767da (Debug)

      11.4.0-dbg>INSERT INTO t VALUES (1);
      ERROR 126 (HY000): Index for table './test/t.MYI' is corrupt; try to repair it
      

      11.4.0 9b1ea6904965dd345478dedd80e181ad54c767da (Debug)

      2024-02-12 14:15:23 4 [ERROR] mariadbd: Index for table './test/t.MYI' is corrupt; try to repair it               
      2024-02-12 14:15:23 4 [ERROR] mariadbd: Index for table './test/t.MYI' is corrupt; try to repair it               2024-02-12 14:15:23 4 [ERROR] Got an error from thread_id=4, /test/11.4_dbg/storage/myisam/mi_write.c:226         2024-02-12 14:15:23 4 [ERROR] MariaDB thread id 4, OS thread handle 23084779529792, query id 8 localhost root Update                                                                                                                
      INSERT INTO t VALUES (1)                                                                                          2024-02-12 14:15:23 4 [ERROR] mariadbd: Index for table 't' is corrupt; try to repair it   
      

      Attachments

        Activity

          Roel Roel Van de Paar added a comment - - edited

          This testcase variation:

          SET GLOBAL delay_key_write=ALL;
          CREATE TABLE t (c INT KEY) ENGINE=MyISAM;
          SET GLOBAL key_cache_segments=10;
          INSERT INTO t VALUES (1);
          SET GLOBAL key_cache_segments=10; 
          INSERT INTO t VALUES (1);
          SET GLOBAL table_open_cache=1024;
          INSERT INTO t VALUES (1);
          

          Results in further output:

          11.4.0 9b1ea6904965dd345478dedd80e181ad54c767da (Debug)

          2024-02-12 16:54:32 4 [ERROR] mariadbd: Index for table './test/t.MYI' is corrupt; try to repair it
          2024-02-12 16:54:32 4 [ERROR] mariadbd: Index for table './test/t.MYI' is corrupt; try to repair it
          2024-02-12 16:54:32 4 [ERROR] Got an error from thread_id=4, /test/11.4_dbg/storage/myisam/mi_write.c:226
          2024-02-12 16:54:32 4 [ERROR] MariaDB thread id 4, OS thread handle 23089213228608, query id 8 localhost root Update
          INSERT INTO t VALUES (1)
          2024-02-12 16:54:32 4 [ERROR] mariadbd: Index for table 't' is corrupt; try to repair it
          2024-02-12 16:54:33 4 [ERROR] mariadbd: Table './test/t' is marked as crashed and should be repaired
          2024-02-12 16:54:33 4 [Warning] Checking table:   './test/t'
          2024-02-12 16:54:33 4 [Warning] Recovering table: './test/t'
          2024-02-12 16:54:33 4 [Note] mariadbd: Making backup of data file ./test/t.MYD with extension '-240212165433.BAK'
          

          ./data/test/t.MYD-240212165433.BAK exists thereafter.
          Perhaps it also makes sense to include the full table name?

          Roel Roel Van de Paar added a comment - - edited This testcase variation: SET GLOBAL delay_key_write= ALL ; CREATE TABLE t (c INT KEY ) ENGINE=MyISAM; SET GLOBAL key_cache_segments=10; INSERT INTO t VALUES (1); SET GLOBAL key_cache_segments=10; INSERT INTO t VALUES (1); SET GLOBAL table_open_cache=1024; INSERT INTO t VALUES (1); Results in further output: 11.4.0 9b1ea6904965dd345478dedd80e181ad54c767da (Debug) 2024-02-12 16:54:32 4 [ERROR] mariadbd: Index for table './test/t.MYI' is corrupt; try to repair it 2024-02-12 16:54:32 4 [ERROR] mariadbd: Index for table './test/t.MYI' is corrupt; try to repair it 2024-02-12 16:54:32 4 [ERROR] Got an error from thread_id=4, /test/11.4_dbg/storage/myisam/mi_write.c:226 2024-02-12 16:54:32 4 [ERROR] MariaDB thread id 4, OS thread handle 23089213228608, query id 8 localhost root Update INSERT INTO t VALUES (1) 2024-02-12 16:54:32 4 [ERROR] mariadbd: Index for table 't' is corrupt; try to repair it 2024-02-12 16:54:33 4 [ERROR] mariadbd: Table './test/t' is marked as crashed and should be repaired 2024-02-12 16:54:33 4 [Warning] Checking table: './test/t' 2024-02-12 16:54:33 4 [Warning] Recovering table: './test/t' 2024-02-12 16:54:33 4 [Note] mariadbd: Making backup of data file ./test/t.MYD with extension '-240212165433.BAK' ./data/test/t.MYD-240212165433.BAK exists thereafter. Perhaps it also makes sense to include the full table name?

          People

            monty Michael Widenius
            Roel Roel Van de Paar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.