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

Unexpected behavior upon multi-table DELETE IGNORE exceeding max_binlog_cache_size, assertion failure in MYSQL_BIN_LOG::write_transaction_or_stmt

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5, 10.6, 10.11, 11.2(EOL), 11.4, 11.6(EOL)
    • 10.5, 10.6, 10.11, 11.4
    • Replication
    • None

    Description

      Note: The dbt3-s001 dataset is excessive here, only a part of lineitem contents is used in the test case, but transferring it into the test case explicitly made it much bigger, and I didn't succeed at blindly guessing the right lengths while trying to convert it into the usual REPEATs and alike. On the same reason I have no information whether the problem is scalable to more meaningful values of max_binlog_cache_size.

      --source include/have_binlog_format_row.inc
      --source include/have_innodb.inc
       
      create database dbt3;
      use dbt3;
       
      --disable_query_log
      --source include/dbt3_s001.inc
      --enable_query_log
       
      set @cache.save= @@max_binlog_cache_size;
      set global max_binlog_cache_size=16*1024;
       
      --connect (con1,localhost,root,,dbt3)
       
      create table t engine=InnoDB as select * from lineitem limit 100;
      insert into t select * from lineitem limit 100 offset 100;
      insert into t select * from lineitem limit 150 offset 200;
       
      create table t2 (a int) engine=InnoDB;
      insert into t2 values (1),(2);
       
      delete ignore alias1 from t alias1, t2 alias2;
      select count(*) from t;
       
      show binlog events;
       
      # Cleanup
      --disconnect con1
      --connection default
      drop database dbt3;
      set global max_binlog_cache_size= @cache.save;
      

      On a non-debug build, the DELETE IGNORE above succeeds with a warning:

      10.5 5673cbe0941e105eb73b5ecf651a529f8e717b52

      Warnings:
      Error	1197	Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
      select count(*) from t;
      count(*)
      0
      

      This is already alarming. IGNORE clause is not a full indulgence, it only suppresses certain errors, and I don't believe it ER_TRANS_CACHE_FULL is meant to be one of them, as it will surely cause discrepancy in replication (and it doesn't happen on all datasets, only on specific ones like the above).

      Further show binlog events fails:

      query 'show binlog events' failed: 1220: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
      

      so clearly something went wrong here.

      On a debug build, DELETE just fails on an assertion:

      10.5 5673cbe0941e105eb73b5ecf651a529f8e717b52

      mariadbd: /data/bld/10.5-asan/sql/log.cc:8638: int MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry*, uint64): Assertion `!(entry->using_trx_cache && !mngr->trx_cache.empty() && mngr->get_binlog_cache_log((1))->error)' failed.
      241005 19:46:48 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f5539a53e32 in __GI___assert_fail (assertion=0x55f66fd3c920 "!(entry->using_trx_cache && !mngr->trx_cache.empty() && mngr->get_binlog_cache_log((1))->error)", file=0x55f66fd313e0 "/data/bld/10.5-asan/sql/log.cc", line=8638, function=0x55f66fd3c8a0 "int MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry*, uint64)") at ./assert/assert.c:101
      #10 0x000055f66e11c1e2 in MYSQL_BIN_LOG::write_transaction_or_stmt (this=0x55f671cc63c0 <mysql_bin_log>, entry=0x7f5523c23e30, commit_id=0) at /data/bld/10.5-asan/sql/log.cc:8638
      #11 0x000055f66e119d7a in MYSQL_BIN_LOG::trx_group_commit_leader (this=0x55f671cc63c0 <mysql_bin_log>, leader=0x7f5523c23e30) at /data/bld/10.5-asan/sql/log.cc:8385
      #12 0x000055f66e11883b in MYSQL_BIN_LOG::write_transaction_to_binlog_events (this=0x55f671cc63c0 <mysql_bin_log>, entry=0x7f5523c23e30) at /data/bld/10.5-asan/sql/log.cc:8177
      #13 0x000055f66e116606 in MYSQL_BIN_LOG::write_transaction_to_binlog (this=0x55f671cc63c0 <mysql_bin_log>, thd=0x62b0000af218, cache_mngr=0x61b00007fc98, end_ev=0x7f5523c240b0, all=false, using_stmt_cache=true, using_trx_cache=true) at /data/bld/10.5-asan/sql/log.cc:7772
      #14 0x000055f66e0f0545 in binlog_flush_cache (thd=0x62b0000af218, cache_mngr=0x61b00007fc98, end_ev=0x7f5523c240b0, all=false, using_stmt=true, using_trx=true) at /data/bld/10.5-asan/sql/log.cc:1772
      #15 0x000055f66e0f1a17 in binlog_commit_flush_xid_caches (thd=0x62b0000af218, cache_mngr=0x61b00007fc98, all=false, xid=342) at /data/bld/10.5-asan/sql/log.cc:1920
      #16 0x000055f66e126a1c in MYSQL_BIN_LOG::log_and_order (this=0x55f671cc63c0 <mysql_bin_log>, thd=0x62b0000af218, xid=342, all=false, need_prepare_ordered=false, need_commit_ordered=true) at /data/bld/10.5-asan/sql/log.cc:10187
      #17 0x000055f66ddf9167 in ha_commit_trans (thd=0x62b0000af218, all=false) at /data/bld/10.5-asan/sql/handler.cc:1866
      #18 0x000055f66da31dab in trans_commit_stmt (thd=0x62b0000af218) at /data/bld/10.5-asan/sql/transaction.cc:472
      #19 0x000055f66d5b410d in mysql_execute_command (thd=0x62b0000af218) at /data/bld/10.5-asan/sql/sql_parse.cc:6240
      #20 0x000055f66d5c0c81 in mysql_parse (thd=0x62b0000af218, rawbuf=0x62b0000b6238 "delete ignore alias1 from t alias1, t2 alias2", length=45, parser_state=0x7f5523c25c10, is_com_multi=false, is_next_command=false) at /data/bld/10.5-asan/sql/sql_parse.cc:8236
      #21 0x000055f66d595f67 in dispatch_command (command=COM_QUERY, thd=0x62b0000af218, packet=0x6290006a9219 "delete ignore alias1 from t alias1, t2 alias2", packet_length=45, is_com_multi=false, is_next_command=false) at /data/bld/10.5-asan/sql/sql_parse.cc:1892
      #22 0x000055f66d5928fa in do_command (thd=0x62b0000af218) at /data/bld/10.5-asan/sql/sql_parse.cc:1376
      #23 0x000055f66d9ebf04 in do_handle_one_connection (connect=0x608000003c38, put_in_cache=true) at /data/bld/10.5-asan/sql/sql_connect.cc:1417
      #24 0x000055f66d9eb8c7 in handle_one_connection (arg=0x608000003c38) at /data/bld/10.5-asan/sql/sql_connect.cc:1319
      #25 0x000055f66e649c94 in pfs_spawn_thread (arg=0x61500000cd98) at /data/bld/10.5-asan/storage/perfschema/pfs.cc:2201
      #26 0x00007f5539aa8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #27 0x00007f5539b2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Activity

          People

            bnestere Brandon Nesterenko
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.