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

Assertion failures upon partition pruning and HANDLER operations

    XMLWordPrintable

Details

    Description

      Note: the test cases look excessive – insert, delete, select from empty table, update empty table – but I couldn't remove anything anymore, maybe they can be further reduced after analysis.

      Test case 1 - fails on 10.4+ debug builds

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      CREATE TABLE t (a INT, b INT, KEY (b)) ENGINE=InnoDB PARTITION BY HASH (a) PARTITIONS 4;
      INSERT INTO t VALUES (1,1);
      DELETE FROM t ORDER BY b LIMIT 1;
      SELECT * FROM t;
      UPDATE t PARTITION (p1) SET a = 1 WHERE a = 8;
      HANDLER t OPEN;
      HANDLER t READ b NEXT;
      HANDLER t READ b NEXT;
       
      # Cleanup
      HANDLER t CLOSE;
      DROP TABLE t;
      

      10.4 ba94778d2c438d4c0f93ce031e504f7d78e895e1

      mysqld: /data/bld/10.4-asan/sql/ha_partition.cc:7495: int ha_partition::handle_unordered_next(uchar*, bool): Assertion `0' failed.
      231214 17:23:17 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fc850053e32 in __GI___assert_fail (assertion=0x556dc1368b00 "0", file=0x556dc1369f20 "/data/bld/10.4-asan/sql/ha_partition.cc", line=7495, function=0x556dc1372500 "int ha_partition::handle_unordered_next(uchar*, bool)") at ./assert/assert.c:101
      #10 0x0000556dbfd9848d in ha_partition::handle_unordered_next (this=0x61d0002580a8, buf=0x6190000dcae8 "\377", is_next_same=false) at /data/bld/10.4-asan/sql/ha_partition.cc:7495
      #11 0x0000556dbfd88b2a in ha_partition::index_next (this=0x61d0002580a8, buf=0x6190000dcae8 "\377") at /data/bld/10.4-asan/sql/ha_partition.cc:6001
      #12 0x0000556dbf5a6daa in handler::ha_index_next (this=0x61d0002580a8, buf=0x6190000dcae8 "\377") at /data/bld/10.4-asan/sql/handler.cc:3011
      #13 0x0000556dbed22f14 in mysql_ha_read (thd=0x62b00009a208, tables=0x62b0000a13c0, mode=RNEXT, keyname=0x62b0000a1ab8 "b", key_expr=0x0, ha_rkey_mode=HA_READ_KEY_EXACT, cond=0x0, select_limit_cnt=1, offset_limit_cnt=0) at /data/bld/10.4-asan/sql/sql_handler.cc:894
      #14 0x0000556dbedf55a2 in mysql_execute_command (thd=0x62b00009a208) at /data/bld/10.4-asan/sql/sql_parse.cc:5750
      #15 0x0000556dbee0488f in mysql_parse (thd=0x62b00009a208, rawbuf=0x62b0000a1228 "HANDLER t READ b NEXT", length=21, parser_state=0x7fc83a120c60, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:8062
      #16 0x0000556dbedda8ea in dispatch_command (command=COM_QUERY, thd=0x62b00009a208, packet=0x62900028f209 "", packet_length=21, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:1857
      #17 0x0000556dbedd7459 in do_command (thd=0x62b00009a208) at /data/bld/10.4-asan/sql/sql_parse.cc:1378
      #18 0x0000556dbf1de023 in do_handle_one_connection (connect=0x608000000ba8) at /data/bld/10.4-asan/sql/sql_connect.cc:1419
      #19 0x0000556dbf1dd93a in handle_one_connection (arg=0x608000000ba8) at /data/bld/10.4-asan/sql/sql_connect.cc:1323
      #20 0x0000556dbfe429fe in pfs_spawn_thread (arg=0x615000006208) at /data/bld/10.4-asan/storage/perfschema/pfs.cc:1869
      #21 0x00007fc8500a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #22 0x00007fc85012861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Test case 2 - fails on 10.6+ debug and non-debug builds

      --source include/have_innodb.inc
      --source include/have_partition.inc
       
      CREATE TABLE t (a INT, b INT, KEY (b)) ENGINE=InnoDB PARTITION BY HASH (a) PARTITIONS 4;
      INSERT INTO t VALUES (1,1);
      DELETE FROM t ORDER BY b LIMIT 1;
      SELECT * FROM t;
      UPDATE t PARTITION (p1) SET a = 1 WHERE a = 8;
      HANDLER t OPEN;
      HANDLER t READ b LAST;
      HANDLER t READ b PREV;
       
      # Cleanup
      HANDLER t CLOSE;
      DROP TABLE t;
      

      10.6 768a736174d6caf09df43e84b0c1b9ec52f1a301

      2023-12-14 17:11:19 0x7f0ddb48a6c0  InnoDB: Assertion failure in file /data/bld/10.6-asan/storage/innobase/btr/btr0pcur.cc line 371
      InnoDB: Failing assertion: old_n_core_fields <= index->n_core_fields
       
      #8  0x000055743d999028 in ut_dbg_assertion_failed (expr=0x55743ef49d20 "old_n_core_fields <= index->n_core_fields", file=0x55743ef492c0 "/data/bld/11.3-asan/storage/innobase/btr/btr0pcur.cc", line=362) at /data/bld/11.3-asan/storage/innobase/ut/ut0dbg.cc:60
      #9  0x000055743da2a2d2 in btr_pcur_t::restore_position (this=0x620000015300, restore_latch_mode=BTR_SEARCH_LEAF, mtr=0x7f60fc8c1920) at /data/bld/11.3-asan/storage/innobase/btr/btr0pcur.cc:362
      #10 0x000055743d88e07b in sel_restore_position_for_mysql (same_user_rec=0x7f60fc8c0d20, latch_mode=BTR_SEARCH_LEAF, pcur=0x620000015300, moves_up=false, mtr=0x7f60fc8c1920) at /data/bld/11.3-asan/storage/innobase/row/row0sel.cc:3639
      #11 0x000055743d8957a2 in row_search_mvcc (buf=0xbebebebebebebec8 <error: Cannot access memory at address 0xbebebebebebebec8>, mode=PAGE_CUR_G, prebuilt=0x620000015120, match_mode=0, direction=2) at /data/bld/11.3-asan/storage/innobase/row/row0sel.cc:4731
      #12 0x000055743d47dc80 in ha_innobase::general_fetch (this=0x61d00031a6b8, buf=0xbebebebebebebec8 <error: Cannot access memory at address 0xbebebebebebebec8>, direction=2, match_mode=0) at /data/bld/11.3-asan/storage/innobase/handler/ha_innodb.cc:9298
      #13 0x000055743d47e452 in ha_innobase::index_prev (this=0x61d00031a6b8, buf=0xbebebebebebebec8 <error: Cannot access memory at address 0xbebebebebebebec8>) at /data/bld/11.3-asan/storage/innobase/handler/ha_innodb.cc:9379
      #14 0x000055743cacf9e9 in handler::ha_index_prev (this=0x61d00031a6b8, buf=0xbebebebebebebec8 <error: Cannot access memory at address 0xbebebebebebebec8>) at /data/bld/11.3-asan/sql/handler.cc:3760
      #15 0x000055743d24cb33 in ha_partition::handle_ordered_prev (this=0x61d0003192b8, buf=0x619000104ff8 "\377") at /data/bld/11.3-asan/sql/ha_partition.cc:8486
      #16 0x000055743d236e8d in ha_partition::index_prev (this=0x61d0003192b8, buf=0x619000104ff8 "\377") at /data/bld/11.3-asan/sql/ha_partition.cc:6332
      #17 0x000055743cacf4bf in handler::ha_index_prev (this=0x61d0003192b8, buf=0x619000104ff8 "\377") at /data/bld/11.3-asan/sql/handler.cc:3760
      #18 0x000055743c0acbdf in mysql_ha_read (thd=0x62c0001f0218, tables=0x6290000fa3c0, mode=RPREV, keyname=0x6290000faad8 "b", key_expr=0x0, ha_rkey_mode=HA_READ_KEY_EXACT, cond=0x0, select_limit_cnt=1, offset_limit_cnt=0) at /data/bld/11.3-asan/sql/sql_handler.cc:936
      #19 0x000055743c189fe0 in mysql_execute_command (thd=0x62c0001f0218, is_called_from_prepared_stmt=false) at /data/bld/11.3-asan/sql/sql_parse.cc:5338
      #20 0x000055743c19a1dd in mysql_parse (thd=0x62c0001f0218, rawbuf=0x6290000fa238 "HANDLER t READ b PREV", length=21, parser_state=0x7f60fc8c39f0) at /data/bld/11.3-asan/sql/sql_parse.cc:7749
      #21 0x000055743c171a28 in dispatch_command (command=COM_QUERY, thd=0x62c0001f0218, packet=0x629000285219 "", packet_length=21, blocking=true) at /data/bld/11.3-asan/sql/sql_parse.cc:1893
      #22 0x000055743c16e760 in do_command (thd=0x62c0001f0218, blocking=true) at /data/bld/11.3-asan/sql/sql_parse.cc:1406
      #23 0x000055743c63e89f in do_handle_one_connection (connect=0x608000003938, put_in_cache=true) at /data/bld/11.3-asan/sql/sql_connect.cc:1418
      #24 0x000055743c63e260 in handle_one_connection (arg=0x6080000038b8) at /data/bld/11.3-asan/sql/sql_connect.cc:1320
      #25 0x000055743d2750f8 in pfs_spawn_thread (arg=0x617000008218) at /data/bld/11.3-asan/storage/perfschema/pfs.cc:2201
      #26 0x00007f61098a8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #27 0x00007f610992861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failures started happening after this commit in 10.4.32:

      commit 6f835378764772554b7570e7eaae6b4b88e5eb15
      Author: Sergei Golubchik
      Date:   Mon Oct 16 23:05:26 2023 +0200
       
          MDEV-24283 Assertion `bitmap_is_set(&m_part_info->read_partitions, m_part_spec.start_part)' failed in ha_partition::handle_ordered_index_scan
      

      Attachments

        Activity

          People

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