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

DROP TABLE on table with vector key not atomic, leads to ER_NO_SUCH_TABLE_IN_ENGINE

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • N/A
    • 11.7
    • Vector search
    • None

    Description

      In the scenario below, a foreign key referencing a table with vector key prevents the table from being dropped (expectedly); however, the vector key tablespace gets deleted anyway, and the further use of the key causes ER_NO_SUCH_TABLE_IN_ENGINE:

      --source include/have_innodb.inc
       
      --let $datadir= `select @@datadir`
       
      CREATE TABLE t1 (pk INT PRIMARY KEY, v VECTOR(1) NOT NULL, VECTOR(v)) ENGINE=InnoDB;
      --list_files $datadir/test/ t1*
      CREATE TABLE t2 (a INT, FOREIGN KEY (a) REFERENCES t1 (pk)) ENGINE=InnoDB;
      --error ER_ROW_IS_REFERENCED_2
      DROP TABLE t1;
      SHOW CREATE TABLE t1;
      --list_files $datadir/test/ t1*
      INSERT INTO t1 VALUES (1,0x31313131);
       
      # Cleanup
      DROP TABLE t2, t1;
      

      bb-11.6-MDEV-32887-vector c29016301f7095ccc482fdfec1887f61e5adbed1

      CREATE TABLE t1 (pk INT PRIMARY KEY, v VECTOR(1) NOT NULL, VECTOR(v)) ENGINE=InnoDB;
      t1#i#01.ibd
      t1.frm
      t1.ibd
      CREATE TABLE t2 (a INT, FOREIGN KEY (a) REFERENCES t1 (pk)) ENGINE=InnoDB;
      DROP TABLE t1;
      ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
      SHOW CREATE TABLE t1;
      Table	Create Table
      t1	CREATE TABLE `t1` (
        `pk` int(11) NOT NULL,
        `v` vector(1) NOT NULL,
        PRIMARY KEY (`pk`),
        VECTOR KEY `v` (`v`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
      t1.frm
      t1.ibd
      INSERT INTO t1 VALUES (1,0x31313131);
      

      mysqltest: At line 12: query 'INSERT INTO t1 VALUES (1,0x31313131)' failed: ER_NO_SUCH_TABLE_IN_ENGINE (1932): Table 'test.t1' doesn't exist in engine
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.