Commit 8bdd1250 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-16851 On schema mismatch in IMPORT TABLESPACE, display ROW_FORMAT in clear text

This is motivated by Oracle MySQL Bug #27542720 SCHEMA MISMATCH
- TABLE FLAGS DON'T MATCH, BUT FLAGS ARE NUMBERS
but using a different approach.

row_import::match_schema(): In case of a mismatch, display the
ROW_FORMAT and optionally KEY_BLOCK_SIZE of the .cfg file.
parent 34096335
DROP TABLE IF EXISTS t1;
SET GLOBAL innodb_file_per_table = 1;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
......@@ -580,7 +579,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x0)
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x0; .cfg file uses ROW_FORMAT=REDUNDANT)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
......@@ -592,7 +591,19 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x0)
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x0; .cfg file uses ROW_FORMAT=REDUNDANT)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x29 and the meta-data file has 0x0; .cfg file uses ROW_FORMAT=REDUNDANT)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
......@@ -766,7 +777,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x1)
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
......@@ -778,7 +789,19 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1)
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x29 and the meta-data file has 0x1; .cfg file uses ROW_FORMAT=COMPACT)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
......@@ -955,7 +978,7 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x21)
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x21; .cfg file uses ROW_FORMAT=DYNAMIC)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
......@@ -967,7 +990,19 @@ SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x21)
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x21; .cfg file uses ROW_FORMAT=DYNAMIC)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x29 and the meta-data file has 0x21; .cfg file uses ROW_FORMAT=DYNAMIC)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
......@@ -1026,6 +1061,220 @@ c1 c2
42 1
43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
6 1
7 1
8 1
9 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
FLUSH TABLES t1 FOR EXPORT;
backup: t1
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
unlink: t1.cfg
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
6 1
7 1
8 1
9 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x29; .cfg file uses ROW_FORMAT=COMPRESSED)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x29; .cfg file uses ROW_FORMAT=COMPRESSED)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x29; .cfg file uses ROW_FORMAT=COMPRESSED)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x23 and the meta-data file has 0x29; .cfg file uses ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8)
unlink: t1.ibd
unlink: t1.cfg
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
SELECT * FROM t1;
ERROR HY000: Tablespace has been discarded for table 't1'
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
unlink: t1.cfg
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1 ROW_FORMAT=COMPRESSED
SELECT * FROM t1;
c1 c2
1 1
2 1
3 1
4 1
6 1
7 1
8 1
9 1
13 1
14 1
15 1
16 1
17 1
18 1
19 1
20 1
28 1
29 1
30 1
31 1
32 1
33 1
34 1
35 1
36 1
37 1
38 1
39 1
40 1
41 1
42 1
43 1
DROP TABLE t1;
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
......
......@@ -3,10 +3,6 @@
-- source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_file_format = `SELECT @@innodb_file_format`;
......@@ -481,7 +477,7 @@ SELECT * FROM t1;
DROP TABLE t1;
#
# Row format tests [EXPORT REDUNDANT - IMPORT COMPACT & DYNAMIC]
# EXPORT ROW_FORMAT=REDUNDANT
#
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
......@@ -583,6 +579,29 @@ EOF
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
# This should be OK.
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
......@@ -611,7 +630,7 @@ SELECT * FROM t1;
DROP TABLE t1;
#
# Row format tests [EXPORT COMPACT - IMPORT REDUNDANT & DYNAMIC]
# EXPORT ROW_FORMAT=COMPACT
#
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
......@@ -713,6 +732,29 @@ EOF
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
# This should be OK.
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
......@@ -742,7 +784,7 @@ SELECT * FROM t1;
DROP TABLE t1;
#
# Row format tests [EXPORT DYNAMIC- IMPORT REDUNDANT & DYNAMIC]
# EXPORT ROW_FORMAT=DYNAMIC
#
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
......@@ -844,6 +886,29 @@ EOF
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
# This should be OK.
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
......@@ -872,6 +937,185 @@ SELECT * FROM t1;
DROP TABLE t1;
#
# EXPORT ROW_FORMAT=COMPRESSED
#
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
INSERT INTO t1(c2) VALUES(1);
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
INSERT INTO t1(c2) SELECT c2 FROM t1;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
FLUSH TABLES t1 FOR EXPORT;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_backup_tablespaces("test", "t1");
EOF
UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_cleanup("test", "t1");
EOF
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB
ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
--error ER_TABLE_SCHEMA_MISMATCH
ALTER TABLE t1 IMPORT TABLESPACE;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_unlink_tablespace("test", "t1");
EOF
DROP TABLE t1;
# This should be OK.
CREATE TABLE t1(
c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DISCARD TABLESPACE;
--error ER_TABLESPACE_DISCARDED
SELECT * FROM t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_discard_tablespaces("test", "t1");
ib_restore_tablespaces("test", "t1");
EOF
ALTER TABLE t1 IMPORT TABLESPACE;
CHECK TABLE t1;
perl;
do "$ENV{MTR_SUITE_DIR}/include/innodb-util.pl";
ib_cleanup("test", "t1");
EOF
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
call mtr.add_suppression("Got error -1 when reading table '.*'");
call mtr.add_suppression("InnoDB: Error: tablespace id and flags in file '.*'.*");
call mtr.add_suppression("InnoDB: The table .* doesn't have a corresponding tablespace, it was discarded");
......
/*****************************************************************************
Copyright (c) 2012, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
......@@ -1333,17 +1333,63 @@ row_import::match_schema(
{
/* Do some simple checks. */
if ((m_table->flags ^ m_flags) & ~DICT_TF_MASK_DATA_DIR) {
if (ulint mismatch = (m_table->flags ^ m_flags)
& ~DICT_TF_MASK_DATA_DIR) {
const char* msg;
if (mismatch & DICT_TF_MASK_ZIP_SSIZE) {
if ((m_table->flags & DICT_TF_MASK_ZIP_SSIZE)
&& (m_flags & DICT_TF_MASK_ZIP_SSIZE)) {
switch (m_flags & DICT_TF_MASK_ZIP_SSIZE) {
case 0U << DICT_TF_POS_ZIP_SSIZE:
goto uncompressed;
case 1U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=1";
break;
case 2U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=2";
break;
case 3U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=4";
break;
case 4U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=8";
break;
case 5U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=16";
break;
default:
msg = "strange KEY_BLOCK_SIZE";
}
} else if (m_flags & DICT_TF_MASK_ZIP_SSIZE) {
msg = "ROW_FORMAT=COMPRESSED";
} else {
goto uncompressed;
}
} else {
uncompressed:
msg = (m_flags & DICT_TF_MASK_ATOMIC_BLOBS)
? "ROW_FORMAT=DYNAMIC"
: (m_flags & DICT_TF_MASK_COMPACT)
? "ROW_FORMAT=COMPACT"
: "ROW_FORMAT=REDUNDANT";
}
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
"Table flags don't match, server table has 0x%x"
" and the meta-data file has 0x%lx",
m_table->flags, ulong(m_flags));
" and the meta-data file has 0x%lx;"
" .cfg file uses %s",
m_table->flags, ulong(m_flags), msg);
return(DB_ERROR);
} else if (m_table->n_cols != m_n_cols) {
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
"Number of columns don't match, table has %u"
" columns but the tablespace meta-data file has "
"Number of columns don't match, table has %u "
"columns but the tablespace meta-data file has "
ULINTPF " columns",
m_table->n_cols, m_n_cols);
......@@ -1822,7 +1868,6 @@ PageConverter::update_records(
while (!m_rec_iter.end()) {
rec_t* rec = m_rec_iter.current();
ibool deleted = rec_get_deleted_flag(rec, comp);
/* For the clustered index we have to adjust the BLOB
......
......@@ -1333,11 +1333,57 @@ row_import::match_schema(
{
/* Do some simple checks. */
if ((m_table->flags ^ m_flags) & ~DICT_TF_MASK_DATA_DIR) {
if (ulint mismatch = (m_table->flags ^ m_flags)
& ~DICT_TF_MASK_DATA_DIR) {
const char* msg;
if (mismatch & DICT_TF_MASK_ZIP_SSIZE) {
if ((m_table->flags & DICT_TF_MASK_ZIP_SSIZE)
&& (m_flags & DICT_TF_MASK_ZIP_SSIZE)) {
switch (m_flags & DICT_TF_MASK_ZIP_SSIZE) {
case 0U << DICT_TF_POS_ZIP_SSIZE:
goto uncompressed;
case 1U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=1";
break;
case 2U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=2";
break;
case 3U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=4";
break;
case 4U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=8";
break;
case 5U << DICT_TF_POS_ZIP_SSIZE:
msg = "ROW_FORMAT=COMPRESSED"
" KEY_BLOCK_SIZE=16";
break;
default:
msg = "strange KEY_BLOCK_SIZE";
}
} else if (m_flags & DICT_TF_MASK_ZIP_SSIZE) {
msg = "ROW_FORMAT=COMPRESSED";
} else {
goto uncompressed;
}
} else {
uncompressed:
msg = (m_flags & DICT_TF_MASK_ATOMIC_BLOBS)
? "ROW_FORMAT=DYNAMIC"
: (m_flags & DICT_TF_MASK_COMPACT)
? "ROW_FORMAT=COMPACT"
: "ROW_FORMAT=REDUNDANT";
}
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
"Table flags don't match, server table has 0x%x"
" and the meta-data file has 0x%lx",
m_table->flags, ulong(m_flags));
" and the meta-data file has 0x%lx;"
" .cfg file uses %s",
m_table->flags, ulong(m_flags), msg);
return(DB_ERROR);
} else if (m_table->n_cols != m_n_cols) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment