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

Assertion `res->length() > 0 && res->length() % 4 == 0' failed in int mhnsw_insert(TABLE *, KEY *)

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 12.3, 13.0
    • 12.3
    • Vector search
    • None
    • Can result in hang or crash

    Description

      Optimized build shows index corruption when executing binlog statement

      CREATE TABLE t1 (v VECTOR (5) NOT NULL,VECTOR INDEX (v));
      BINLOG '0gKWSRMBAAAAMQAAAHQDAAAAAB8AAAAAAAEABHRlc3QAAnQxAAIPEQMUAAYBQFUzwA==0gKWSRcBAAAAMAAAAKQDAAAAAB8AAAAAAAEAAv/8BmJpbmxvZ0mWAtIBivg3mwo+';
       
      #cleanup
      DROP TABLE t1;
      

      Leads to:

      CS 13.0.1 90f8178f33f6ecd33767a79b0f5b9b4c5a1367e5 (Debug, Clang 18.1.3-11) Build 07/04/2026

      mariadbd: /test/13.0_dbg/sql/vector_mhnsw.cc:1425: int mhnsw_insert(TABLE *, KEY *): Assertion `res->length() > 0 && res->length() % 4 == 0' failed.
      

      CS 13.0.1 90f8178f33f6ecd33767a79b0f5b9b4c5a1367e5 (Debug, Clang 18.1.3-11) Build 07/04/2026

      Core was generated by `/test/MD070426-mariadb-13.0.1-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      Download failed: Invalid argument.  Continuing without source file ./nptl/./nptl/pthread_kill.c.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
       
      [Current thread is 1 (LWP 1072195)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=<optimized out>)at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6)at ./nptl/pthread_kill.c:89
      #3  0x00007883aca4527e in __GI_raise (sig=sig@entry=6)at ../sysdeps/posix/raise.c:26
      #4  0x00007883aca288ff in __GI_abort () at ./stdlib/abort.c:79
      #5  0x00007883aca2881b in __assert_fail_base (fmt=0x7883acbd01e8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x58af54ff05dd "res->length() > 0 && res->length() % 4 == 0", file=file@entry=0x58af54ff039d "/test/13.0_dbg/sql/vector_mhnsw.cc", line=line@entry=1425, function=function@entry=0x58af54ff04f8 "int mhnsw_insert(TABLE *, KEY *)")at ./assert/assert.c:96
      #6  0x00007883aca3b517 in __assert_fail (assertion=0x58af54ff05dd "res->length() > 0 && res->length() % 4 == 0", file=0x58af54ff039d "/test/13.0_dbg/sql/vector_mhnsw.cc", line=1425, function=0x58af54ff04f8 "int mhnsw_insert(TABLE *, KEY *)")at ./assert/assert.c:105
      #7  0x000058af5441239a in mhnsw_insert (table=0x7064d40394b8, keyinfo=0x7064d403a2a0) at /test/13.0_dbg/sql/vector_mhnsw.cc:1425
      #8  0x000058af53cdb23c in TABLE::hlindexes_on_insert (this=0x7064d40394b8)at /test/13.0_dbg/sql/sql_base.cc:10112
      #9  0x000058af5420a7fb in handler::ha_write_row (this=0x7064d40398f8, buf=0x7064d403a160 "\006binlog") at /test/13.0_dbg/sql/handler.cc:8545
      #10 0x000058af53d35a5e in Write_record::single_insert (this=0x7883a81fccf8, inserted=0x7883a81fc720) at /test/13.0_dbg/sql/sql_insert.cc:2391
      #11 0x000058af53d33765 in Write_record::write_record (this=0x7883a81fccf8)at /test/13.0_dbg/sql/sql_insert.cc:2433
      #12 0x000058af54401e77 in Write_rows_log_event::write_row (this=0x7064d4035038, rgi=0x7064d40323b0, overwrite=false)at /test/13.0_dbg/sql/log_event_server.cc:7686
      #13 0x000058af54402396 in Write_rows_log_event::do_exec_row (this=0x7064d4035038, rgi=0x7064d40323b0)at /test/13.0_dbg/sql/log_event_server.cc:7768
      #14 0x000058af543fa2b7 in Rows_log_event::do_apply_event (this=0x7064d4035038, rgi=0x7064d40323b0) at /test/13.0_dbg/sql/log_event_server.cc:5487
      #15 0x000058af543e4672 in Log_event::apply_event (this=0x7064d4035038, rgi=0x7064d40323b0) at /test/13.0_dbg/sql/log_event.cc:4247
      #16 0x000058af53f55a13 in save_restore_context_apply_event (ev=0x7064d4035038, rgi=0x7064d40323b0) at /test/13.0_dbg/sql/sql_binlog.cc:162
      #17 0x000058af53f56408 in mysql_client_binlog_statement (thd=0x7064d4000d58)at /test/13.0_dbg/sql/sql_binlog.cc:426
      #18 0x000058af53da2caf in mysql_execute_command (thd=0x7064d4000d58, is_called_from_prepared_stmt=false) at /test/13.0_dbg/sql/sql_parse.cc:5813
      #19 0x000058af53d92524 in mysql_parse (thd=0x7064d4000d58, rawbuf=0x7064d401a110 "BINLOG '0gKWSRMBAAAAMQAAAHQDAAAAAB8AAAAAAAEABHRlc3QAAnQxAAIPEQMUAAYBQFUzwA==0gKWSRcBAAAAMAAAAKQDAAAAAB8AAAAAAAEAAv/8BmJpbmxvZ0mWAtIBivg3mwo+'", length=141, parser_state=0x7883a81fe9f0)at /test/13.0_dbg/sql/sql_parse.cc:7941
      #20 0x000058af53d8f86d in dispatch_command (command=COM_QUERY, thd=0x7064d4000d58, packet=0x7064d400b4b9 "BINLOG '0gKWSRMBAAAAMQAAAHQDAAAAAB8AAAAAAAEABHRlc3QAAnQxAAIPEQMUAAYBQFUzwA==0gKWSRcBAAAAMAAAAKQDAAAAAB8AAAAAAAEAAv/8BmJpbmxvZ0mWAtIBivg3mwo+'", packet_length=141, blocking=true)at /test/13.0_dbg/sql/sql_parse.cc:1898
      #21 0x000058af53d930d3 in do_command (thd=0x7064d4000d58, blocking=true)at /test/13.0_dbg/sql/sql_parse.cc:1432
      #22 0x000058af53f90049 in do_handle_one_connection (connect=0x58af665d3658, put_in_cache=true) at /test/13.0_dbg/sql/sql_connect.cc:1503
      #23 0x000058af53f8fdee in handle_one_connection (arg=0x58af66597988)at /test/13.0_dbg/sql/sql_connect.cc:1415
      #24 0x00007883aca9caa4 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #25 0x00007883acb29c6c in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Bug Detection Matrix

          Rel    o/d  Build   Commit                                    UniqueID observed
      CS  10.6   dbg  060426  6ffb219883725fabda83d77d68df88e16b3760ad  No bug found
      CS  10.6   opt  060426  6ffb219883725fabda83d77d68df88e16b3760ad  No bug found
      CS  10.11  dbg  060426  fb9d6e444c370bcce5f00047ad335953f174897a  No bug found
      CS  10.11  opt  060426  fb9d6e444c370bcce5f00047ad335953f174897a  No bug found
      CS  11.4   dbg  060426  3b206b9cc6ac3e8a975c7e1c0b5fd72024544fe7  No bug found
      CS  11.4   opt  060426  3b206b9cc6ac3e8a975c7e1c0b5fd72024544fe7  No bug found
      CS  11.8   dbg  060426  e47db94aea7f0d6e0177e948486fc8860331f05f  No bug found
      CS  11.8   opt  060426  e47db94aea7f0d6e0177e948486fc8860331f05f  No bug found
      CS  12.2   dbg  060426  d26a6f44c1f2119377e79a9540886c6d8c01472f  No bug found
      CS  12.2   opt  060426  d26a6f44c1f2119377e79a9540886c6d8c01472f  No bug found
      CS  12.3   dbg  060426  620733d35db2108dc34ad74f35f6b4cb2722b594  res->length() > 0 && res->length() % 4 == 0|SIGABRT|mhnsw_insert|TABLE::hlindexes_on_insert|handler::ha_write_row|Write_record::single_insert
      CS  12.3   opt  060426  620733d35db2108dc34ad74f35f6b4cb2722b594  MARIADB_ERROR_CODE|MariaDB error code: 4254
      CS  13.0   dbg  070426  90f8178f33f6ecd33767a79b0f5b9b4c5a1367e5  res->length() > 0 && res->length() % 4 == 0|SIGABRT|mhnsw_insert|TABLE::hlindexes_on_insert|handler::ha_write_row|Write_record::single_insert
      CS  13.0   opt  070426  90f8178f33f6ecd33767a79b0f5b9b4c5a1367e5  MARIADB_ERROR_CODE|MariaDB error code: 4254
      ES  10.5   dbg  040825  70586522eacf09d04d49962072e14325a75d8155  No bug found
      ES  10.5   opt  040825  70586522eacf09d04d49962072e14325a75d8155  No bug found
      ES  10.6   dbg  040825  9b794f34b48fb7eee490b6da44edc0f33a947447  No bug found
      ES  10.6   opt  040825  9b794f34b48fb7eee490b6da44edc0f33a947447  No bug found
      ES  11.4   dbg  040825  a1c03ccd54b582e75506687ee19b273ca897f261  No bug found
      ES  11.4   opt  040825  a1c03ccd54b582e75506687ee19b273ca897f261  No bug found
      ES  11.8   dbg  151025  780565c207e9ce0ebf7d8e3d59f223801447b619  No bug found
      ES  11.8   opt  151025  780565c207e9ce0ebf7d8e3d59f223801447b619  No bug found
      

      Attachments

        Activity

          People

            serg Sergei Golubchik
            ramesh Ramesh Sivaraman
            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.