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

Assertion `share->now_transactional || (info->dup_key_trid == 0)' failed in maria_write

    XMLWordPrintable

Details

    Description

      The test cases are for reproducing only, don't put them into the regression suite!
      The test case is non-deterministic, the loop is already inside the test, so there should be no need to run it with --repeat. It fails for me nearly immediately on all existing versions, but it may vary on different machines and builds.

      CREATE TABLE t (a INT PRIMARY KEY) ENGINE=Aria;
      INSERT INTO t VALUES (1);
      --connect (con1,localhost,root,,)
      --let $run=100
      while ($run)
      {
        INSERT IGNORE INTO t VALUES (0);
        --send
        CHECK TABLE t;
        --connection default
        CHECK TABLE t;
        INSERT IGNORE INTO t VALUES (0);
        --connection con1
        --reap
        --dec $run
      }
      

      10.11 4918fc5780fe961c16ad590afab79150712f578e

      mariadbd: /data/bld/10.11-asan-ubsan/storage/maria/ma_write.c:220: maria_write: Assertion `share->now_transactional || (info->dup_key_trid == 0)' failed.
      251020 21:51:05 [ERROR] /share8t/bld/10.11-asan-ubsan/sql/mariadbd got signal 6 ;
       
      #9  0x00007fbe7e445395 in __assert_fail_base (fmt=0x7fbe7e5b9a90 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x56263c5bfcc0 "share->now_transactional || (info->dup_key_trid == 0)", file=file@entry=0x56263c5bf2e0 "/data/bld/10.11-asan-ubsan/storage/maria/ma_write.c", line=line@entry=220, function=function@entry=0x56263c5c0c40 <__PRETTY_FUNCTION__.8> "maria_write") at ./assert/assert.c:92
      #10 0x00007fbe7e453eb2 in __GI___assert_fail (assertion=assertion@entry=0x56263c5bfcc0 "share->now_transactional || (info->dup_key_trid == 0)", file=file@entry=0x56263c5bf2e0 "/data/bld/10.11-asan-ubsan/storage/maria/ma_write.c", line=line@entry=220, function=function@entry=0x56263c5c0c40 <__PRETTY_FUNCTION__.8> "maria_write") at ./assert/assert.c:101
      #11 0x000056263a78608d in maria_write (info=<optimized out>, record=<optimized out>) at /data/bld/10.11-asan-ubsan/storage/maria/ma_write.c:220
      #12 0x000056263a5cc1be in ha_maria::write_row (this=0x625000237948, buf=0x625000238148 "\377") at /data/bld/10.11-asan-ubsan/storage/maria/ha_maria.cc:1256
      #13 0x0000562639a7abab in handler::ha_write_row (this=this@entry=0x625000237948, buf=<optimized out>) at /data/bld/10.11-asan-ubsan/sql/handler.cc:7765
      #14 0x00005626385c070f in Write_record::single_insert (this=this@entry=0x7fbe74452a50, inserted=inserted@entry=0x7fbe744525d0) at /data/bld/10.11-asan-ubsan/sql/sql_insert.cc:2320
      #15 0x00005626385c3a35 in Write_record::write_record (this=this@entry=0x7fbe74452a50) at /data/bld/10.11-asan-ubsan/sql/sql_insert.cc:2362
      #16 0x0000562638602099 in mysql_insert (thd=thd@entry=0x62c0000b0218, table_list=<optimized out>, fields=..., values_list=..., update_fields=..., update_values=..., duplic=<optimized out>, ignore=<optimized out>, result=<optimized out>) at /data/bld/10.11-asan-ubsan/sql/sql_insert.cc:1216
      #17 0x00005626387933c5 in mysql_execute_command (thd=thd@entry=0x62c0000b0218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:4628
      #18 0x00005626387ae995 in mysql_parse (thd=thd@entry=0x62c0000b0218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fbe74453ab0) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:8184
      #19 0x00005626387b7d20 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62c0000b0218, packet=packet@entry=0x62900024e219 "INSERT IGNORE INTO t VALUES (0)", packet_length=packet_length@entry=31, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1906
      #20 0x00005626387c495c in do_command (thd=thd@entry=0x62c0000b0218, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1419
      #21 0x0000562638fbcee4 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x608000003338, put_in_cache=put_in_cache@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1475
      #22 0x0000562638fbe041 in handle_one_connection (arg=0x608000003338) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1387
      #23 0x000056263a92f789 in pfs_spawn_thread (arg=0x617000005b98) at /data/bld/10.11-asan-ubsan/storage/perfschema/pfs.cc:2201
      #24 0x00007fbe7e4a81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #25 0x00007fbe7e52885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      No obvious immediate problem on a non-debug build.
      However, an almost identical test case (all the same but without PRIMARY KEY) fails on a different assertion upon CHECK, and this one also leads to table corruption, either real or bogus, on a non-debug build:

      CREATE TABLE t (a INT) ENGINE=Aria;
      INSERT INTO t VALUES (1);
      --connect (con1,localhost,root,,)
      --let $run=100
      while ($run)
      {
        INSERT IGNORE INTO t VALUES (0);
        --send
        CHECK TABLE t;
        --connection default
        CHECK TABLE t;
        INSERT IGNORE INTO t VALUES (0);
        --connection con1
        --reap
        --dec $run
      }
      

      10.11 4918fc5780fe961c16ad590afab79150712f578e debug

      mariadbd: /data/bld/10.11-asan-ubsan/storage/maria/ma_bitmap.c:3128: flush_log_for_bitmap: Assertion `share->now_transactional' failed.
      251020 21:52:32 [ERROR] /share8t/bld/10.11-asan-ubsan/sql/mariadbd got signal 6 ;
       
      #10 0x00007fa811253eb2 in __GI___assert_fail (assertion=assertion@entry=0x55684c7a7de0 "share->now_transactional", file=file@entry=0x55684c7a7880 "/data/bld/10.11-asan-ubsan/storage/maria/ma_bitmap.c", line=line@entry=3128, function=function@entry=0x55684c7a9a80 <__PRETTY_FUNCTION__.0> "flush_log_for_bitmap") at ./assert/assert.c:101
      #11 0x000055684a953a44 in flush_log_for_bitmap (args=<optimized out>) at /data/bld/10.11-asan-ubsan/storage/maria/ma_bitmap.c:3128
      #12 0x000055684a84a73a in pagecache_fwrite (pagecache=pagecache@entry=0x556855800b60 <maria_pagecache_var>, filedesc=filedesc@entry=0x7fa809a3cae0, buffer=<optimized out>, pageno=<optimized out>, type=type@entry=PAGECACHE_PLAIN_PAGE, flags=flags@entry=36) at /data/bld/10.11-asan-ubsan/storage/maria/ma_pagecache.c:676
      #13 0x000055684a85e454 in flush_cached_blocks (pagecache=pagecache@entry=0x556855800b60 <maria_pagecache_var>, file=file@entry=0x6290002806a8, cache=cache@entry=0x7fa805bd53a0, end=end@entry=0x7fa805bd53b0, type=type@entry=FLUSH_FORCE_WRITE, first_errno=first_errno@entry=0x7fa805bd52f0) at /data/bld/10.11-asan-ubsan/storage/maria/ma_pagecache.c:4829
      #14 0x000055684a860553 in flush_pagecache_blocks_int (pagecache=pagecache@entry=0x556855800b60 <maria_pagecache_var>, file=file@entry=0x6290002806a8, type=type@entry=FLUSH_FORCE_WRITE, filter=filter@entry=0x0, filter_arg=filter_arg@entry=0x0) at /data/bld/10.11-asan-ubsan/storage/maria/ma_pagecache.c:5126
      #15 0x000055684a86c6e6 in flush_pagecache_blocks_with_filter (pagecache=0x556855800b60 <maria_pagecache_var>, file=file@entry=0x6290002806a8, type=type@entry=FLUSH_FORCE_WRITE, filter=filter@entry=0x0, filter_arg=filter_arg@entry=0x0) at /data/bld/10.11-asan-ubsan/storage/maria/ma_pagecache.c:5241
      #16 0x000055684a8c00c1 in _ma_flush_table_files (info=info@entry=0x629000280218, flush_data_or_index=flush_data_or_index@entry=3, flush_type_for_data=flush_type_for_data@entry=FLUSH_FORCE_WRITE, flush_type_for_index=flush_type_for_index@entry=FLUSH_FORCE_WRITE) at /data/bld/10.11-asan-ubsan/storage/maria/ma_extra.c:663
      #17 0x000055684a9bbf06 in maria_chk_size (param=<optimized out>, info=0x629000280218) at /data/bld/10.11-asan-ubsan/storage/maria/ma_check.c:432
      #18 0x000055684a7deccf in ha_maria::check (this=0x625000241948, thd=0x62c0000e0218, check_opt=<optimized out>) at /data/bld/10.11-asan-ubsan/storage/maria/ha_maria.cc:1308
      #19 0x0000556849c43ce2 in handler::ha_check (this=this@entry=0x625000241948, thd=thd@entry=0x62c0000e0218, check_opt=check_opt@entry=0x62c0000e5a10) at /data/bld/10.11-asan-ubsan/sql/handler.cc:5145
      #20 0x00005568492135ae in mysql_admin_table (thd=thd@entry=0x62c0000e0218, tables=tables@entry=0x62d00026c520, check_opt=check_opt@entry=0x62c0000e5a10, operator_name=operator_name@entry=0x55684d1505a0 <msg_check>, lock_type=lock_type@entry=TL_READ_NO_INSERT, org_open_for_modify=org_open_for_modify@entry=false, repair_table_use_frm=<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/10.11-asan-ubsan/sql/sql_admin.cc:918
      #21 0x000055684921ee0b in Sql_cmd_check_table::execute (this=<optimized out>, thd=0x62c0000e0218) at /data/bld/10.11-asan-ubsan/sql/sql_admin.cc:1596
      #22 0x0000556848996102 in mysql_execute_command (thd=thd@entry=0x62c0000e0218, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:6169
      #23 0x000055684899a995 in mysql_parse (thd=thd@entry=0x62c0000e0218, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7fa805bdbab0) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:8184
      #24 0x00005568489a3d20 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x62c0000e0218, packet=packet@entry=0x62900026c219 "", packet_length=packet_length@entry=13, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1906
      #25 0x00005568489b095c in do_command (thd=thd@entry=0x62c0000e0218, blocking=blocking@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_parse.cc:1419
      #26 0x00005568491a8ee4 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x608000003438, put_in_cache=put_in_cache@entry=true) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1475
      #27 0x00005568491aa041 in handle_one_connection (arg=0x608000003438) at /data/bld/10.11-asan-ubsan/sql/sql_connect.cc:1387
      #28 0x000055684ab1b789 in pfs_spawn_thread (arg=0x617000005f18) at /data/bld/10.11-asan-ubsan/storage/perfschema/pfs.cc:2201
      #29 0x00007fa8112a81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #30 0x00007fa81132885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      10.11 4918fc5780fe961c16ad590afab79150712f578e non-debug

      Table	Op	Msg_type	Msg_text
      test.t	check	error	Record-count is not ok; found        114  Should be: 112
      test.t	check	error	Corrupt
      INSERT IGNORE INTO t VALUES (0);
      Warnings:
      Error	145	Got error '145 "Table was marked as crashed and should be repaired"' for './test/t'
      Warning	1034	Number of rows changed from 112 to 114
      connection con1;
      Table	Op	Msg_type	Msg_text
      test.t	check	error	Record-count is not ok; found        114  Should be: 112
      test.t	check	error	Corrupt
       
      ...
       
      2025-10-20 21:58:01 4 [ERROR] mariadbd: Got error '145 "Table was marked as crashed and should be repaired"' for './test/t'
      2025-10-20 21:58:01 4 [Warning] Recovering table: './test/t'
      2025-10-20 21:58:01 4 [ERROR] mariadbd: Got error '145 "Table was marked as crashed and should be repaired"' for './test/t'
      2025-10-20 21:58:01 4 [Warning] Recovering table: './test/t'
      ...
      

      The assertion failure in flush_log_for_bitmap was also reported as MDEV-18013.

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              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.