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

assertion failure on IMPORT TABLESPACE

Details

    Description

      diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
      index 986c0508891..96e88e04986 100644
      --- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
      +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
      @@ -342,6 +342,7 @@ INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
       INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
       INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
       INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
      +INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
       
       DELETE FROM test_wl5522.t1 WHERE c2 = 1;
      

      After applying this patch test starts to crash.

      #6  __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x2431dd "space->purpose == FIL_TYPE_TEMPORARY || space->purpose == FIL_TYPE_TABLESPACE", file=file@entry=0x32fb37 "/home/kevg/work/mariadb/storage/innobase/fsp/fsp0fsp.cc", line=line@entry=2450, function=function@entry=0x3241c7 "buf_block_t *fseg_alloc_free_page_low(fil_space_t *, const page_size_t &, fseg_inode_t *, ulint, byte, rw_lock_type_t, mtr_t *, mtr_t *, ulint)") at assert.c:92
      #7  __GI___assert_fail (assertion=0x2431dd "space->purpose == FIL_TYPE_TEMPORARY || space->purpose == FIL_TYPE_TABLESPACE", file=0x32fb37 "/home/kevg/work/mariadb/storage/innobase/fsp/fsp0fsp.cc", line=2450, function=0x3241c7 "buf_block_t *fseg_alloc_free_page_low(fil_space_t *, const page_size_t &, fseg_inode_t *, ulint, byte, rw_lock_type_t, mtr_t *, mtr_t *, ulint)") at assert.c:101
      #8  fseg_alloc_free_page_low (space=0x7f5a240ae340, page_size=..., seg_inode=0x7f5a6eab9272 "", hint=229, direction=112 'p', rw_latch=RW_X_LATCH, mtr=0x7f5a740c3010, init_mtr=0x7f5a740c3010, has_done_reservation=1) at fsp0fsp.cc:2449
      #9  fseg_alloc_free_page_general (seg_header=0x7f5a6ebcc054 "", hint=229, direction=112 'p', has_done_reservation=1, mtr=0x7f5a740c3010, init_mtr=0x7f5a740c3010) at fsp0fsp.cc:2706
      #10 btr_page_alloc_low (index=0x7f5a24160708, hint_page_no=229, file_direction=112 'p', level=2, mtr=0x7f5a740c3010, init_mtr=0x7f5a740c3010) at btr0btr.cc:538
      #11 btr_page_alloc (index=0x7f5a24160708, hint_page_no=229, file_direction=112 'p', level=2, mtr=0x7f5a740c3010, init_mtr=0x7f5a740c3010) at btr0btr.cc:590
      #12 btr_page_split_and_insert (flags=23, cursor=0x7f5a740c1bd0, offsets=0x7f5a740c1888, heap=0x7f5a740c1bb8, tuple=0x7f5a2409bcc8, n_ext=0, mtr=0x7f5a740c3010) at btr0btr.cc:3058
      #13 btr_cur_pessimistic_insert (flags=23, cursor=0x7f5a740c1bd0, offsets=0x7f5a740c1888, heap=0x7f5a740c1bb8, entry=0x7f5a2409bcc8, rec=0x7f5a740c1bc0, big_rec=0x7f5a740c1c68, n_ext=0, thr=0x0, mtr=0x7f5a740c3010) at btr0cur.cc:3463
      #14 btr_insert_on_non_leaf_level_func (flags=16, index=0x7f5a24160708, level=2, tuple=0x7f5a2409bcc8, file=0x207be4 "/home/kevg/work/mariadb/storage/innobase/btr/btr0cur.cc", line=5646, mtr=0x7f5a740c3010) at btr0btr.cc:2574
      #15 btr_cur_pessimistic_delete (err=0x7f5a740c1f74, has_reserved_extents=1, cursor=0x7f5a740c1f80, flags=16, rollback=false, mtr=0x7f5a740c3010) at btr0cur.cc:5645
      #16 btr_node_ptr_delete (index=0x7f5a24160708, block=0x7f5a6e90a410, mtr=0x7f5a740c3010) at btr0btr.cc:3509
      #17 btr_compress (cursor=0x7f5a740c3528, adjust=0, mtr=0x7f5a740c3010) at btr0btr.cc:3978
      #18 btr_cur_compress_if_useful (cursor=0x7f5a740c3528, adjust=0, mtr=0x7f5a740c3010) at btr0cur.cc:5246
      #19 btr_cur_pessimistic_delete (err=0x7f5a740c2ec4, has_reserved_extents=0, cursor=0x7f5a740c3528, flags=0, rollback=false, mtr=0x7f5a740c3010) at btr0cur.cc:5666
      #20 IndexPurge::purge_pessimistic_delete (this=0x7f5a740c3008) at row0import.cc:1513
      #21 IndexPurge::purge (this=0x7f5a740c3008) at row0import.cc:1529
      #22 IndexPurge::garbage_collect (this=0x7f5a740c3008) at row0import.cc:1420
      #23 row_import_adjust_root_pages_of_secondary_indexes (prebuilt=0x7f5a240a9988, trx=0x7f5a6f2180f8, table=0x7f5a24070678, cfg=...) at row0import.cc:2266
      #24 row_import_for_mysql (table=0x7f5a24070678, prebuilt=0x7f5a240a9988) at row0import.cc:3647
      #25 ha_innobase::discard_or_import_tablespace (this=0x7f5a240a5ec8, discard=0 '\000') at ha_innodb.cc:13206
      #26 handler::ha_discard_or_import_tablespace (this=0x7f5a240a5ec8, discard=0 '\000') at handler.cc:4220
      #27 mysql_discard_or_import_tablespace (thd=0x7f5a24000d50, table_list=0x7f5a24014eb0, discard=false) at sql_table.cc:5611
      #28 Sql_cmd_discard_import_tablespace::execute (this=0x7f5a240154c0, thd=0x7f5a24000d50) at sql_alter.cc:370
      #29 mysql_execute_command (thd=0x7f5a24000d50) at sql_parse.cc:6237
      #30 mysql_parse (thd=0x7f5a24000d50, rawbuf=0x7f5a24014d98 "ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE", length=44, parser_state=0x7f5a740c8410, is_com_multi=false, is_next_command=false) at sql_parse.cc:7933
      #31 dispatch_command (command=COM_QUERY, thd=0x7f5a24000d50, packet=0x7f5a2400b1f1 "ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE", packet_length=44, is_com_multi=false, is_next_command=false) at sql_parse.cc:1827
      

      Attachments

        Activity

          I was able to repeat this on MariaDB 10.2:

          patch -p1<<EOF
          diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
          index 986c0508891..96e88e04986 100644
          --- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
          +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test
          @@ -342,6 +342,7 @@ INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
           INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
           INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
           INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
          +INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1;
           
           DELETE FROM test_wl5522.t1 WHERE c2 = 1;
           
          EOF
          ./mtr --mem innodb_zip.wl5522_debug_zip,4k
          

          CURRENT_TEST: innodb_zip.wl5522_debug_zip
          mysqltest: At line 423: query 'ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE' failed: 2013: Lost connection to MySQL server during query
          mysqld: /mariadb/10.2/storage/innobase/fsp/fsp0fsp.cc:2450: buf_block_t *fseg_alloc_free_page_low(fil_space_t *, const page_size_t &, fseg_inode_t *, ulint, byte, rw_lock_type_t, mtr_t *, mtr_t *, ulint): Assertion `space->purpose == FIL_TYPE_TEMPORARY || space->purpose == FIL_TYPE_TABLESPACE' failed.
          

          The failing assertion is too strict. It was introduced by me in MySQL 5.7.6.
          The assertion is also redundant, because the debug function fsp_space_modify_check() is asserting something similar, but more accurately.
          So, the correct solution is to remove the failing assertion.

          The patch to the test file is good for triggering the bogus assertion, but I do not intend to apply it with the fix, because it is doubling the size of the data, and our continuous integration systems are already heavily loaded.

          marko Marko Mäkelä added a comment - I was able to repeat this on MariaDB 10.2: patch -p1<<EOF diff --git a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test index 986c0508891..96e88e04986 100644 --- a/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test +++ b/mysql-test/suite/innodb_zip/t/wl5522_debug_zip.test @@ -342,6 +342,7 @@ INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; +INSERT INTO test_wl5522.t1(c2, c3, c4) SELECT c2, c3, c4 FROM test_wl5522.t1; DELETE FROM test_wl5522.t1 WHERE c2 = 1; EOF ./mtr --mem innodb_zip.wl5522_debug_zip,4k CURRENT_TEST: innodb_zip.wl5522_debug_zip mysqltest: At line 423: query 'ALTER TABLE test_wl5522.t1 IMPORT TABLESPACE' failed: 2013: Lost connection to MySQL server during query … mysqld: /mariadb/10.2/storage/innobase/fsp/fsp0fsp.cc:2450: buf_block_t *fseg_alloc_free_page_low(fil_space_t *, const page_size_t &, fseg_inode_t *, ulint, byte, rw_lock_type_t, mtr_t *, mtr_t *, ulint): Assertion `space->purpose == FIL_TYPE_TEMPORARY || space->purpose == FIL_TYPE_TABLESPACE' failed. The failing assertion is too strict. It was introduced by me in MySQL 5.7.6 . The assertion is also redundant, because the debug function fsp_space_modify_check() is asserting something similar, but more accurately. So, the correct solution is to remove the failing assertion. The patch to the test file is good for triggering the bogus assertion, but I do not intend to apply it with the fix, because it is doubling the size of the data, and our continuous integration systems are already heavily loaded.

          People

            marko Marko Mäkelä
            kevg Eugene Kosov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.