Failing assertion: block->page.space == page_get_space_id(page_align(ptr))

Bug #1004910 reported by Elena Stepanova
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
New
Undecided
Unassigned
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Invalid
Undecided
Unassigned

Bug Description

Also filed as http://bugs.mysql.com/bug.php?id=65429

Stack trace with XtraDB:

Percona XtraDB (http://www.percona.com) 1.1.8-26.0 started

InnoDB: Assertion failure in thread 140213844621056 in file buf0buf.c line 2317
InnoDB: Failing assertion: block->page.space == page_get_space_id(page_align(ptr))

#5 0x00007f86239eeb0b in __GI_abort () at abort.c:92
#6 0x0000000000ae1dc2 in buf_block_align_instance (buf_pool=0x3949628, ptr=0x7f8618c14000 "") at storage/xtradb/buf/buf0buf.c:2316
#7 0x0000000000ae1e81 in buf_block_align (ptr=0x7f8618c14000 "") at storage/xtradb/buf/buf0buf.c:2347
#8 0x0000000000b8fa2b in mtr_memo_contains_page (mtr=0x7f8614667e20, ptr=0x7f8618c14000 "", type=2) at storage/xtradb/mtr/mtr0mtr.c:369
#9 0x0000000000b55951 in ibuf_bitmap_page_get_bits_low (page=0x7f8618c14000 "", page_no=3, zip_size=0, latch_type=2, mtr=0x7f8614667e20, bit=2) at storage/xtradb/ibuf/ibuf0ibuf.c:752
#10 0x0000000000b5cec9 in ibuf_merge_or_delete_for_page (block=0x7f86188df0a0, space=10, page_no=3, zip_size=0, update_ibuf_bitmap=1) at storage/xtradb/ibuf/ibuf0ibuf.c:4495
#11 0x0000000000ae6490 in buf_page_io_complete (bpage=0x7f86188df0a0) at storage/xtradb/buf/buf0buf.c:4079
#12 0x0000000000afae83 in buf_read_page_low (err=0x7f8614668470, sync=1, mode=132, space=10, zip_size=0, unzip=0, tablespace_version=4, offset=3, trx=0x0) at storage/xtradb/buf/buf0rea.c:213
#13 0x0000000000afb33e in buf_read_page (space=10, zip_size=0, offset=3, trx=0x0) at storage/xtradb/buf/buf0rea.c:410
#14 0x0000000000ae26dd in buf_page_get_gen (space=10, zip_size=0, offset=3, rw_latch=3, guess=0x0, mode=10, file=0xe1d978 "storage/xtradb/include/btr0pcur.ic", line=519, mtr=0x7f8614668e30) at storage/xtradb/buf/buf0buf.c:2590
#15 0x0000000000ac2794 in btr_cur_open_at_index_side_func (from_left=1, index=0x3c60fa8, latch_mode=1, cursor=0x3c8e278, file=0xe1d978 "storage/xtradb/include/btr0pcur.ic", line=519, mtr=0x7f8614668e30) at storage/xtradb/btr/btr0cur.c:914
#16 0x0000000000a52c6e in btr_pcur_open_at_index_side (from_left=1, index=0x3c60fa8, latch_mode=1, pcur=0x3c8e278, do_init=0, mtr=0x7f8614668e30) at storage/xtradb/include/btr0pcur.ic:518
#17 0x0000000000a5a608 in row_search_for_mysql (buf=0x3c5d2c8 "\377", mode=1, prebuilt=0x3c8e208, match_mode=0, direction=0) at storage/xtradb/row/row0sel.c:4116
#18 0x0000000000a18e45 in ha_innobase::index_read (this=0x3c8b9d8, buf=0x3c5d2c8 "\377", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at storage/xtradb/handler/ha_innodb.cc:6739
#19 0x0000000000a19a84 in ha_innobase::index_first (this=0x3c8b9d8, buf=0x3c5d2c8 "\377") at storage/xtradb/handler/ha_innodb.cc:7090
#20 0x0000000000a19c6c in ha_innobase::rnd_next (this=0x3c8b9d8, buf=0x3c5d2c8 "\377") at storage/xtradb/handler/ha_innodb.cc:7187
#21 0x00000000005a73b4 in handler::ha_rnd_next (this=0x3c8b9d8, buf=0x3c5d2c8 "\377") at sql/sql_class.h:4263
#22 0x00000000008e0d5f in rr_sequential (info=0x3c4da70) at sql/records.cc:452
#23 0x00000000006653fc in join_init_read_record (tab=0x3c4d9c0) at sql/sql_select.cc:16949
#24 0x0000000000663538 in sub_select (join=0x3c4c9e0, join_tab=0x3c4d9c0, end_of_records=false) at sql/sql_select.cc:16095
#25 0x0000000000662e4b in do_select (join=0x3c4c9e0, fields=0x3b4b910, table=0x0, procedure=0x0) at sql/sql_select.cc:15768
#26 0x0000000000643831 in JOIN::exec (this=0x3c4c9e0) at sql/sql_select.cc:2824
#27 0x000000000064402d in mysql_select (thd=0x3b48da0, rref_pointer_array=0x3b4ba58, tables=0x3c4c348, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x3c4c9c0, unit=0x3b4b128, select_lex=0x3b4b800) at sql/sql_select.cc:3044
#28 0x000000000063ac15 in handle_select (thd=0x3b48da0, lex=0x3b4b078, result=0x3c4c9c0, setup_tables_done_option=0) at sql/sql_select.cc:313
#29 0x0000000000613ee5 in execute_sqlcom_select (thd=0x3b48da0, all_tables=0x3c4c348) at sql/sql_parse.cc:4621
#30 0x000000000060ca2a in mysql_execute_command (thd=0x3b48da0) at sql/sql_parse.cc:2189
#31 0x000000000061674d in mysql_parse (thd=0x3b48da0, rawbuf=0x3c4c168 "SELECT * FROM t1", length=16, parser_state=0x7f861466a500) at sql/sql_parse.cc:5736
#32 0x0000000000609fc3 in dispatch_command (command=COM_QUERY, thd=0x3b48da0, packet=0x3c44951 "", packet_length=16) at sql/sql_parse.cc:1055
#33 0x000000000060927a in do_command (thd=0x3b48da0) at sql/sql_parse.cc:794
#34 0x000000000070a69f in do_handle_one_connection (thd_arg=0x3b48da0) at sql/sql_connect.cc:1253
#35 0x000000000070a08a in handle_one_connection (arg=0x3b48da0) at sql/sql_connect.cc:1168
#36 0x0000000000bffcbf in pfs_spawn_thread (arg=0x3cbf360) at storage/perfschema/pfs.cc:1015
#37 0x00007f8624725efc in start_thread (arg=0x7f861466b700) at pthread_create.c:304

Stack trace with InnoDB plugin:

InnoDB: 1.1.8 started

InnoDB: Assertion failure in thread 139991125931776 in file buf0buf.c line 2080
InnoDB: Failing assertion: block->page.space == page_get_space_id(page_align(ptr))

#3 <signal handler called>
#4 0x00007f5249d4c3a5 in __GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5 0x00007f5249d4fb0b in __GI_abort () at abort.c:92
#6 0x00007f523f036e62 in buf_block_align_instance (buf_pool=0x40f9f98, ptr=0x7f523ecc8000 "") at storage/innobase/buf/buf0buf.c:2079
#7 0x00007f523f036f21 in buf_block_align (ptr=0x7f523ecc8000 "") at storage/innobase/buf/buf0buf.c:2110
#8 0x00007f523f0d72db in mtr_memo_contains_page (mtr=0x7f523954fec0, ptr=0x7f523ecc8000 "", type=2) at storage/innobase/mtr/mtr0mtr.c:368
#9 0x00007f523f09ba34 in ibuf_bitmap_page_get_bits_low (page=0x7f523ecc8000 "", page_no=3, zip_size=0, latch_type=2, mtr=0x7f523954fec0, bit=2) at storage/innobase/ibuf/ibuf0ibuf.c:710
#10 0x00007f523f0a2f6b in ibuf_merge_or_delete_for_page (block=0x7f523e7d4b28, space=1, page_no=3, zip_size=0, update_ibuf_bitmap=1) at storage/innobase/ibuf/ibuf0ibuf.c:4447
#11 0x00007f523f03aef0 in buf_page_io_complete (bpage=0x7f523e7d4b28) at storage/innobase/buf/buf0buf.c:3620
#12 0x00007f523f04dbc8 in buf_read_page_low (err=0x7f52395504c0, sync=1, mode=132, space=1, zip_size=0, unzip=0, tablespace_version=4, offset=3) at storage/innobase/buf/buf0rea.c:160
#13 0x00007f523f04e0f2 in buf_read_page (space=1, zip_size=0, offset=3) at storage/innobase/buf/buf0rea.c:355
#14 0x00007f523f0375b4 in buf_page_get_gen (space=1, zip_size=0, offset=3, rw_latch=3, guess=0x0, mode=10, file=0x7f523f208828 "storage/innobase/include/btr0pcur.ic", line=519, mtr=0x7f5239550e30) at storage/innobase/buf/buf0buf.c:2308
#15 0x00007f523f015c7c in btr_cur_open_at_index_side_func (from_left=1, index=0x454bbe8, latch_mode=1, cursor=0x4543a48, file=0x7f523f208828 "storage/innobase/include/btr0pcur.ic", line=519, mtr=0x7f5239550e30) at storage/innobase/btr/btr0cur.c:861
#16 0x00007f523f1581bd in btr_pcur_open_at_index_side (from_left=1, index=0x454bbe8, latch_mode=1, pcur=0x4543a48, do_init=0, mtr=0x7f5239550e30) at storage/innobase/include/btr0pcur.ic:518
#17 0x00007f523f15f1fe in row_search_for_mysql (buf=0x4549338 "\377", mode=1, prebuilt=0x45439d8, match_mode=0, direction=0) at storage/innobase/row/row0sel.c:3907
#18 0x00007f523f10dbe6 in ha_innodb::index_read (this=0x4541428, buf=0x4549338 "\377", key_ptr=0x0, key_len=0, find_flag=HA_READ_AFTER_KEY) at storage/innobase/handler/ha_innodb.cc:5973
#19 0x00007f523f10e71c in ha_innodb::index_first (this=0x4541428, buf=0x4549338 "\377") at storage/innobase/handler/ha_innodb.cc:6298
#20 0x00007f523f10e904 in ha_innodb::rnd_next (this=0x4541428, buf=0x4549338 "\377") at storage/innobase/handler/ha_innodb.cc:6395
#21 0x00000000005a73b4 in handler::ha_rnd_next (this=0x4541428, buf=0x4549338 "\377") at sql/sql_class.h:4263
#22 0x00000000008e0d5f in rr_sequential (info=0x43eb000) at sql/records.cc:452
#23 0x00000000006653fc in join_init_read_record (tab=0x43eaf50) at sql/sql_select.cc:16949
#24 0x0000000000663538 in sub_select (join=0x43e9f70, join_tab=0x43eaf50, end_of_records=false) at sql/sql_select.cc:16095
#25 0x0000000000662e4b in do_select (join=0x43e9f70, fields=0x42ea620, table=0x0, procedure=0x0) at sql/sql_select.cc:15768
#26 0x0000000000643831 in JOIN::exec (this=0x43e9f70) at sql/sql_select.cc:2824
#27 0x000000000064402d in mysql_select (thd=0x42e7ab0, rref_pointer_array=0x42ea768, tables=0x43e98d8, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x43e9f50, unit=0x42e9e38, select_lex=0x42ea510) at sql/sql_select.cc:3044
#28 0x000000000063ac15 in handle_select (thd=0x42e7ab0, lex=0x42e9d88, result=0x43e9f50, setup_tables_done_option=0) at sql/sql_select.cc:313
#29 0x0000000000613ee5 in execute_sqlcom_select (thd=0x42e7ab0, all_tables=0x43e98d8) at sql/sql_parse.cc:4621
#30 0x000000000060ca2a in mysql_execute_command (thd=0x42e7ab0) at sql/sql_parse.cc:2189
#31 0x000000000061674d in mysql_parse (thd=0x42e7ab0, rawbuf=0x43e96f8 "SELECT * FROM t1", length=16, parser_state=0x7f5239552500) at sql/sql_parse.cc:5736
#32 0x0000000000609fc3 in dispatch_command (command=COM_QUERY, thd=0x42e7ab0, packet=0x43e2fc1 "", packet_length=16) at sql/sql_parse.cc:1055
#33 0x000000000060927a in do_command (thd=0x42e7ab0) at sql/sql_parse.cc:794
#34 0x000000000070a69f in do_handle_one_connection (thd_arg=0x42e7ab0) at sql/sql_connect.cc:1253
#35 0x000000000070a08a in handle_one_connection (arg=0x42e7ab0) at sql/sql_connect.cc:1168
#36 0x0000000000bffcbf in pfs_spawn_thread (arg=0x455c9d0) at storage/perfschema/pfs.cc:1015
#37 0x00007f524aa86efc in start_thread (arg=0x7f5239553700) at pthread_create.c:304
#38 0x00007f5249df959d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

Some pointers may be invalid and cause the dump to abort.
Query (0x2e0ed48): SELECT * FROM t1
Connection ID (thread ID): 2
Status: NOT_KILLED

maria/5.5
bzr version-info
revision-id: <email address hidden>
date: 2012-06-24 09:10:11 -0700
revno: 3458

Also reproducible on Percona server
bzr version-info
revision-id: <email address hidden>
date: 2012-06-21 14:36:22 +0200
build-date: 2012-06-25 01:46:37 +0400
revno: 270

# Test case:
# (sometimes it takes a couple of attempts)

--source include/have_innodb.inc
SET GLOBAL innodb_file_per_table=1;

CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);

--let $datadir = `SELECT @@datadir`
--copy_file $datadir/test/t1.ibd $datadir/test/t1.ibd.save

ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_GET_ERRNO
SELECT * FROM t1;

--move_file $datadir/test/t1.ibd.save $datadir/test/t1.ibd

ALTER TABLE t1 IMPORT TABLESPACE;
SELECT * FROM t1;
DROP TABLE t1;

# End of test case

Elena Stepanova (elenst)
description: updated
Elena Stepanova (elenst)
description: updated
summary: - Failing assertion: index->id == btr_page_get_index_id(page) in
- btr0cur.c:865
+ Failing assertion: block->page.space ==
+ page_get_space_id(page_align(ptr))
Revision history for this message
Stewart Smith (stewart) wrote :

This is not a bug as the backup of the ibd file is probably not clean (the test case doesn't ensure it).

Quoting from manual ( http://dev.mysql.com/doc/mysql-enterprise-backup/3.5/en/partial.restoring.single.html ):
If you have a *clean* backup of an .ibd file, you can restore it to the MySQL installation from which it originated as follows:

In this context, a clean.ibd file backup means:

There are no uncommitted modifications by transactions in the .ibd file.

There are no unmerged insert buffer entries in the .ibd file.

Purge has removed all delete-marked index records from the .ibd file.

mysqld has flushed all modified pages of the .ibd file from the buffer pool to the file.

You can make such a clean backup .ibd file with the following method:

Stop all activity from the mysqld server and commit all transactions.

Wait until SHOW INNODB STATUS shows that there are no active transactions in the database, and the main thread status of InnoDB is Waiting for server activity. Then you can make a copy of the .ibd file.

Another method for making a clean copy of an .ibd file is to use ibbackup:

Use ibbackup to back up the InnoDB installation.

Run ibbackup --apply-log to create a consistent version of the backup database.

Start a second (dummy) mysqld server on the backup and let it clean up the .ibd files in the backup. Wait for the cleanup to end.

Shut down the dummy mysqld server.

Take a clean .ibd file from the backup.

Changed in percona-server:
status: New → Invalid
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2758

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.