Skip to content

Commit e484ab3

Browse files
author
Aakanksha Verma
committed
Bug #27542720 SCHEMA MISMATCH - TABLE FLAGS DON'T MATCH, BUT FLAGS ARE
NUMBERS PROBLEM During a schema mismatch of flags when tablespace import is attempted the concerned server table flags are not printed instead number of columns are printed , also the table flags are not human readable. FIX Print the table flags instead of columns and in human readable string format for the user's convinience. Reviewed by: Allen Lai<zheng.lai@oracle.com> RB :19156
1 parent 8314278 commit e484ab3

File tree

4 files changed

+64
-11
lines changed

4 files changed

+64
-11
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
2+
FLUSH TABLES t1 FOR EXPORT;
3+
UNLOCK TABLES;
4+
DROP TABLE t1;
5+
SET GLOBAL innodb_file_format=`Barracuda`;
6+
SET GLOBAL innodb_file_per_table= ON;
7+
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
8+
ALTER TABLE t1 DISCARD TABLESPACE;
9+
ALTER TABLE t1 IMPORT TABLESPACE;
10+
ERROR HY000: Schema mismatch (Table flags don't match,server table has ROW_TYPE_DYNAMIC and the meta-data file has ROW_TYPE_COMPACT)
11+
DROP TABLE t1;
12+
SET GLOBAL innodb_file_format=`Antelope`;

mysql-test/suite/innodb/r/innodb-wl5522.result

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ SELECT * FROM t1;
580580
ERROR HY000: Tablespace has been discarded for table 't1'
581581
restore: t1 .ibd and .cfg files
582582
ALTER TABLE t1 IMPORT TABLESPACE;
583-
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x0)
583+
ERROR HY000: Schema mismatch (Table flags don't match,server table has ROW_TYPE_COMPACT and the meta-data file has ROW_TYPE_REDUNDANT)
584584
unlink: t1.ibd
585585
unlink: t1.cfg
586586
DROP TABLE t1;
@@ -592,7 +592,7 @@ SELECT * FROM t1;
592592
ERROR HY000: Tablespace has been discarded for table 't1'
593593
restore: t1 .ibd and .cfg files
594594
ALTER TABLE t1 IMPORT TABLESPACE;
595-
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x0)
595+
ERROR HY000: Schema mismatch (Table flags don't match,server table has ROW_TYPE_DYNAMIC and the meta-data file has ROW_TYPE_REDUNDANT)
596596
unlink: t1.ibd
597597
unlink: t1.cfg
598598
DROP TABLE t1;
@@ -766,7 +766,7 @@ SELECT * FROM t1;
766766
ERROR HY000: Tablespace has been discarded for table 't1'
767767
restore: t1 .ibd and .cfg files
768768
ALTER TABLE t1 IMPORT TABLESPACE;
769-
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1)
769+
ERROR HY000: Schema mismatch (Table flags don't match,server table has ROW_TYPE_REDUNDANT and the meta-data file has ROW_TYPE_COMPACT)
770770
unlink: t1.ibd
771771
unlink: t1.cfg
772772
DROP TABLE t1;
@@ -778,7 +778,7 @@ SELECT * FROM t1;
778778
ERROR HY000: Tablespace has been discarded for table 't1'
779779
restore: t1 .ibd and .cfg files
780780
ALTER TABLE t1 IMPORT TABLESPACE;
781-
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1)
781+
ERROR HY000: Schema mismatch (Table flags don't match,server table has ROW_TYPE_DYNAMIC and the meta-data file has ROW_TYPE_COMPACT)
782782
unlink: t1.ibd
783783
unlink: t1.cfg
784784
DROP TABLE t1;
@@ -955,7 +955,7 @@ SELECT * FROM t1;
955955
ERROR HY000: Tablespace has been discarded for table 't1'
956956
restore: t1 .ibd and .cfg files
957957
ALTER TABLE t1 IMPORT TABLESPACE;
958-
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x21)
958+
ERROR HY000: Schema mismatch (Table flags don't match,server table has ROW_TYPE_COMPACT and the meta-data file has ROW_TYPE_DYNAMIC)
959959
unlink: t1.ibd
960960
unlink: t1.cfg
961961
DROP TABLE t1;
@@ -967,7 +967,7 @@ SELECT * FROM t1;
967967
ERROR HY000: Tablespace has been discarded for table 't1'
968968
restore: t1 .ibd and .cfg files
969969
ALTER TABLE t1 IMPORT TABLESPACE;
970-
ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x21)
970+
ERROR HY000: Schema mismatch (Table flags don't match,server table has ROW_TYPE_REDUNDANT and the meta-data file has ROW_TYPE_DYNAMIC)
971971
unlink: t1.ibd
972972
unlink: t1.cfg
973973
DROP TABLE t1;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#
2+
#Bug #27542720 SCHEMA MISMATCH - TABLE FLAGS DON'T MATCH,
3+
# BUT FLAGS ARE NUMBERS
4+
#
5+
6+
7+
--source include/have_innodb.inc
8+
9+
--let $MYSQLD_DATADIR=`select @@datadir`
10+
--let $DB = `SELECT DATABASE()`
11+
#--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
12+
13+
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPACT;
14+
FLUSH TABLES t1 FOR EXPORT;
15+
#--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
16+
--copy_file $MYSQLD_DATADIR/$DB/t1.ibd $MYSQL_TMP_DIR/t1.ibd
17+
--copy_file $MYSQLD_DATADIR/$DB/t1.cfg $MYSQL_TMP_DIR/t1.cfg
18+
19+
UNLOCK TABLES;
20+
DROP TABLE t1;
21+
SET GLOBAL innodb_file_format=`Barracuda`;
22+
SET GLOBAL innodb_file_per_table= ON;
23+
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
24+
ALTER TABLE t1 DISCARD TABLESPACE;
25+
--copy_file $MYSQL_TMP_DIR/t1.ibd $MYSQLD_DATADIR/$DB/t1.ibd
26+
--copy_file $MYSQL_TMP_DIR/t1.cfg $MYSQLD_DATADIR/$DB/t1.cfg
27+
28+
--error ER_TABLE_SCHEMA_MISMATCH
29+
ALTER TABLE t1 IMPORT TABLESPACE;
30+
DROP TABLE t1;
31+
32+
SET GLOBAL innodb_file_format=`Antelope`;

storage/innobase/row/row0import.cc

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,11 +1337,20 @@ row_import::match_schema(
13371337
/* Do some simple checks. */
13381338

13391339
if (m_flags != m_table->flags) {
1340-
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,
1341-
"Table flags don't match, server table has 0x%lx "
1342-
"and the meta-data file has 0x%lx",
1343-
(ulong) m_table->n_cols, (ulong) m_flags);
1344-
1340+
if (dict_tf_to_row_format_string(m_flags) !=
1341+
dict_tf_to_row_format_string(m_table->flags)) {
1342+
ib_errf(thd, IB_LOG_LEVEL_ERROR,
1343+
ER_TABLE_SCHEMA_MISMATCH,
1344+
"Table flags don't match,"
1345+
"server table has %s "
1346+
"and the meta-data file has %s",
1347+
dict_tf_to_row_format_string(m_table->flags),
1348+
dict_tf_to_row_format_string(m_flags));
1349+
} else {
1350+
ib_errf(thd, IB_LOG_LEVEL_ERROR,
1351+
ER_TABLE_SCHEMA_MISMATCH,
1352+
"Table flags don't match");
1353+
}
13451354
return(DB_ERROR);
13461355
} else if (m_table->n_cols != m_n_cols) {
13471356
ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH,

0 commit comments

Comments
 (0)