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

Errors or assertion failure upon REPAIR on partitioned Aria table with misplaced rows

    XMLWordPrintable

Details

    Description

      The problem likely exists in earlier versions, however I cannot create a meaningful test case for it before 11.4. In 11.4, after MDEV-22164, it becomes a legal chain of events: an operation can be performed without validation and end up with inconsistency in partitions, which is supposed to be fixable by REPAIR TABLE – but in this case it isn't.
      Please adjust affected/fix versions as needed.

      --source include/have_partition.inc
       
      CREATE TABLE t (a INT KEY) ENGINE=Aria PARTITION BY LIST (a) (
        PARTITION p0 VALUES IN (1,2),
        PARTITION p1 VALUES IN (3,4)
      );
       
      CREATE TABLE t1 (a INT KEY) ENGINE=Aria;
      INSERT INTO t1 VALUES (1);
      INSERT INTO t1 VALUES (3);
      ALTER TABLE t EXCHANGE PARTITION p0 WITH TABLE t1 WITHOUT VALIDATION;
      REPAIR TABLE t;
       
      # Cleanup
      DROP TABLE t, t1;
      

      11.4 non-debug 875377ad824473774c833b1aff4346ba3133f092

      REPAIR TABLE t;
      Table	Op	Msg_type	Msg_text
      test.t	repair	error	Partition p0 returned error
      test.t	repair	Error	Got error '126 "Index is corrupted"' for './test/t#P#p0.MAI'
      test.t	repair	error	Unknown - internal error 126 during operation
      Warnings:
      Note	4173	Engine Aria does not support rollback. Changes were committed during rollback call
      

      2024-01-05 16:26:23 4 [ERROR] mariadbd: Got error '126 "Index is corrupted"' for './test/t#P#p0.MAI'
      2024-01-05 16:26:23 4 [ERROR] Table '                                                                                                                                                                                               t': Delete from part 0 failed with error 126. But it was already inserted into part 1, when moving the misplaced row!
      Please manually fix the duplicate row:
       a:3
      

      11.4 debug 875377ad824473774c833b1aff4346ba3133f092

      mariadbd: /data/bld/11.4-asan/storage/maria/ma_key.c:106: transid_store_packed: Assertion `trid >= info->s->state.create_trid' failed.
      240105 16:27:53 [ERROR] mysqld got signal 6 ;
       
      #8  0x00007fe1ae045395 in __assert_fail_base (fmt=0x7fe1ae1b9a90 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x559b55404e60 "trid >= info->s->state.create_trid", file=file@entry=0x559b55404dc0 "/data/bld/11.4-asan/storage/maria/ma_key.c", line=line@entry=106, function=function@entry=0x559b55405320 <__PRETTY_FUNCTION__.3> "transid_store_packed") at ./assert/assert.c:92
      #9  0x00007fe1ae053e32 in __GI___assert_fail (assertion=0x559b55404e60 "trid >= info->s->state.create_trid", file=0x559b55404dc0 "/data/bld/11.4-asan/storage/maria/ma_key.c", line=106, function=0x559b55405320 <__PRETTY_FUNCTION__.3> "transid_store_packed") at ./assert/assert.c:101
      #10 0x0000559b53b5929e in transid_store_packed (info=0x6290002bc218, to=0x6290002c0a0e "", trid=390) at /data/bld/11.4-asan/storage/maria/ma_key.c:106
      #11 0x0000559b53b5aea2 in _ma_make_key (info=0x6290002bc218, int_key=0x7fe1a40c8050, keynr=0, key=0x6290002c0a09 "", record=0x6190000a28e8 "\377\003", filepos=257, trid=390) at /data/bld/11.4-asan/storage/maria/ma_key.c:327
      #12 0x0000559b53bd0db0 in maria_delete (info=0x6290002bc218, record=0x6190000a28e8 "\377\003") at /data/bld/11.4-asan/storage/maria/ma_delete.c:88
      #13 0x0000559b53a67c1a in ha_maria::delete_row (this=0x61d0002882b8, buf=0x6190000a28e8 "\377\003") at /data/bld/11.4-asan/storage/maria/ha_maria.cc:2516
      #14 0x0000559b5357e12f in handler::ha_delete_row (this=0x61d0002882b8, buf=0x6190000a28e8 "\377\003") at /data/bld/11.4-asan/sql/handler.cc:8000
      #15 0x0000559b53cd9c4a in ha_partition::check_misplaced_rows (this=0x61d0002878b8, read_part_id=0, do_repair=true) at /data/bld/11.4-asan/sql/ha_partition.cc:11405
      #16 0x0000559b53c89fb3 in ha_partition::handle_opt_part (this=0x61d0002878b8, thd=0x62c0000c0218, check_opt=0x62c0000c59c8, part_id=0, flag=4) at /data/bld/11.4-asan/sql/ha_partition.cc:1409
      #17 0x0000559b53c8af67 in ha_partition::handle_opt_partitions (this=0x61d0002878b8, thd=0x62c0000c0218, check_opt=0x62c0000c59c8, flag=4) at /data/bld/11.4-asan/sql/ha_partition.cc:1569
      #18 0x0000559b53c89827 in ha_partition::repair (this=0x61d0002878b8, thd=0x62c0000c0218, check_opt=0x62c0000c59c8) at /data/bld/11.4-asan/sql/ha_partition.cc:1321
      #19 0x0000559b5356485e in handler::ha_repair (this=0x61d0002878b8, thd=0x62c0000c0218, check_opt=0x62c0000c59c8) at /data/bld/11.4-asan/sql/handler.cc:5243
      #20 0x0000559b531026a7 in mysql_admin_table (thd=0x62c0000c0218, tables=0x6290000e6310, check_opt=0x62c0000c59c8, operator_name=0x559b56188c40 <msg_repair>, lock_type=TL_WRITE, org_open_for_modify=true, repair_table_use_frm=false, extra_open_options=32, prepare_func=0x559b530fd46b <prepare_for_repair(THD*, TABLE_LIST*, HA_CHECK_OPT*)>, operator_func=(int (handler::*)(handler * const, THD *, HA_CHECK_OPT *)) 0x559b535647d8 <handler::ha_repair(THD*, st_ha_check_opt*)>, view_operator_func=0x559b52fb78d1 <view_repair(THD*, TABLE_LIST*, st_ha_check_opt*)>, is_cmd_replicated=true) at /data/bld/11.4-asan/sql/sql_admin.cc:917
      #21 0x0000559b53108c88 in Sql_cmd_repair_table::execute (this=0x6290000e6a38, thd=0x62c0000c0218) at /data/bld/11.4-asan/sql/sql_admin.cc:1642
      #22 0x0000559b52c13c76 in mysql_execute_command (thd=0x62c0000c0218, is_called_from_prepared_stmt=false) at /data/bld/11.4-asan/sql/sql_parse.cc:5786
      #23 0x0000559b52c2113d in mysql_parse (thd=0x62c0000c0218, rawbuf=0x6290000e6238 "REPAIR TABLE t", length=14, parser_state=0x7fe1a40cc9f0) at /data/bld/11.4-asan/sql/sql_parse.cc:7798
      #24 0x0000559b52bf8792 in dispatch_command (command=COM_QUERY, thd=0x62c0000c0218, packet=0x629000249219 "", packet_length=14, blocking=true) at /data/bld/11.4-asan/sql/sql_parse.cc:1893
      #25 0x0000559b52bf54ca in do_command (thd=0x62c0000c0218, blocking=true) at /data/bld/11.4-asan/sql/sql_parse.cc:1406
      #26 0x0000559b530c6b80 in do_handle_one_connection (connect=0x608000002d38, put_in_cache=true) at /data/bld/11.4-asan/sql/sql_connect.cc:1417
      #27 0x0000559b530c6541 in handle_one_connection (arg=0x608000002cb8) at /data/bld/11.4-asan/sql/sql_connect.cc:1319
      #28 0x0000559b53ced56a in pfs_spawn_thread (arg=0x617000005b98) at /data/bld/11.4-asan/storage/perfschema/pfs.cc:2201
      #29 0x00007fe1ae0a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #30 0x00007fe1ae12861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              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.