innodb_import_table_from_xtrabackup Crash When Importing to Fresh ibdata1

Bug #1018309 reported by Jervin R
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.1
Won't Fix
Medium
Unassigned
5.5
Triaged
Medium
Unassigned
5.6
Invalid
Undecided
Unassigned
5.7
Invalid
Undecided
Unassigned

Bug Description

When importing multiple tablespaces into a fresh ibdata1 with innodb_import_table_from_xtrabackup Percona Server can crash and possibly corrupt the data dictionary.

Percona Server 5.5.24 and XtraBackup 2.0.1

How to repeat (with MySQL Sandbox):

1. Create several tables, I used 5, with sysbench:

sysbench --test=/home/revin/bzr/sysbench/sysbench/tests/db/parallel_prepare.lua --oltp-table-size=100 --oltp-table-name=sbtest --oltp-test-mode=nontrx --oltp-nontrx-mode=insert --oltp-tables-count=25 --max-requests=10 --num-threads=5 --mysql-db=test --mysql-user=msandbox --mysql-password=msandbox --mysql-socket=/tmp/mysql_sandbox55240.sock run

2. Take a backup:

innobackupex --defaults-file=/ssd/sb/msb_5_5_240/my.sandbox.cnf --no-timestamp /ssd/sb/bkp/201

3. Prepare the backup for export:

xtrabackup_55 --defaults-file=/ssd/sb/msb_5_5_240/my.sandbox.cnf --prepare --export --use-memory=4G --target-dir=/ssd/sb/bkp/201

5. Recreate the sandbox for fresh ibdata1:

make_sandbox 5.5.240 -- --my_clause innodb_file_per_table --my_clause innodb_buffer_pool_size=4G --my_clause innodb_flush_method=O_DIRECT

6. Create the tables and discard tablesppaces:

CREATE TABLE `sbtest1` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `k` int(10) unsigned NOT NULL DEFAULT '0',
  `c` char(120) NOT NULL DEFAULT '',
  `pad` char(60) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  KEY `k_1` (`k`)
) ENGINE=InnoDB;

CREATE TABLE sbtest2 LIKE sbtest1;
CREATE TABLE sbtest3 LIKE sbtest1;
CREATE TABLE sbtest4 LIKE sbtest1;
CREATE TABLE sbtest5 LIKE sbtest1;

ALTER TABLE sbtest1 DISCARD TABLESPACE;
ALTER TABLE sbtest2 DISCARD TABLESPACE;
ALTER TABLE sbtest3 DISCARD TABLESPACE;
ALTER TABLE sbtest4 DISCARD TABLESPACE;
ALTER TABLE sbtest5 DISCARD TABLESPACE;

7. Copy the tablespaces and exp files:

cp -v bkp/201/test/*.ibd ./msb_5_5_240/data/test/ && cp -v bkp/201/test/*.exp ./msb_5_5_240/data/test/

8. Import one by one and watch it crash:

SET GLOBAL innodb_import_table_from_xtrabackup = 1;

ALTER TABLE sbtest1 IMPORT TABLESPACE;
ALTER TABLE sbtest2 IMPORT TABLESPACE;
ALTER TABLE sbtest3 IMPORT TABLESPACE;
ALTER TABLE sbtest4 IMPORT TABLESPACE;
ALTER TABLE sbtest5 IMPORT TABLESPACE;

Revision history for this message
Jervin R (revin) wrote :

Attaching server error log - the first crash is the initial IMPORT TABLESPACE, the second crash is another attempt on the same table, the 3rd crash is an attempt to import the next table, the last is a SELECT COUNT(*) attempt on the second table.

Revision history for this message
Jervin R (revin) wrote :

A backtrace from the first crash.

Revision history for this message
Alexey Kopytov (akopytov) wrote :

There's a reproducible procedure, changing the status to Confirmed.

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-2769

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.