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

Assertion `err != DB_SUCCESS || btr_validate_index(m_index, __null) == DB_SUCCESS' failed in BtrBulk::finish and corruption (10.4.12)

    XMLWordPrintable

    Details

      Description

      Not present in recent 10.4, nor 10.6. Discussed with Marko and agreed to log for back-analysis.

      # Repeat until server crashes (usually quite quickly)
      # mysqld options required for replay:  --innodb_strict_mode=OFF
      CREATE TABLE t (c CHAR(250) CHARACTER SET utf32,KEY(c)) ENGINE=InnoDB;
      INSERT INTO t VALUES (0); 
      ALTER TABLE t KEY_BLOCK_SIZE=1;
      

      Leads to:

      10.4.12 ba6bfc402c352372cc1a9ec20b5dc50b2204549f (Debug)

      mysqld: /test/10.4_dbg/storage/innobase/btr/btr0bulk.cc:1051: dberr_t BtrBulk::finish(dberr_t): Assertion `err != DB_SUCCESS || btr_validate_index(m_index, __null) == DB_SUCCESS' failed.
      

      10.4.12 ba6bfc402c352372cc1a9ec20b5dc50b2204549f (Debug)

      Version: '10.4.12-MariaDB-debug-log'  socket: '/test/MD210521-mariadb-10.4.12-linux-x86_64-dbg/socket.sock'  port: 30843  MariaDB Server
      2021-06-01 21:03:34 40 [Note] InnoDB: Record in index `GEN_CLUST_INDEX` of table `test`.`#sql-1afc91_28`, page [page id: space=6, page number=3], at offset 128
      2021-06-01 21:03:34 40 [ERROR] InnoDB: Field 3 len is 20, should be 1000; COMPACT RECORD(info_bits=0, 4 fields): {[6]      (0x000000000200),[6]      (0x000000000000),[7]       (0x80000000000000),[0+20](0x)(0x00000006000000090000000C00000000000003E8)}
      2021-06-01 21:03:34 40 [Note] InnoDB: Record in index `GEN_CLUST_INDEX` of table `test`.`#sql-1afc91_28`, page [page id: space=6, page number=3], at offset 128
      2021-06-01 21:03:34 40 [ERROR] InnoDB: Field 3 len is 20, should be 1000; COMPACT RECORD(info_bits=0, 4 fields): {[6]      (0x000000000200),[6]      (0x000000000000),[7]       (0x80000000000000),[0+20](0x)(0x00000006000000090000000C00000000000003E8)}
      mysqld: /test/10.4_dbg/storage/innobase/btr/btr0bulk.cc:1051: dberr_t BtrBulk::finish(dberr_t): Assertion `err != DB_SUCCESS || btr_validate_index(m_index, __null) == DB_SUCCESS' failed.
      

      10.4.12 ba6bfc402c352372cc1a9ec20b5dc50b2204549f (Debug)

      Core was generated by `/test/MD210521-mariadb-10.4.12-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x1486c8720700 (LWP 1768970))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x00001486de393859 in __GI_abort () at abort.c:79
      #2  0x00001486de393729 in __assert_fail_base (fmt=0x1486de529588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55e4597d21a0 "err != DB_SUCCESS || btr_validate_index(m_index, __null) == DB_SUCCESS", file=0x55e4597d1ba8 "/test/10.4_dbg/storage/innobase/btr/btr0bulk.cc", line=1051, function=<optimized out>) at assert.c:92
      #3  0x00001486de3a4f36 in __GI___assert_fail (assertion=assertion@entry=0x55e4597d21a0 "err != DB_SUCCESS || btr_validate_index(m_index, __null) == DB_SUCCESS", file=file@entry=0x55e4597d1ba8 "/test/10.4_dbg/storage/innobase/btr/btr0bulk.cc", line=line@entry=1051, function=function@entry=0x55e4597d2178 "dberr_t BtrBulk::finish(dberr_t)") at assert.c:101
      #4  0x000055e459104868 in BtrBulk::finish (this=this@entry=0x14860c090590, err=<optimized out>) at /test/10.4_dbg/storage/innobase/btr/btr0bulk.cc:1051
      #5  0x000055e458fe497a in row_merge_read_clustered_index (allow_not_null=<optimized out>, eval_table=<optimized out>, crypt_block=<optimized out>, pct_cost=<optimized out>, stage=<optimized out>, tmpfd=0x1486c8719680, skip_pk_sort=<optimized out>, block=<optimized out>, sequence=<optimized out>, add_autoinc=<optimized out>, col_map=<optimized out>, add_v=<optimized out>, defaults=<optimized out>, n_index=<optimized out>, key_numbers=<optimized out>, files=<optimized out>, psort_info=<optimized out>, fts_sort_idx=<optimized out>, index=<optimized out>, online=<optimized out>, new_table=<optimized out>, old_table=0x14860c01f7d8, table=<optimized out>, trx=<optimized out>) at /test/10.4_dbg/storage/innobase/row/row0merge.cc:2530
      #6  row_merge_build_indexes (trx=<optimized out>, old_table=0x14860c01f7d8, new_table=<optimized out>, online=<optimized out>, indexes=<optimized out>, key_numbers=<optimized out>, n_indexes=<optimized out>, table=<optimized out>, defaults=<optimized out>, col_map=<optimized out>, add_autoinc=<optimized out>, sequence=<optimized out>, skip_pk_sort=<optimized out>, stage=<optimized out>, add_v=<optimized out>, eval_table=<optimized out>, allow_not_null=<optimized out>) at /test/10.4_dbg/storage/innobase/row/row0merge.cc:4704
      #7  0x000055e458e8d422 in ha_innobase::inplace_alter_table (this=0x14860c02a758, altered_table=0x1486c871a910, ha_alter_info=0x1486c871a880) at /test/10.4_dbg/storage/innobase/handler/handler0alter.cc:8363
      #8  0x000055e4589d842c in handler::ha_inplace_alter_table (ha_alter_info=0x1486c871a880, altered_table=0x1486c871a910, this=<optimized out>) at /test/10.4_dbg/sql/handler.h:4361
      #9  mysql_inplace_alter_table (thd=thd@entry=0x14860c000d90, table_list=0x14860c0120c0, table=table@entry=0x14860c0298f0, altered_table=altered_table@entry=0x1486c871a910, ha_alter_info=ha_alter_info@entry=0x1486c871a880, inplace_supported=inplace_supported@entry=HA_ALTER_INPLACE_COPY_NO_LOCK, target_mdl_request=0x1486c871b6e0, alter_ctx=0x1486c871c210) at /test/10.4_dbg/sql/sql_table.cc:7725
      #10 0x000055e4589e6a72 in mysql_alter_table (thd=thd@entry=0x14860c000d90, new_db=new_db@entry=0x14860c005550, new_name=new_name@entry=0x14860c005958, create_info=create_info@entry=0x1486c871cdf0, table_list=<optimized out>, table_list@entry=0x14860c0120c0, alter_info=alter_info@entry=0x1486c871cd30, order_num=0, order=0x0, ignore=false) at /test/10.4_dbg/sql/sql_table.cc:10119
      #11 0x000055e458a609d3 in Sql_cmd_alter_table::execute (this=0x14860c012790, thd=0x14860c000d90) at /test/10.4_dbg/sql/sql_alter.cc:502
      #12 0x000055e45891ad7b in mysql_execute_command (thd=thd@entry=0x14860c000d90) at /test/10.4_dbg/sql/sql_parse.cc:6102
      #13 0x000055e45891d456 in mysql_parse (thd=thd@entry=0x14860c000d90, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x1486c871f090, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:7901
      #14 0x000055e4589201de in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14860c000d90, packet=packet@entry=0x14860c01a351 "ALTER TABLE t KEY_BLOCK_SIZE=1", packet_length=packet_length@entry=30, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_class.h:1168
      #15 0x000055e458923dec in do_command (thd=0x14860c000d90) at /test/10.4_dbg/sql/sql_parse.cc:1359
      #16 0x000055e458a59e0c in do_handle_one_connection (connect=connect@entry=0x55e45c48a4f0) at /test/10.4_dbg/sql/sql_connect.cc:1412
      #17 0x000055e458a59f2b in handle_one_connection (arg=0x55e45c48a4f0) at /test/10.4_dbg/sql/sql_connect.cc:1316
      #18 0x00001486de950609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #19 0x00001486de490293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.4.12 (dbg)
      MySQL: 5.7.34 (dbg), 8.0.24 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.2.38 (dbg), 10.2.38 (opt), 10.3.29 (dbg), 10.3.29 (opt), 10.4.19 (dbg), 10.4.19 (opt), 10.5.10 (dbg), 10.5.10 (opt), 10.6.1 (dbg), 10.6.1 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (opt), 8.0.24 (opt)

      MS 8:

      MySQL 8.0.24 (Debug)

      Core was generated by `/test/MS290421-mysql-8.0.24-linux-x86_64-dbg/bin/mysqld --no-defaults --core-fi'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      [Current thread is 1 (Thread 0x14691ea90700 (LWP 2080973))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:56
      #1  0x0000556069efff59 in my_write_core (sig=sig@entry=6) at /test/8.0_dbg/include/my_thread.h:88
      #2  0x0000556068b1c5bc in handle_fatal_signal (sig=6) at /test/8.0_dbg/sql/signal_handler.cc:171
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #5  0x0000146989e9e859 in __GI_abort () at abort.c:79
      #6  0x000055606a368ee1 in ut_dbg_assertion_failed (expr=expr@entry=0x55606b5c1110 "err != DB_SUCCESS || btr_validate_index(m_index, nullptr, false)", file=file@entry=0x55606b5c0c58 "/test/8.0_dbg/storage/innobase/btr/btr0bulk.cc", line=line@entry=1126) at /test/8.0_dbg/storage/innobase/ut/ut0dbg.cc:99
      #7  0x000055606a413683 in BtrBulk::finish (this=this@entry=0x1468d0a42910, err=DB_SUCCESS) at /test/8.0_dbg/storage/innobase/btr/btr0bulk.cc:1126
      #8  0x000055606a208c0e in row_merge_read_clustered_index (trx=trx@entry=0x14697d5b4078, table=table@entry=0x1468d0a367e0, old_table=old_table@entry=0x1468d00b6e20, new_table=new_table@entry=0x1468d0024ef0, online=online@entry=true, index=index@entry=0x1468d0a3fc00, fts_sort_idx=0x0, psort_info=0x0, files=0x1468d0a6fc90, key_numbers=0x1468d0a3fc30, n_index=2, add_cols=0x0, add_v=0x0, col_map=0x1468d0a41a90, add_autoinc=18446744073709551615, sequence=@0x1468d00c1b20: {m_max_value = 0, m_increment = 0, m_offset = 0, m_next_value = 0, m_eof = true}, block=0x14691e749000 <error: Cannot access memory at address 0x14691e749000>, skip_pk_sort=true, tmpfd=0x14691ea8a22c, stage=0x1468d0a44d40, eval_table=0x1468d0a367e0) at /test/8.0_dbg/storage/innobase/row/row0merge.cc:2228
      #9  0x000055606a209f9a in row_merge_build_indexes (trx=0x14697d5b4078, old_table=0x1468d00b6e20, new_table=0x1468d0024ef0, online=true, indexes=0x1468d0a3fc00, key_numbers=0x1468d0a3fc30, n_indexes=2, table=0x1468d0a367e0, add_cols=0x0, col_map=0x1468d0a41a90, add_autoinc=18446744073709551615, sequence=@0x1468d00c1b20: {m_max_value = 0, m_increment = 0, m_offset = 0, m_next_value = 0, m_eof = true}, skip_pk_sort=true, stage=0x1468d0a44d40, add_v=0x0, eval_table=0x1468d0a367e0) at /test/8.0_dbg/storage/innobase/row/row0merge.cc:3753
      #10 0x000055606a06200f in ha_innobase::inplace_alter_table_impl<dd::Table> (this=this@entry=0x1468d0120238, altered_table=altered_table@entry=0x1468d0a367e0, ha_alter_info=ha_alter_info@entry=0x14691ea8b210, old_dd_tab=old_dd_tab@entry=0x1468d0026158, new_dd_tab=new_dd_tab@entry=0x1468d000e818) at /test/8.0_dbg/storage/innobase/handler/handler0alter.cc:304
      #11 0x000055606a04f556 in ha_innobase::inplace_alter_table (this=0x1468d0120238, altered_table=0x1468d0a367e0, ha_alter_info=0x14691ea8b210, old_dd_tab=0x1468d0026158, new_dd_tab=0x1468d000e818) at /test/8.0_dbg/storage/innobase/handler/handler0alter.cc:1281
      #12 0x0000556068a300a2 in handler::ha_inplace_alter_table (new_table_def=0x1468d000e818, old_table_def=0x1468d0026158, ha_alter_info=0x14691ea8b210, altered_table=0x1468d0a367e0, this=<optimized out>) at /test/8.0_dbg/sql/handler.h:5859
      #13 mysql_inplace_alter_table (thd=thd@entry=0x1468d0000be0, schema=@0x1468d00113c8: {<dd::Entity_object> = {<dd::Weak_object> = {_vptr.Weak_object = 0x55606c012338 <vtable for dd::Schema_impl+512>}, <No data fields>}, <No data fields>}, new_schema=@0x1468d00113c8: {<dd::Entity_object> = {<dd::Weak_object> = {_vptr.Weak_object = 0x55606c012338 <vtable for dd::Schema_impl+512>}, <No data fields>}, <No data fields>}, table_def=0x1468d0026158, altered_table_def=0x1468d000e818, table_list=0x1468d00bf360, table=0x1468d011ee40, altered_table=0x1468d0a367e0, ha_alter_info=0x14691ea8b210, inplace_supported=HA_ALTER_INPLACE_NO_LOCK_AFTER_PREPARE, alter_ctx=0x14691ea8bce0, columns=Python Exception <class 'AttributeError'> 'NoneType' object has no attribute 'pointer': 
      std::set with 0 elements, fk_key_info=0x1468d00c1798, fk_key_count=0, fk_invalidator=0x14691ea8b150) at /test/8.0_dbg/sql/sql_table.cc:13025
      #14 0x0000556068a470c7 in mysql_alter_table (thd=thd@entry=0x1468d0000be0, new_db=0x1468d00bf978 "test", new_name=0x0, create_info=create_info@entry=0x14691ea8cfe0, table_list=<optimized out>, table_list@entry=0x1468d00bf360, alter_info=alter_info@entry=0x14691ea8d120) at /test/8.0_dbg/sql/sql_table.cc:16924
      #15 0x0000556068f3629b in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x1468d0000be0) at /test/8.0_dbg/sql/sql_alter.cc:349
      #16 0x00005560689687c1 in mysql_execute_command (thd=thd@entry=0x1468d0000be0, first_level=first_level@entry=true) at /test/8.0_dbg/sql/sql_parse.cc:4412
      #17 0x000055606896a0bd in dispatch_sql_command (thd=thd@entry=0x1468d0000be0, parser_state=parser_state@entry=0x14691ea8eb90) at /test/8.0_dbg/sql/sql_parse.cc:5000
      #18 0x000055606896c54b in dispatch_command (thd=thd@entry=0x1468d0000be0, com_data=com_data@entry=0x14691ea8fba0, command=COM_QUERY) at /test/8.0_dbg/sql/sql_parse.cc:1841
      #19 0x000055606896efab in do_command (thd=thd@entry=0x1468d0000be0) at /test/8.0_dbg/sql/sql_parse.cc:1320
      #20 0x0000556068b0a619 in handle_connection (arg=arg@entry=0x55606f69b610) at /test/8.0_dbg/sql/conn_handler/connection_handler_per_thread.cc:301
      #21 0x000055606a74558f in pfs_spawn_thread (arg=0x55606f739590) at /test/8.0_dbg/storage/perfschema/pfs.cc:2898
      #22 0x000014698a835609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #23 0x0000146989f9b293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marko Marko Mäkelä
              Reporter:
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: