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

Slave crashes in hp_free_run_chain upon applying row event on HEAP table with blobs

    XMLWordPrintable

Details

    Description

      Note: The head of the PR was used, the fix for MDEV-39723 / MDEV-39724 is already in.

      --source include/have_binlog_format_row.inc
      --source include/master-slave.inc
       
      CREATE TABLE t (
        pk INT AUTO_INCREMENT PRIMARY KEY,
        a TEXT,
        b TEXT,
        c INT
      ) ENGINE=HEAP;
      INSERT INTO t VALUES (1,'','',0);
      UPDATE t SET a = 'foo';
      DELETE FROM t;
      --sync_slave_with_master
       
      --connection master
      DROP TABLE t;
      --source include/rpl_end.inc
      

      pull/4735 aad5680c75370d270ac2cf91898e439d236a34b1

      #3  <signal handler called>
      #4  0x0000556bf03d22b4 in hp_is_single_rec (rec=0x2800000000000000 <error: Cannot access memory at address 0x2800000000000000>, visible=29) at /data/bld/testing/PR-4735/storage/heap/heapdef.h:77
      #5  0x0000556bf03d2756 in hp_free_run_chain (share=0x771e4403dc08, chain=0x2800000000000000 <error: Cannot access memory at address 0x2800000000000000>) at /data/bld/testing/PR-4735/storage/heap/hp_blob.c:139
      #6  0x0000556bf03d3e88 in hp_free_blobs (share=0x771e4403dc08, pos=0x771e449324e8 "\370\001") at /data/bld/testing/PR-4735/storage/heap/hp_blob.c:888
      #7  0x0000556bf03c9f10 in heap_delete (info=0x771e440551f8, record=0x771e440536f8 "\370\001") at /data/bld/testing/PR-4735/storage/heap/hp_delete.c:53
      #8  0x0000556bf03c7664 in ha_heap::delete_row (this=0x771e44053198, buf=0x771e440536f8 "\370\001") at /data/bld/testing/PR-4735/storage/heap/ha_heap.cc:275
      #9  0x0000556beffbad5f in handler::ha_delete_row (this=0x771e44053198, buf=0x771e440536f8 "\370\001") at /data/bld/testing/PR-4735/sql/handler.cc:7971
      #10 0x0000556bf0168c2f in Delete_rows_log_event::do_exec_row (this=0x771e4404ed18, rgi=0x771e44000d40) at /data/bld/testing/PR-4735/sql/log_event_server.cc:8651
      #11 0x0000556bf0161030 in Rows_log_event::do_apply_event (this=0x771e4404ed18, rgi=0x771e44000d40) at /data/bld/testing/PR-4735/sql/log_event_server.cc:6239
      #12 0x0000556bf0145f14 in Log_event::apply_event (this=0x771e4404ed18, rgi=0x771e44000d40) at /data/bld/testing/PR-4735/sql/log_event.cc:4255
      #13 0x0000556befa70735 in apply_event_and_update_pos_apply (ev=0x771e4404ed18, thd=0x771e44001c78, rgi=0x771e44000d40, reason=0) at /data/bld/testing/PR-4735/sql/slave.cc:4136
      #14 0x0000556befa70e39 in apply_event_and_update_pos (ev=0x771e4404ed18, thd=0x771e44001c78, rgi=0x771e44000d40) at /data/bld/testing/PR-4735/sql/slave.cc:4312
      #15 0x0000556befa71d44 in exec_relay_log_event (thd=0x771e44001c78, rli=0x556c157d8f50, serial_rgi=0x771e44000d40) at /data/bld/testing/PR-4735/sql/slave.cc:4735
      #16 0x0000556befa76191 in handle_slave_sql (arg=0x556c157d6e90) at /data/bld/testing/PR-4735/sql/slave.cc:5996
      #17 0x0000556bf02e3544 in pfs_spawn_thread (arg=0x771e4c1575f8) at /data/bld/testing/PR-4735/storage/perfschema/pfs.cc:2201
      #18 0x00007f1e89ea81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #19 0x00007f1e89f2885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The same test case without a PK ends with a replication failure, which is also unexpected:

      --source include/have_binlog_format_row.inc
      --source include/master-slave.inc
       
      CREATE TABLE table100_heap (
        a TEXT,
        b TEXT,
        c INT
      ) ENGINE=HEAP;
      INSERT INTO table100_heap VALUES ('','',0);
      UPDATE table100_heap SET a = 'foo';
      DELETE FROM table100_heap;
      --sync_slave_with_master
       
      --connection master
      DROP TABLE table100_heap;
      --source include/rpl_end.inc
      

      2026-05-23 18:11:21 7 [ERROR] Slave SQL: Could not execute Delete_rows_v1 event on table test.table100_heap; Can't find record in 'table100_heap', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log master-bin.000001, end_log_pos 1275, Gtid 0-1-4, Internal MariaDB error code: 1032
      2026-05-23 18:11:21 7 [Warning] Slave: Can't find record in 'table100_heap' Error_code: 1032
      2026-05-23 18:11:21 7 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'master-bin.000001' position 1080; GTID position '0-1-3'
      

      Attachments

        Issue Links

          Activity

            People

              elenst Elena Stepanova
              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.