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

Assertion failures upon concurrent CHECK and DML on table with FK

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • N/A
    • 12.0
    • Server
    • None

    Description

      The test case is non-deterministic, run with big enough repeat=N.
      It usually fails for me within 100-200 repetitions, but it can vary on different machines and builds.
      So far I didn't get a failure with rr (in several thousand attempts), although maybe it just takes much longer than that.

      Note that there are both debug- and non-debug assertion failures here.

      I am not sure why the first DROP in the test case is needed, maybe it opens something that needs to be open.
      At least these also work here instead of it:

      SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE ENGINE='InnoDB';
      # or
      CREATE TABLE x (a INT) ENGINE=InnoDB;
      

      --source include/have_innodb.inc
       
      DROP TABLE IF EXISTS non_existing_table;
       
      CREATE TABLE t (a INT, b INT, KEY(b), FOREIGN KEY (a) REFERENCES t(b)) ENGINE=InnoDB;
      --connect (con1,localhost,root,,)
      SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
      --send
        CHECK TABLE t EXTENDED;
      --connection default
      INSERT INTO t VALUES (0,0),(1,1);
      --connection con1
      --reap
       
      DROP TABLE t;
      

      bb-11.8-check-table ceb64ee4d1d5af7ab608bbfd35de88510cce82ea non-debug

      2025-04-18 16:31:12 0x7f74ef17b6c0  InnoDB: Assertion failure in file /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/storage/innobase/row/row0sel.cc 
      line 4709
      InnoDB: Failing assertion: prebuilt->select_lock_type != LOCK_NONE || srv_read_only_mode || trx->read_view.is_open()
       
      #7  0x00005609547a401d in ut_dbg_assertion_failed (expr=expr@entry=0x56095733be60 "prebuilt->select_lock_type != LOCK_NONE || srv_read_only_mode || trx->read_view.is_open()", file=file@entry=0x56095733a6c0 "/data/bld/preview-12.0-bb-11.8-check-table-rel-asan/storage/innobase/row/row0sel.cc", line=line@entry=4709) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/storage/innobase/ut/ut0dbg.cc:60
      #8  0x0000560954786fbf in row_search_mvcc (buf=buf@entry=0x6190000d16c8 "\371", mode=<optimized out>, mode@entry=PAGE_CUR_UNSUPP, prebuilt=0x620000040108, match_mode=match_mode@entry=0, direction=direction@entry=1) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/storage/innobase/row/row0sel.cc:4709
      #9  0x00005609561ce20d in ha_innobase::general_fetch (match_mode=0, direction=1, buf=0x6190000d16c8 "\371", this=0x61d0000c08b8) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/storage/innobase/handler/ha_innodb.cc:9222
      #10 ha_innobase::rnd_next (this=0x61d0000c08b8, buf=<optimized out>) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/storage/innobase/handler/ha_innodb.cc:9430
      #11 0x0000560955664d72 in handler::ha_rnd_next (this=0x61d0000c08b8, buf=<optimized out>) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/handler.cc:3743
      #12 0x00005609551da711 in check_key_referential_integrity (table=table@entry=0x6190000d1198, ref_table=ref_table@entry=0x6190000d2098, this_key=this_key@entry=0x6190000d1c70, ref_key=<optimized out>, fk_parts=<optimized out>, key_buf=key_buf@entry=0x6290001fae68 "", fk_name=...) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_admin.cc:1752
      #13 0x00005609551db789 in check_foreign_key_relation (thd=thd@entry=0x62b0001ab218, this_table=this_table@entry=0x6190000d1198, ref_table=<optimized out>, fk=..., key_buf=key_buf@entry=0x6290001fae68 "") at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_admin.cc:1886
      #14 0x00005609551eb79a in check_foreign_key_relations (thd=thd@entry=0x62b0001ab218, table=<optimized out>) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_admin.cc:1953
      #15 0x0000560955674248 in handler::ha_check (this=0x61d0000c08b8, thd=0x62b0001ab218, check_opt=0x62b0001b08b8) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/handler.cc:5398
      #16 0x00005609551e470a in mysql_admin_table (thd=thd@entry=0x62b0001ab218, tables=tables@entry=0x6290001f9330, check_opt=check_opt@entry=0x62b0001b08b8, operator_name=operator_name@entry=0x56095799bfa0 <msg_check>, lock_type=lock_type@entry=TL_READ_NO_INSERT, org_open_for_modify=org_open_for_modify@entry=false, no_errors_from_open=<optimized out>, extra_open_options=<optimized out>, prepare_func=<optimized out>, operator_func=<optimized out>, view_operator_func=<optimized out>, is_cmd_replicated=<optimized out>) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_admin.cc:942
      #17 0x00005609551ea3a2 in Sql_cmd_check_table::execute (this=<optimized out>, thd=0x62b0001ab218) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_admin.cc:1660
      #18 0x0000560954d199f1 in mysql_execute_command (thd=thd@entry=0x62b0001ab218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_parse.cc:5872
      #19 0x0000560954d28342 in mysql_parse (thd=thd@entry=0x62b0001ab218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f74ef1792a0) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_parse.cc:7901
      #20 0x0000560954d2f4d5 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62b0001ab218, packet=packet@entry=0x6290001ef219 "", packet_length=packet_length@entry=22, blocking=blocking@entry=true) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_parse.cc:1903
      #21 0x0000560954d371ff in do_command (thd=thd@entry=0x62b0001ab218, blocking=blocking@entry=true) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_parse.cc:1416
      #22 0x00005609551acced in do_handle_one_connection (connect=<optimized out>, connect@entry=0x608000002cb8, put_in_cache=put_in_cache@entry=true) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_connect.cc:1415
      #23 0x00005609551ad4e5 in handle_one_connection (arg=arg@entry=0x608000002cb8) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/sql/sql_connect.cc:1327
      #24 0x0000560955f44af8 in pfs_spawn_thread (arg=0x617000005f18) at /data/bld/preview-12.0-bb-11.8-check-table-rel-asan/storage/perfschema/pfs.cc:2198
      #25 0x00007f74ff4a81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #26 0x00007f74ff52885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      bb-11.8-check-table ceb64ee4d1d5af7ab608bbfd35de88510cce82ea

      mariadbd: /data/bld/preview-12.0-bb-11.8-check-table-asan/storage/innobase/row/row0sel.cc:4658: dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint): Assertion `prebuilt->sql_stat_start || prebuilt->table->no_rollback()' failed.
      250418 16:33:39 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007fa93ee53eb2 in __GI___assert_fail (assertion=0x5602d6812dc0 "prebuilt->sql_stat_start || prebuilt->table->no_rollback()", file=0x5602d680e180 "/data/bld/preview-12.0-bb-11.8-check-table-asan/storage/innobase/row/row0sel.cc", line=4658, function=0x5602d6812aa0 "dberr_t row_search_mvcc(byte*, page_cur_mode_t, row_prebuilt_t*, ulint, ulint)") at ./assert/assert.c:101
      #10 0x00005602d50382b8 in row_search_mvcc (buf=0x619000154ac8 "\371", mode=PAGE_CUR_G, prebuilt=0x620000092120, match_mode=0, direction=1) at /data/bld/preview-12.0-bb-11.8-check-table-asan/storage/innobase/row/row0sel.cc:4658
      #11 0x00005602d4b45336 in ha_innobase::general_fetch (this=0x61d0003f2ab8, buf=0x619000154ac8 "\371", direction=1, match_mode=0) at /data/bld/preview-12.0-bb-11.8-check-table-asan/storage/innobase/handler/ha_innodb.cc:9222
      #12 0x00005602d4b4628c in ha_innobase::rnd_next (this=0x61d0003f2ab8, buf=0x619000154ac8 "\371") at /data/bld/preview-12.0-bb-11.8-check-table-asan/storage/innobase/handler/ha_innodb.cc:9430
      #13 0x00005602d4111c04 in handler::ha_rnd_next (this=0x61d0003f2ab8, buf=0x619000154ac8 "\371") at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/handler.cc:3743
      #14 0x00005602d3c9a224 in check_key_referential_integrity (table=0x619000155498, ref_table=0x619000154098, this_key=0x619000153c70, ref_key=0x6190001531b8, fk_parts=1, key_buf=0x6290002f9e90 "", fk_name=...) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_admin.cc:1752
      #15 0x00005602d3c9aac1 in check_foreign_key_relation (thd=0x62c000220218, this_table=0x619000155498, ref_table=0x619000154098, fk=..., key_buf=0x6290002f9e90 "") at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_admin.cc:1886
      #16 0x00005602d3c9b60d in check_foreign_key_relations (thd=0x62c000220218, table=0x619000155498) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_admin.cc:1953
      #17 0x00005602d412301a in handler::ha_check (this=0x61d0003f2ab8, thd=0x62c000220218, check_opt=0x62c000225a88) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/handler.cc:5398
      #18 0x00005602d3c92cc0 in mysql_admin_table (thd=0x62c000220218, tables=0x6290002f8330, check_opt=0x62c000225a88, operator_name=0x5602d71c4ba0 <msg_check>, lock_type=TL_READ_NO_INSERT, org_open_for_modify=false, no_errors_from_open=false, extra_open_options=32, prepare_func=0x0, operator_func=(int (handler::*)(handler * const, THD *, HA_CHECK_OPT *)) 0x5602d4122b38 <handler::ha_check(THD*, st_ha_check_opt*)>, view_operator_func=0x5602d3b3d1f5 <view_check(THD*, TABLE_LIST*, st_ha_check_opt*)>, is_cmd_replicated=false) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_admin.cc:942
      #19 0x00005602d3c98f08 in Sql_cmd_check_table::execute (this=0x6290002f8a60, thd=0x62c000220218) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_admin.cc:1660
      #20 0x00005602d3782131 in mysql_execute_command (thd=0x62c000220218, is_called_from_prepared_stmt=false) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_parse.cc:5872
      #21 0x00005602d378f150 in mysql_parse (thd=0x62c000220218, rawbuf=0x6290002f8238 "CHECK TABLE t EXTENDED", length=22, parser_state=0x7fa92e67ea30) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_parse.cc:7901
      #22 0x00005602d3766291 in dispatch_command (command=COM_QUERY, thd=0x62c000220218, packet=0x62900064f219 "", packet_length=22, blocking=true) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_parse.cc:1903
      #23 0x00005602d3762f99 in do_command (thd=0x62c000220218, blocking=true) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_parse.cc:1416
      #24 0x00005602d3c55a89 in do_handle_one_connection (connect=0x608000006838, put_in_cache=true) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_connect.cc:1415
      #25 0x00005602d3c555e8 in handle_one_connection (arg=0x608000004cb8) at /data/bld/preview-12.0-bb-11.8-check-table-asan/sql/sql_connect.cc:1327
      #26 0x00005602d4901a7c in pfs_spawn_thread (arg=0x617000008598) at /data/bld/preview-12.0-bb-11.8-check-table-asan/storage/perfschema/pfs.cc:2198
      #27 0x00007fa93eea81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      

      Attachments

        Issue Links

          Activity

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.