Commit ca2ba229 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6224 Incorrect information in file when *.frm is > 256K

Reject huge frms at CREATE TABLE, not when it - successfully written - is being opened.
Also raise the frm size limit from 256K to 512K
parent 65f85264
ERROR HY000: The definition for table `t1` is too big
#
# MDEV-6224 Incorrect information in file when *.frm is > 256K
#
# verify that huge frms are rejected during creation, not on opening
#
--source include/have_partition.inc
let $n=5646;
let $a=create table t1 (a int) engine=myisam partition by hash(a) partitions $n (;
dec $n;
while ($n)
{
let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n,;
dec $n;
}
--disable_query_log
--error ER_TABLE_DEFINITION_TOO_BIG
eval $a partition foo);
......@@ -7109,3 +7109,5 @@ ER_IT_IS_A_VIEW 42S02
eng "'%-.192s' is a view"
ER_SLAVE_SKIP_NOT_IN_GTID
eng "When using GTID, @@sql_slave_skip_counter can not be used. Instead, setting @@gtid_slave_pos explicitly can be used to skip to after a given GTID position."
ER_TABLE_DEFINITION_TOO_BIG
eng "The definition for table %`s is too big"
......@@ -211,6 +211,12 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
filepos= frm.length;
frm.length+= FRM_FORMINFO_SIZE; // forminfo
frm.length+= packed_fields_length(create_fields);
if (frm.length > FRM_MAX_SIZE)
{
my_error(ER_TABLE_DEFINITION_TOO_BIG, MYF(0), table);
DBUG_RETURN(frm);
}
frm_ptr= (uchar*) my_malloc(frm.length, MYF(MY_WME | MY_ZEROFILL |
MY_THREAD_SPECIFIC));
......
......@@ -203,7 +203,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
#define FRM_HEADER_SIZE 64
#define FRM_FORMINFO_SIZE 288
#define FRM_MAX_SIZE (256*1024)
#define FRM_MAX_SIZE (512*1024)
static inline bool is_binary_frm_header(uchar *head)
{
......
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