Bug #77540 IMPORT TABLESPACE hits debug assertion when using 4k and ROW_FORMAT=DYNAMIC
Submitted: 29 Jun 2015 12:48 Modified: 21 Jul 2015 19:24
Reporter: Marko Mäkelä Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.7.8 OS:Any
Assigned to: CPU Architecture:Any

[29 Jun 2015 12:48] Marko Mäkelä
Description:
Something in IMPORT TABLESPACE is not working correctly when using innodb_page_size=4k and ROW_FORMAT=DYNAMIC.

How to repeat:
This is simplified from innodb.innodb-wl5522-debug, which fails when using --innodb-page-size=4k and when ROW_FORMAT=DYNAMIC is made the default attribute:

--source include/not_embedded.inc
--source include/have_debug.inc
--source include/have_innodb.inc

let $MYSQLD_DATADIR =`SELECT @@datadir`;

CREATE TABLE t1 (c1 INT, c2 VARCHAR(1024), c3 BLOB) ENGINE=InnoDB
ROW_FORMAT=DYNAMIC;

INSERT IGNORE INTO t1 VALUES
	(100, REPEAT('Karanbir', 899), REPEAT('Ajeeth', 4800));
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;
INSERT INTO t1 SELECT * FROM t1;

FLUSH TABLES t1 FOR EXPORT;
--move_file $MYSQLD_DATADIR/test/t1.ibd $MYSQLD_DATADIR/test/t1b.ibd
--move_file $MYSQLD_DATADIR/test/t1.cfg $MYSQLD_DATADIR/test/t1b.cfg
UNLOCK TABLES;

ALTER TABLE t1 DISCARD TABLESPACE;
--move_file $MYSQLD_DATADIR/test/t1b.ibd $MYSQLD_DATADIR/test/t1.ibd
--move_file $MYSQLD_DATADIR/test/t1b.cfg $MYSQLD_DATADIR/test/t1.cfg

SET debug='+d,ib_import_trigger_corruption_3';
--error ER_NOT_KEYFILE
ALTER TABLE t1 IMPORT TABLESPACE;
SET debug='-d,ib_import_trigger_corruption_3';
DROP TABLE t1;

The last ALTER TABLE fails with the following stack trace:

#6  ut_dbg_assertion_failed (expr=0x1fbf609 "0", ...)
#7  buf_block_align (ptr=0x7feb7dd4b000 "") at buf/buf0buf.cc:3842
#8  mtr_t::memo_contains_page (memo=0x7feb7ca23b00, ptr=0x7feb7dd4b000 "", type=2) at mtr/mtr0mtr.cc:911
#9  ibuf_bitmap_page_get_bits_low (page=0x7feb7dd4b000 "", page_id=..., page_size=..., latch_type=2, mtr=0x7feb7ca23b00, bit=3) ibuf/ibuf0ibuf.cc:689
#10 ibuf_check_bitmap_on_import (trx=0x7feb8bb2dcf0, space_id=23) at ibuf/ibuf0ibuf.cc:5002
#11 row_import_for_mysql

Immediately before the assertion failure, the following messages were output:

2015-06-29T12:41:41.099709Z 3 [Note] InnoDB: Sync to disk - done!
2015-06-29T12:41:41.103030Z 3 [ERROR] InnoDB: Found a mismatch page, expect page [page id: space=23, page number=4097] but found [page id: space=0, page number=0]

Suggested fix:
Not sure. This does not seem to be directly related to replacing ROW_FORMAT=COMPACT with ROW_FORMAT=DYNAMIC.
[21 Jul 2015 19:24] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.8, 5.8.0 releases, and here's the changelog entry:

An ALTER TABLE ... IMPORT TABLESPACE operation with innodb_page_size=4K
and ROW_FORMAT=DYNAMIC raised an assertion. 

Thank you for the bug report.