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

ER_NOT_KEYFILE or assertion failure upon REPLACE into table with unique hash under READ-COMMITTED

    XMLWordPrintable

Details

    • Not for Release Notes

    Description

      --source include/have_innodb.inc
       
      SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
       
      CREATE TABLE t (id INT NOT NULL PRIMARY KEY, f TEXT) ENGINE=InnoDB;
      INSERT INTO t VALUES (1,'x');
      ALTER TABLE t ADD UNIQUE (f);
      REPLACE INTO t VALUES (2,'x');
       
      DROP TABLE t;
      

      10.6 bfcd2674a3b20b105393970d3937cdc18f43ce23

      mysqltest: At line 8: query 'REPLACE INTO t VALUES (2,'x')' failed: ER_NOT_KEYFILE (1034): Index for table 't' is corrupt; try to repair it
      

      On a table with partitioning a debug build fails on an assertion.

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
       
      CREATE TABLE t (id INT NOT NULL PRIMARY KEY, f TEXT) ENGINE=InnoDB PARTITION BY HASH(id) PARTITIONS 2;
      INSERT INTO t VALUES (1,'x');
      ALTER TABLE t ADD UNIQUE (f);
      REPLACE INTO t VALUES (2,'x');
       
      DROP TABLE t;
      

      10.6 bfcd2674a3b20b105393970d3937cdc18f43ce23

      mariadbd: /data/bld/10.6-asan-ubsan/sql/handler.cc:3607: int handler::ha_rnd_pos(uchar*, uchar*): Assertion `inited == RND' failed.
      250717 23:12:12 [ERROR] /share8t/bld/10.6-asan-ubsan/sql/mariadbd got signal 6 ;
       
      #10 0x00007fd062c53eb2 in __GI___assert_fail (assertion=0x557b3f93e840 "inited == RND", file=0x557b3f937c20 "/data/bld/10.6-asan-ubsan/sql/handler.cc", line=3607, function=0x557b3f93ea60 "int handler::ha_rnd_pos(uchar*, uchar*)") at ./assert/assert.c:101
      #11 0x0000557b3cf48395 in handler::ha_rnd_pos (this=this@entry=0x6250002b7a30, buf=buf@entry=0x6210000df8c0 "\374\002", pos=pos@entry=0x6210000df892 "\002") at /data/bld/10.6-asan-ubsan/sql/handler.cc:3607
      #12 0x0000557b3de8d3ee in ha_partition::rnd_pos (this=0x6250002b7148, buf=<optimized out>, pos=0x6210000df890 "") at /data/bld/10.6-asan-ubsan/sql/ha_partition.cc:5531
      #13 0x0000557b3cf88d64 in handler::ha_write_row (this=this@entry=0x6250002b7148, buf=<optimized out>) at /data/bld/10.6-asan-ubsan/sql/handler.cc:7778
      #14 0x0000557b3bb8b64c in write_record (thd=thd@entry=0x62b0000bd218, table=table@entry=0x6190000b4a98, info=info@entry=0x7fd0535c7c30, sink=sink@entry=0x0) at /data/bld/10.6-asan-ubsan/sql/sql_insert.cc:1933
      #15 0x0000557b3bbce161 in mysql_insert (thd=thd@entry=0x62b0000bd218, table_list=<optimized out>, fields=..., values_list=..., update_fields=..., update_values=..., duplic=<optimized out>, ignore=<optimized out>, result=<optimized out>) at /data/bld/10.6-asan-ubsan/sql/sql_insert.cc:1170
      #16 0x0000557b3bd5c13a in mysql_execute_command (thd=thd@entry=0x62b0000bd218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/10.6-asan-ubsan/sql/sql_parse.cc:4634
      #17 0x0000557b3bd76cf2 in mysql_parse (thd=thd@entry=0x62b0000bd218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fd0535c8ac0) at /data/bld/10.6-asan-ubsan/sql/sql_parse.cc:8200
      #18 0x0000557b3bd7ffc2 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62b0000bd218, packet=packet@entry=0x629000276219 "REPLACE INTO t VALUES (2,'x')", packet_length=packet_length@entry=29, blocking=blocking@entry=true) at /data/bld/10.6-asan-ubsan/sql/sql_parse.cc:1908
      #19 0x0000557b3bd8cc14 in do_command (thd=thd@entry=0x62b0000bd218, blocking=blocking@entry=true) at /data/bld/10.6-asan-ubsan/sql/sql_parse.cc:1421
      #20 0x0000557b3c50e6dc in do_handle_one_connection (connect=<optimized out>, connect@entry=0x60800001c938, put_in_cache=put_in_cache@entry=true) at /data/bld/10.6-asan-ubsan/sql/sql_connect.cc:1386
      #21 0x0000557b3c50f839 in handle_one_connection (arg=0x60800001c938) at /data/bld/10.6-asan-ubsan/sql/sql_connect.cc:1298
      #22 0x0000557b3df3f811 in pfs_spawn_thread (arg=0x617000007e98) at /data/bld/10.6-asan-ubsan/storage/perfschema/pfs.cc:2201
      #23 0x00007fd062ca81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #24 0x00007fd062d2885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure started happening after this commit in 10.6:

      commit 9703c90712f33014b9f222c08e272e898937a1bb
      Author: Sergei Golubchik
      Date:   Fri Jul 11 15:49:53 2025 +0200
       
          MDEV-37199 UNIQUE KEY USING HASH accepting duplicate records
      

      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.