summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-12-15 16:38:46 +0100
committerSergei Golubchik <serg@mariadb.org>2017-12-18 16:16:42 +0100
commit03e91ce324465e465468021edd050c3b73d4cee3 (patch)
tree8a1abf1699d8686fa9605b1b6895153079dec825
parentc1e5fef05d87038fff8b55ba763d082a5bec5d78 (diff)
downloadmariadb-git-03e91ce324465e465468021edd050c3b73d4cee3.tar.gz
MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
make sure that mysql_create_frm_image() and fast_alter_partition_table() use the same code to derive HA_OPTION_PACK_RECORD from create_info->row_type.
-rw-r--r--mysql-test/suite/parts/r/partition_alter_myisam.result10
-rw-r--r--mysql-test/suite/parts/t/partition_alter_myisam.test17
-rw-r--r--sql/handler.h7
-rw-r--r--sql/sql_partition.cc5
-rw-r--r--sql/sql_table.cc5
5 files changed, 36 insertions, 8 deletions
diff --git a/mysql-test/suite/parts/r/partition_alter_myisam.result b/mysql-test/suite/parts/r/partition_alter_myisam.result
new file mode 100644
index 00000000000..514593fd4ef
--- /dev/null
+++ b/mysql-test/suite/parts/r/partition_alter_myisam.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (i INT) ENGINE=MYISAM
+PARTITION BY LIST(i) (
+PARTITION p0 VALUES IN (1),
+PARTITION p1 VALUES IN (2)
+);
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+ALTER TABLE t1 DROP PARTITION p1;
+SELECT * FROM t1;
+i
+DROP TABLE t1;
diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test
new file mode 100644
index 00000000000..91ce8d21327
--- /dev/null
+++ b/mysql-test/suite/parts/t/partition_alter_myisam.test
@@ -0,0 +1,17 @@
+#
+# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
+#
+
+--source include/have_partition.inc
+
+CREATE TABLE t1 (i INT) ENGINE=MYISAM
+PARTITION BY LIST(i) (
+ PARTITION p0 VALUES IN (1),
+ PARTITION p1 VALUES IN (2)
+);
+ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
+ALTER TABLE t1 DROP PARTITION p1;
+SELECT * FROM t1;
+
+# Cleanup
+DROP TABLE t1;
diff --git a/sql/handler.h b/sql/handler.h
index 772f2e68dab..c422094b4d5 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1666,6 +1666,13 @@ struct HA_CREATE_INFO
used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
return false;
}
+ ulong table_options_with_row_type()
+ {
+ if (row_type == ROW_TYPE_DYNAMIC || row_type == ROW_TYPE_PAGE)
+ return table_options | HA_OPTION_PACK_RECORD;
+ else
+ return table_options;
+ }
};
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index 02109b22898..a675d325a8b 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -6834,10 +6834,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
lpt->part_info= part_info;
lpt->alter_info= alter_info;
lpt->create_info= create_info;
- lpt->db_options= create_info->table_options;
- if (create_info->row_type != ROW_TYPE_FIXED &&
- create_info->row_type != ROW_TYPE_DEFAULT)
- lpt->db_options|= HA_OPTION_PACK_RECORD;
+ lpt->db_options= create_info->table_options_with_row_type();
lpt->table= table;
lpt->key_info_buffer= 0;
lpt->key_count= 0;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 9549884bc4e..7d37c559e20 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4405,10 +4405,7 @@ handler *mysql_create_frm_image(THD *thd,
set_table_default_charset(thd, create_info, (char*) db);
- db_options= create_info->table_options;
- if (create_info->row_type == ROW_TYPE_DYNAMIC ||
- create_info->row_type == ROW_TYPE_PAGE)
- db_options|= HA_OPTION_PACK_RECORD;
+ db_options= create_info->table_options_with_row_type();
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
create_info->db_type)))