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

Unexpected ER_DUP_KEY after OPTIMIZE on MyISAM table with vector key

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • N/A
    • 11.7.1
    • Vector search
    • None

    Description

      CREATE TABLE t (v VECTOR(1) NOT NULL DEFAULT 0x30303030, VECTOR(v)) ENGINE=MyISAM;
      INSERT INTO t () VALUES (),(),(),();
      DELETE FROM t LIMIT 1;
      OPTIMIZE TABLE t;
      INSERT INTO t SELECT * FROM t;
       
      # Cleanup
      DROP TABLE t;
      

      bb-11.6-MDEV-32887-vector c29016301f7095ccc482fdfec1887f61e5adbed1

      mysqltest: At line 5: query 'INSERT INTO t SELECT * FROM t' failed: ER_DUP_KEY (1022): Can't write; duplicate key in table 't'
      

      One of non-obvious post-effects is a replication abort – not on the erroneous INSERT, but on the next one:

      --source include/have_binlog_format_row.inc
      --source include/master-slave.inc
       
      CREATE TABLE t (v VECTOR(1) NOT NULL DEFAULT 0x30303030, VECTOR(v)) ENGINE=MyISAM;
      INSERT INTO t () VALUES (),(),(),();
      DELETE FROM t LIMIT 1;
      OPTIMIZE TABLE t;
      --error ER_DUP_KEY
      INSERT INTO t SELECT * FROM t;
      INSERT INTO t SELECT * FROM t;
       
      --sync_slave_with_master
       
      # Cleanup
      --connection master
      DROP TABLE t;
      --source include/rpl_end.inc
      

      2024-10-21 14:00:23 7 [ERROR] Slave SQL: Could not execute Write_rows_v1 event on table test.t; Can't write; duplicate key in table 't', Error_code: 1022; handler error HA_ERR_FOUND_DUPP_KEY; the event's master log master-bin.000001, end_log_pos 0, Gtid 0-1-5, Internal MariaDB error code: 1022
      2024-10-21 14:00:23 7 [Warning] Slave: Can't write; duplicate key in table 't' Error_code: 1022
      

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              elenst Elena Stepanova
              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.