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

RENAME INDEX corrupts index

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 10.6.22, 10.11.13
    • N/A
    • Server
    • None
    • Not for Release Notes

    Description

      Executing RENAME INDEX on InnoDB tables, where the index name is only changed in its case
      (from lower to upper or vice versa),
      corrupts the index, making the table inaccessible.

      Affected Versions tested:

      MariaDB 10.6.22

      MariaDB 10.11.3

      Steps to Reproduce:

       
      create schema andre;
      use andre
      CREATE or replace TABLE `andre_tab` (
        `id` int(11) NOT NULL,
        `col1` int(11) DEFAULT NULL,
        PRIMARY KEY (`id`),
        KEY `MYIDX` (`col1`)
        ) engine=innodb;
        
        alter table andre_tab rename index MYIDX to myidx;
      

      Metadata reports corruption:

      select table_schema,table_name,index_name,index_type from information_schema.statistics where table_schema='andre';
      +--------------+------------+------------+------------+
      | table_schema | table_name | index_name | index_type |
      +--------------+------------+------------+------------+
      | andre        | andre_tab  | PRIMARY    | BTREE      |
      | andre        | andre_tab  | myidx      | Corrupted  |
      +--------------+------------+------------+------------+
      2 rows in set, 2 warnings (0.001 sec)
       
      MariaDB [andre]> show warnings;
      +---------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
      | Level   | Code | Message                                                                                                                                 |
      +---------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
      | Warning | 1082 | InnoDB: Table andre/andre_tab contains 2 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB  |
      | Warning | 1082 | InnoDB: Table andre/andre_tab contains 2 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB  |
      +---------+------+-----------------------------------------------------------------------------------------------------------------------------------------+
      

      Error log reports:

       
      2025-10-13 11:01:45 42632 [ERROR] Cannot find index myidx in InnoDB index dictionary.
      2025-10-13 11:01:45 42632 [ERROR] InnoDB indexes are inconsistent with what defined in .frm for table ./andre/andre_tab
      2025-10-13 11:01:45 42632 [ERROR] InnoDB could not find key no 1 with name myidx from dict cache for table andre/andre_tab
      2025-10-13 11:01:45 42632 [ERROR] InnoDB: Table andre/andre_tab contains 2 indexes inside InnoDB, which is different from the number of indexes 2 defined in the .frm file. See https://mariadb.com/kb/en/innodb-troubleshooting/
       
      2025-10-13 11:01:45 42632 [ERROR] InnoDB could not find key no 1 with name myidx from dict cache for table andre/andre_tab
      2025-10-13 11:01:45 42632 [ERROR] InnoDB: Table andre/andre_tab contains 2 indexes inside InnoDB, which is different from the number of indexes 2 defined in the .frm file. See https://mariadb.com/kb/en/innodb-troubleshooting/
       
      2025-10-13 11:01:45 42632 [ERROR] InnoDB could not find key no 1 with name myidx from dict cache for table andre/andre_tab
      
      

      and trying to use the table:

      MariaDB [andre]> select * from andre_tab;
      ERROR 1030 (HY000): Got error 1 "Operation not permitted" from storage engine InnoDB
      MariaDB [andre]> 
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              andrea.ponzo Andrea Ponzo
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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