Skip to content

Commit 03e91ce

Browse files
committed
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.
1 parent c1e5fef commit 03e91ce

File tree

5 files changed

+36
-8
lines changed

5 files changed

+36
-8
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CREATE TABLE t1 (i INT) ENGINE=MYISAM
2+
PARTITION BY LIST(i) (
3+
PARTITION p0 VALUES IN (1),
4+
PARTITION p1 VALUES IN (2)
5+
);
6+
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
7+
ALTER TABLE t1 DROP PARTITION p1;
8+
SELECT * FROM t1;
9+
i
10+
DROP TABLE t1;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
3+
#
4+
5+
--source include/have_partition.inc
6+
7+
CREATE TABLE t1 (i INT) ENGINE=MYISAM
8+
PARTITION BY LIST(i) (
9+
PARTITION p0 VALUES IN (1),
10+
PARTITION p1 VALUES IN (2)
11+
);
12+
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
13+
ALTER TABLE t1 DROP PARTITION p1;
14+
SELECT * FROM t1;
15+
16+
# Cleanup
17+
DROP TABLE t1;

sql/handler.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,6 +1666,13 @@ struct HA_CREATE_INFO
16661666
used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
16671667
return false;
16681668
}
1669+
ulong table_options_with_row_type()
1670+
{
1671+
if (row_type == ROW_TYPE_DYNAMIC || row_type == ROW_TYPE_PAGE)
1672+
return table_options | HA_OPTION_PACK_RECORD;
1673+
else
1674+
return table_options;
1675+
}
16691676
};
16701677

16711678

sql/sql_partition.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6834,10 +6834,7 @@ uint fast_alter_partition_table(THD *thd, TABLE *table,
68346834
lpt->part_info= part_info;
68356835
lpt->alter_info= alter_info;
68366836
lpt->create_info= create_info;
6837-
lpt->db_options= create_info->table_options;
6838-
if (create_info->row_type != ROW_TYPE_FIXED &&
6839-
create_info->row_type != ROW_TYPE_DEFAULT)
6840-
lpt->db_options|= HA_OPTION_PACK_RECORD;
6837+
lpt->db_options= create_info->table_options_with_row_type();
68416838
lpt->table= table;
68426839
lpt->key_info_buffer= 0;
68436840
lpt->key_count= 0;

sql/sql_table.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4405,10 +4405,7 @@ handler *mysql_create_frm_image(THD *thd,
44054405

44064406
set_table_default_charset(thd, create_info, (char*) db);
44074407

4408-
db_options= create_info->table_options;
4409-
if (create_info->row_type == ROW_TYPE_DYNAMIC ||
4410-
create_info->row_type == ROW_TYPE_PAGE)
4411-
db_options|= HA_OPTION_PACK_RECORD;
4408+
db_options= create_info->table_options_with_row_type();
44124409

44134410
if (!(file= get_new_handler((TABLE_SHARE*) 0, thd->mem_root,
44144411
create_info->db_type)))

0 commit comments

Comments
 (0)