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

InnoDB: Failing assertion: block->magic_n == MEM_BLOCK_MAGIC_N



    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1.34, 10.2.17
    • Fix Version/s: 10.1, 10.2
    • Labels:
    • Environment:
      Ubuntu 17.10 but I assume this is unimportant.


      All MariaDB versions were compiled from source with debug.

      Issue replay on
      10.2 commit f4eac2deeb046a68e4a26ed1a08f8df51bbf817b 2018-07-31
      CREATE TABLE IF NOT EXISTS t1 (col1 INT, col4 VARCHAR(100)) ENGINE = InnoDB ;
      SET SESSION DEBUG_DBUG = '+d,row_drop_table_add_to_background' ;
      ALTER TABLE t1 ADD FULLTEXT INDEX `ftidx1` ( col4 ) ;
      Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
      SET SESSION DEBUG_DBUG = '+d,row_drop_table_add_to_background' ;
      ALTER TABLE t1 DROP INDEX `ftidx1`;
      SET SESSION DEBUG_DBUG = '+d,row_drop_table_add_to_background' ;
      ALTER TABLE t1 ADD FULLTEXT INDEX `ftidx1` ( col4 ) ;
      main.bug11 'innodb' [ fail ]
      Test ended at 2018-08-01 18:03:35

      CURRENT_TEST: main.bug11
      mysqltest: At line 12: query 'ALTER TABLE t1 ADD FULLTEXT INDEX `ftidx1` ( col4 ) ' failed: 2013: Lost connection to MySQL server during query

      Version: '10.2.17-MariaDB-debug-log' ...
      [ERROR] InnoDB: Operating system error number 17 in a file operation.
      [ERROR] InnoDB: Error number 17 means 'File exists'
      [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
      [ERROR] InnoDB: Cannot create file './test/FTS_0000000000000014_BEING_DELETED.ibd'
      [Note] InnoDB: The file './test/FTS_0000000000000014_BEING_DELETED.ibd' already exists though the corresponding table did not exist in the InnoDB data dictionary. You can resolve the problem by removing the file.
      InnoDB: Assertion failure in file /home/mleich/Server/10.2/storage/innobase/include/mem0mem.ic line 156
      InnoDB: Failing assertion: block->magic_n == MEM_BLOCK_MAGIC_N
      ALTER TABLE t1 ADD FULLTEXT INDEX `ftidx1` ( col4 );

      #3 <signal handler called>
      #4 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5 __GI_abort () at abort.c:90
      #6 ut_dbg_assertion_failed (expr=0x557237647870 "block->magic_n == MEM_BLOCK_MAGIC_N", file=0x557237647800 "storage/innobase/include/mem0mem.ic", line=156) at storage/innobase/ut/ut0dbg.cc:61
      #7 mem_block_validate (block=0x7fcefc050980) at storage/innobase/include/mem0mem.ic:156
      #8 mem_heap_free (heap=0x7fcefc050980) at storage/innobase/include/mem0mem.ic:515
      #9 dict_mem_table_free (table=0x7fcefc055488) at storage/innobase/dict/dict0mem.cc:212
      #10 fts_create_one_common_table (trx=0x7fcf5412f7e8, table=0x7fcefc132ef8, fts_table_name=0x7fcf4f4fcd50 "test/FTS_", '0' <repeats 14 times>, "14_BEING_DELETED", fts_suffix=0x557237668514 "BEING_DELETED", heap=0x7fcefc03fd80) at storage/innobase/fts/fts0fts.cc:1842
      #11 fts_create_common_tables (trx=0x7fcf5412f7e8, table=0x7fcefc132ef8, name=0x7fcefc007eb0 "test/t1", skip_doc_id_index=true) at storage/innobase/fts/fts0fts.cc:1906
      #12 prepare_inplace_alter_table_dict (ha_alter_info=0x7fcf4f4fe5e0, altered_table=0x7fcefc03e5f8, old_table=0x7fcefc119d08, table_name=0x7fcefc155ed5 "t1", flags=33, flags2=84, fts_doc_id_col=2, add_fts_doc_id=false, add_fts_doc_id_idx=false) at storage/innobase/handler/handler0alter.cc:5014
      #13 ha_innobase::prepare_inplace_alter_table (this=0x7fcefc11c240, altered_table=0x7fcefc03e5f8, ha_alter_info=0x7fcf4f4fe5e0) at storage/innobase/handler/handler0alter.cc:6269
      #14 handler::ha_prepare_inplace_alter_table (this=0x7fcefc11c240, altered_table=0x7fcefc03e5f8, ha_alter_info=0x7fcf4f4fe5e0) at sql/handler.cc:4210
      #15 mysql_inplace_alter_table (thd=0x7fcefc000ce8, table_list=0x7fcefc011a58, table=0x7fcefc119d08, altered_table=0x7fcefc03e5f8, ha_alter_info=0x7fcf4f4fe5e0, inplace_supported=HA_ALTER_INPLACE_SHARED_LOCK_AFTER_PREPARE, target_mdl_request=0x7fcf4f4fe650, alter_ctx=0x7fcf4f4ff210) at sql/sql_table.cc:7330
      #16 mysql_alter_table (thd=0x7fcefc000ce8, new_db=0x7fcefc012068 "test", new_name=0x0, create_info=0x7fcf4f4ffe30, table_list=0x7fcefc011a58, alter_info=0x7fcf4f4ffd80, order_num=0, order=0x0, ignore=false) at sql/sql_table.cc:9388
      #17 Sql_cmd_alter_table::execute (this=0x7fcefc012150, thd=0x7fcefc000ce8) at sql/sql_alter.cc:318
      #18 mysql_execute_command (thd=0x7fcefc000ce8) at sql/sql_parse.cc:6222
      #19 mysql_parse (thd=0x7fcefc000ce8, rawbuf=0x7fcefc011940 "ALTER TABLE t1 ADD FULLTEXT INDEX `ftidx1` ( col4 )", length=51, parser_state=0x7fcf4f5011f0, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:7995
      #20 dispatch_command (command=COM_QUERY, thd=0x7fcefc000ce8, packet=0x7fcefc008499 "ALTER TABLE t1 ADD FULLTEXT INDEX `ftidx1` ( col4 )", ' ' <repeats 12 times>, packet_length=63, is_com_multi=false, is_next_command=false) at sql/sql_parse.cc:1820
      #21 do_command (thd=0x7fcefc000ce8) at sql/sql_parse.cc:1374
      #22 do_handle_one_connection (connect=0x557239908088) at sql/sql_connect.cc:1335
      #23 handle_one_connection (arg=0x557239908088) at sql/sql_connect.cc:1241

      10.1 commit c69357d8d4592b746a2dd7074c8fb6a437098b2a 2018-06-14
      InnoDB: Assertion failure in thread 140711726299904 in file row0merge.cc line 3092
      InnoDB: Failing assertion: trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX
      The backtrace looks quite different than the one from 10.2.

      No replay on
      10.3 commit 0c745c743c65ceb6533babdf21556b633e81566c 2018-07-29
      This might be caused by
      MDEV-15348 InnoDB: Failing assertion: block->magic_n == MEM_BLOCK_MAGIC_N
      which was applied to 10.3.6. But that needs to be confirmed by some InnoDB developer.

      1. I am not an expert of InnoDB code. And so I do not know if
      SET SESSION DEBUG_DBUG = '+d,row_drop_table_add_to_background' ;
      brings the server intentional into a state which must be cured by shutdown/restart
      (roughly the DEBUG_DBUG ... is for tests checking the restart or similar).
      If that would be true than please just delete the issue.
      2. I do not claim that the issue must be fixed in 10.2.
      Its rather that some expert should look if that issue revealed by the test is capable
      to cause serious problems to users and than decide to fix it or not or to change the


        1. bug11.prt
          54 kB
        2. bug11.test
          0.6 kB

          Issue Links



              thiru Thirunarayanan Balathandayuthapani
              mleich Matthias Leich
              0 Vote for this issue
              2 Start watching this issue