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

Bogus "Incorrect information in file" upon failed attempt to add a long unique key

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t (id INT AUTO_INCREMENT, a VARCHAR(1024), PRIMARY KEY(id)) ENGINE=MyISAM;
      ALTER TABLE t ADD UNIQUE(id,a);
      

      Since the commit below, the ALTER fails. Judging by the commit comment, it's intentional.

      10.4 d352bc5b

      mysqltest: At line 2: query 'ALTER TABLE t ADD UNIQUE(id,a)' failed: 1901: Function or expression 'AUTO_INCREMENT' cannot be used in the USING HASH clause of `id`
      

      commit 1fdac574470a5103dde689c8ce65041487e77f2c (origin/bb-10.4-nikita)
      Author: Nikita Malyavin
      Date:   Thu Oct 28 03:37:23 2021 +0300
       
          MDEV-26453 Assertion `0' failed in row_upd_sec_index_entry & corruption
          
          Long UNIQUE HASH index silently creates virtual column index, which should
          be impossible for base columns featuring AUTO_INCREMENT.
          
          Fix: add a relevant check; add new vcol type for a prettier error message.
      

      However, on 10.4, in addition to the error returned in the client, there is also an error written to the log:

      2021-12-10  3:48:48 4 [ERROR] mysqld: Incorrect information in file: './test/#sql-2588c5_4.frm'
      

      This error typically indicates corruption which in this case is (hopefully) a false alarm. If so, it shouldn't be there.

      It doesn't happen on 10.5+, only on 10.4. Maybe it's related to 10.5+ returning a different error upon ALTER, ER_NO_AUTOINCREMENT_WITH_UNIQUE instead of ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED.

        Attachments

          Activity

            People

            Assignee:
            nikitamalyavin Nikita Malyavin
            Reporter:
            elenst Elena Stepanova
            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.