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

Unexpected ER_DUP_ENTRY upon dropping PK column from system-versioned table

    XMLWordPrintable

Details

    Description

      Test case 1 - with IGNORE

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      INSERT INTO t1 VALUES (1,2),(2,8),(3,4),(4,4),(5,0);
      DELETE FROM t1;
      SET system_versioning_alter_history= KEEP;
      ALTER IGNORE TABLE t1 DROP pk;
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 77ffbbca non-debug

      2021-04-02 00:46:46 0x7f38612c1700  InnoDB: Assertion failure in file /data/src/10.3/storage/innobase/row/row0ins.cc line 221
      InnoDB: Failing assertion: !cursor->index->is_committed()
       
      #6  0x0000556bb31f48f4 in ut_dbg_assertion_failed (expr=expr@entry=0x556bb3c341a0 "!cursor->index->is_committed()", file=file@entry=0x556bb3c33cc8 "/data/src/10.3/storage/innobase/row/row0ins.cc", line=line@entry=221) at /data/src/10.3/storage/innobase/ut/ut0dbg.cc:60
      #7  0x0000556bb31dfe2c in row_ins_sec_index_entry_by_modify (mtr=0x7f38612bba40, thr=0x7f38100682b0, entry=<optimized out>, heap=0x7f3810068e20, offsets_heap=<optimized out>, offsets=0x7f38612bad48, cursor=0x7f38612badb0, mode=2, flags=0) at /data/src/10.3/storage/innobase/row/row0ins.cc:221
      #8  row_ins_sec_index_entry_low (flags=<optimized out>, mode=2, index=0x7f3810066708, offsets_heap=<optimized out>, heap=<optimized out>, entry=<optimized out>, trx_id=<optimized out>, thr=<optimized out>) at /data/src/10.3/storage/innobase/row/row0ins.cc:3090
      #9  0x0000556bb373f2eb in row_ins_sec_index_entry (index=0x7f3810066708, entry=0x7f3810157690, thr=0x7f38100682b0, check_foreign=<optimized out>) at /data/src/10.3/storage/innobase/row/row0ins.cc:3287
      #10 0x0000556bb37416f1 in row_ins_index_entry (thr=0x7f38100682b0, entry=<optimized out>, index=<optimized out>) at /data/src/10.3/storage/innobase/row/row0ins.cc:3334
      #11 row_ins_index_entry_step (thr=0x7f38100682b0, node=<optimized out>) at /data/src/10.3/storage/innobase/row/row0ins.cc:3483
      #12 row_ins (thr=0x7f3810066708, node=<optimized out>) at /data/src/10.3/storage/innobase/row/row0ins.cc:3642
      #13 row_ins_step (thr=thr@entry=0x7f38100682b0) at /data/src/10.3/storage/innobase/row/row0ins.cc:3788
      #14 0x0000556bb37530d0 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x7f381002f928 "\375\004", prebuilt=0x7f3810067b08, ins_mode=ROW_INS_NORMAL) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1418
      #15 0x0000556bb369d479 in ha_innobase::write_row (this=0x7f38100652a0, record=0x7f381002f928 "\375\004") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8131
      #16 0x0000556bb34f58b1 in handler::ha_write_row (this=0x7f38100652a0, buf=0x7f381002f928 "\375\004") at /data/src/10.3/sql/handler.cc:6478
      #17 0x0000556bb338a71e in copy_data_between_tables (thd=0x7f3810000c48, from=0x7f38101547d8, to=0x7f3810066ee8, create=..., ignore=true, order_num=<optimized out>, order=0x0, copied=0x7f38612bcf80, deleted=0x7f38612bcf88, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7f38612bd9c0) at /data/src/10.3/sql/sql_table.cc:10662
      #18 0x0000556bb3391ca6 in mysql_alter_table (thd=thd@entry=0x7f3810000c48, new_db=new_db@entry=0x7f3810005170, new_name=new_name@entry=0x7f3810005558, create_info=create_info@entry=0x7f38612be580, table_list=<optimized out>, table_list@entry=0x7f381000f810, alter_info=alter_info@entry=0x7f38612be4c0, order_num=0, order=0x0, ignore=true) at /data/src/10.3/sql/sql_table.cc:10091
      #19 0x0000556bb33e50ff in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x7f3810000c48) at /data/src/10.3/sql/sql_alter.cc:512
      #20 0x0000556bb32ef510 in mysql_execute_command (thd=<optimized out>) at /data/src/10.3/sql/sql_parse.cc:6078
      #21 0x0000556bb32f6563 in mysql_parse (thd=0x7f3810000c48, rawbuf=<optimized out>, length=<optimized out>, parser_state=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.3/sql/sql_parse.cc:7871
      #22 0x0000556bb32f893d in dispatch_command (command=COM_QUERY, thd=0x7f3810000c48, packet=<optimized out>, packet_length=<optimized out>, is_com_multi=<optimized out>, is_next_command=<optimized out>) at /data/src/10.3/sql/sql_class.h:1152
      #23 0x0000556bb32fa91d in do_command (thd=0x7f3810000c48) at /data/src/10.3/sql/sql_parse.cc:1398
      #24 0x0000556bb33e2466 in do_handle_one_connection (connect=connect@entry=0x556bb58a9e68) at /data/src/10.3/sql/sql_connect.cc:1403
      #25 0x0000556bb33e263f in handle_one_connection (arg=arg@entry=0x556bb58a9e68) at /data/src/10.3/sql/sql_connect.cc:1308
      #26 0x0000556bb39bff46 in pfs_spawn_thread (arg=0x556bb5892568) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #27 0x00007f38685eb609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #28 0x00007f38681e0293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      10.3 77ffbbca debug

      mysqld: /data/src/10.3/storage/innobase/row/row0ins.cc:3652: dberr_t row_ins(ins_node_t*, que_thr_t*): Assertion `!strcmp(index->name, "FTS_DOC_ID_INDEX")' failed.
      210402  0:45:29 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fe70ce40f36 in __GI___assert_fail (assertion=0x55e67faadad0 "!strcmp(index->name, \"FTS_DOC_ID_INDEX\")", file=0x55e67faabdf0 "/data/src/10.3/storage/innobase/row/row0ins.cc", line=3652, function=0x55e67faada80 "dberr_t row_ins(ins_node_t*, que_thr_t*)") at assert.c:101
      #8  0x000055e67f2ebbcb in row_ins (node=0x7fe6b812c3a0, thr=0x7fe6b812c608) at /data/src/10.3/storage/innobase/row/row0ins.cc:3652
      #9  0x000055e67f2ec424 in row_ins_step (thr=0x7fe6b812c608) at /data/src/10.3/storage/innobase/row/row0ins.cc:3788
      #10 0x000055e67f3135a6 in row_insert_for_mysql (mysql_rec=0x7fe6b8074950 "\375\002", prebuilt=0x7fe6b812be40, ins_mode=ROW_INS_NORMAL) at /data/src/10.3/storage/innobase/row/row0mysql.cc:1418
      #11 0x000055e67f175bfb in ha_innobase::write_row (this=0x7fe6b812b238, record=0x7fe6b8074950 "\375\002") at /data/src/10.3/storage/innobase/handler/ha_innodb.cc:8131
      #12 0x000055e67ef45ac9 in handler::ha_write_row (this=0x7fe6b812b238, buf=0x7fe6b8074950 "\375\002") at /data/src/10.3/sql/handler.cc:6478
      #13 0x000055e67ecfae5e in copy_data_between_tables (thd=0x7fe6b8000d90, from=0x7fe6b80b9810, to=0x7fe6b8073d00, create=..., ignore=true, order_num=0, order=0x0, copied=0x7fe701fcb130, deleted=0x7fe701fcb138, keys_onoff=Alter_info::LEAVE_AS_IS, alter_ctx=0x7fe701fcb940) at /data/src/10.3/sql/sql_table.cc:10662
      #14 0x000055e67ecf8d0b in mysql_alter_table (thd=0x7fe6b8000d90, new_db=0x7fe6b8005478, new_name=0x7fe6b8005860, create_info=0x7fe701fcc530, table_list=0x7fe6b8012bb8, alter_info=0x7fe701fcc470, order_num=0, order=0x0, ignore=true) at /data/src/10.3/sql/sql_table.cc:10091
      #15 0x000055e67ed89226 in Sql_cmd_alter_table::execute (this=0x7fe6b8013240, thd=0x7fe6b8000d90) at /data/src/10.3/sql/sql_alter.cc:512
      #16 0x000055e67ec1388d in mysql_execute_command (thd=0x7fe6b8000d90) at /data/src/10.3/sql/sql_parse.cc:6078
      #17 0x000055e67ec18f42 in mysql_parse (thd=0x7fe6b8000d90, rawbuf=0x7fe6b8012ad8 "ALTER IGNORE TABLE t1 DROP pk", length=29, parser_state=0x7fe701fcd5c0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7871
      #18 0x000055e67ec055d6 in dispatch_command (command=COM_QUERY, thd=0x7fe6b8000d90, packet=0x7fe6b8008f31 "ALTER IGNORE TABLE t1 DROP pk", packet_length=29, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
      #19 0x000055e67ec03f76 in do_command (thd=0x7fe6b8000d90) at /data/src/10.3/sql/sql_parse.cc:1398
      #20 0x000055e67ed830bd in do_handle_one_connection (connect=0x55e68276e110) at /data/src/10.3/sql/sql_connect.cc:1403
      #21 0x000055e67ed82e19 in handle_one_connection (arg=0x55e68276e110) at /data/src/10.3/sql/sql_connect.cc:1308
      #22 0x000055e67f754de7 in pfs_spawn_thread (arg=0x55e682750f80) at /data/src/10.3/storage/perfschema/pfs.cc:1869
      #23 0x00007fe70d352609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #24 0x00007fe70cf2c293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Test case 2 - without IGNORE

      --source include/have_innodb.inc
       
      CREATE TABLE t1 (pk INT, a INT, PRIMARY KEY (pk), KEY (a)) ENGINE=InnoDB WITH SYSTEM VERSIONING;
      INSERT INTO t1 VALUES (1,2),(2,8),(3,4),(4,4),(5,0);
      DELETE FROM t1;
      SET system_versioning_alter_history= KEEP;
      ALTER TABLE t1 DROP pk;
       
      # Cleanup
      DROP TABLE t1;
      

      10.3 77ffbbca

      mysqltest: At line 7: query 'ALTER TABLE t1 DROP pk' failed: 1062: Duplicate entry '' for key 'PRIMARY'
      

      The failures appeared in 10.3 after this commit:

      commit af52a0e516aa044b7fcdf91b3d2a7036c6c7ae9f b9d1c6574b845ddf843dd5a8e506593e74352c69
      Author:     Aleksey Midenkov
      AuthorDate: Fri Feb 5 01:52:21 2021 +0300
      CommitDate: Wed Mar 31 21:25:33 2021 +0300
       
          MDEV-24690 Dropping primary key column from versioned table always fails with 1072
      

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.