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

Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table

    XMLWordPrintable

Details

    Description

      Assertion `bitmap_is_set(&(m_part_info->read_partitions), part_id)' failed in ha_partition::part_records

      --source include/have_partition.inc
       
      CREATE TABLE t1 (pk INT PRIMARY KEY) WITH SYSTEM VERSIONING PARTITION BY system_time LIMIT 100 (PARTITION p1 HISTORY, PARTITION pn CURRENT);
      EXECUTE IMMEDIATE 'SELECT * FROM t1 FOR UPDATE';
      

      10.3 98b24da0

      mysqld: /data/src/10.3/sql/ha_partition.h:1508: ha_rows ha_partition::part_records(void*): Assertion `bitmap_is_set(&(m_part_info->read_partitions), part_id)' failed.
      190813 12:19:01 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc935734f12 in __GI___assert_fail (assertion=0x55904a63dad8 "bitmap_is_set(&(m_part_info->read_partitions), part_id)", file=0x55904a63da88 "/data/src/10.3/sql/ha_partition.h", line=1508, fu
      nction=0x55904a63e8c0 <ha_partition::part_records(void*)::__PRETTY_FUNCTION__> "ha_rows ha_partition::part_records(void*)") at assert.c:101
      #8  0x0000559049be5fe3 in ha_partition::part_records (this=0x7fc8b00e4c58, _part_elem=0x7fc8b0064b98) at /data/src/10.3/sql/ha_partition.h:1508
      #9  0x0000559049be0be6 in partition_info::vers_set_hist_part (this=0x7fc8b0064958, thd=0x7fc8a8000b00) at /data/src/10.3/sql/partition_info.cc:842
      #10 0x000055904a4fed58 in ha_partition::external_lock (this=0x7fc8b00e4c58, thd=0x7fc8a8000b00, lock_type=1) at /data/src/10.3/sql/ha_partition.cc:3955
      #11 0x0000559049dabd17 in handler::ha_external_lock (this=0x7fc8b00e4c58, thd=0x7fc8a8000b00, lock_type=1) at /data/src/10.3/sql/handler.cc:6371
      #12 0x0000559049ec3dfa in lock_external (thd=0x7fc8a8000b00, tables=0x7fc8a8011f90, count=1) at /data/src/10.3/sql/lock.cc:391
      #13 0x0000559049ec3adc in mysql_lock_tables (thd=0x7fc8a8000b00, sql_lock=0x7fc8a8011f70, flags=0) at /data/src/10.3/sql/lock.cc:336
      #14 0x0000559049ec3998 in mysql_lock_tables (thd=0x7fc8a8000b00, tables=0x7fc8a8011f68, count=1, flags=0) at /data/src/10.3/sql/lock.cc:299
      #15 0x0000559049a15fda in lock_tables (thd=0x7fc8a8000b00, tables=0x7fc8a81650e0, count=1, flags=0) at /data/src/10.3/sql/sql_base.cc:5305
      #16 0x0000559049a15655 in open_and_lock_tables (thd=0x7fc8a8000b00, options=..., tables=0x7fc8a81650e0, derived=true, flags=0, prelocking_strategy=0x7fc927282ce8) at /data/src/10.3/sql/sql_base.cc:505
      0
      #17 0x00005590499d5961 in open_and_lock_tables (thd=0x7fc8a8000b00, tables=0x7fc8a81650e0, derived=true, flags=0) at /data/src/10.3/sql/sql_base.h:505
      #18 0x0000559049aa8634 in execute_sqlcom_select (thd=0x7fc8a8000b00, all_tables=0x7fc8a81650e0) at /data/src/10.3/sql/sql_parse.cc:6207
      #19 0x0000559049a9fcb6 in mysql_execute_command (thd=0x7fc8a8000b00) at /data/src/10.3/sql/sql_parse.cc:3816
      #20 0x0000559049aca8f5 in Prepared_statement::execute (this=0x7fc8a80d3ff0, expanded_query=0x7fc927283b30, open_cursor=false) at /data/src/10.3/sql/sql_prepare.cc:4807
      #21 0x0000559049ac8ce6 in Prepared_statement::execute_loop (this=0x7fc8a80d3ff0, expanded_query=0x7fc927283b30, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.3/sql/sql_prepare.cc:4235
      #22 0x0000559049acae97 in Prepared_statement::execute_immediate (this=0x7fc8a80d3ff0, query=0x7fc8a8011750 "SELECT * FROM t5 FOR UPDATE /* QNO 56972 CON_ID 18 */ ", query_len=54) at /data/src/10.3/sql
      /sql_prepare.cc:4931
      #23 0x0000559049ac5768 in mysql_sql_stmt_execute_immediate (thd=0x7fc8a8000b00) at /data/src/10.3/sql/sql_prepare.cc:2905
      #24 0x0000559049a9fcd3 in mysql_execute_command (thd=0x7fc8a8000b00) at /data/src/10.3/sql/sql_parse.cc:3822
      #25 0x0000559049aaca74 in mysql_parse (thd=0x7fc8a8000b00, rawbuf=0x7fc8a8011558 "/* GenTest::Transform::ExecuteAsExecuteImmediate */ EXECUTE IMMEDIATE 'SELECT * FROM t5 FOR UPDATE /* QNO 56972 CON_ID
       18 */ ' /* TRANSFORM_OUTCOME_UNORDERED_MATCH */ /* QNO 56974 CON_ID 18 */", length=192, parser_state=0x7fc927284630, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7829
      #26 0x0000559049a9a672 in dispatch_command (command=COM_QUERY, thd=0x7fc8a8000b00, packet=0x7fc8a8008d71 "/* GenTest::Transform::ExecuteAsExecuteImmediate */ EXECUTE IMMEDIATE 'SELECT * FROM t5 FOR UP
      DATE /* QNO 56972 CON_ID 18 */ ' /* TRANSFORM_OUTCOME_UNORDERED_MATCH */ /* QNO 56974 CON_ID 18 */", packet_length=192, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:18
      56
      #27 0x0000559049a99095 in do_command (thd=0x7fc8a8000b00) at /data/src/10.3/sql/sql_parse.cc:1401
      #28 0x0000559049c0315e in do_handle_one_connection (connect=0x55904d756230) at /data/src/10.3/sql/sql_connect.cc:1403
      #29 0x0000559049c02ec0 in handle_one_connection (arg=0x55904d756230) at /data/src/10.3/sql/sql_connect.cc:1308
      #30 0x00007fc9372a94a4 in start_thread (arg=0x7fc927285700) at pthread_create.c:456
      #31 0x00007fc9357f1d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      The problem was apparently introduced by this commit:

      commit cdbac54df0bd857a053decd66b6067abf15a6801 43882e764d6867c6855b1ff057758a3f08b25c55
      Commit:     Aleksey Midenkov
      CommitDate: Sun Aug 11 12:32:08 2019 +0300
       
          MDEV-17613 MIN/MAX Optimization (Select tables optimized away) does not work
          
          Prune to now-partition when there is no FOR SYSTEM_TIME clause.
      

      No obvious effect on a non-debug build.

      Attachments

        Issue Links

          Activity

            People

              midenok Aleksey Midenkov
              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.