Commit cb5473cb authored by Sergei Golubchik's avatar Sergei Golubchik

write frm pieces contiguously, don't align them on a 4K boundary

(in partition_archive.test frm size goes down 16 times :)
parent e671cba9
......@@ -12701,12 +12701,12 @@ CREATE TABLE t1(a INT, b BLOB) ENGINE=archive;
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DATA_LENGTH AVG_ROW_LENGTH
8608 15
535 15
INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2');
SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM
INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test';
DATA_LENGTH AVG_ROW_LENGTH
8642 4321
569 284
DROP TABLE t1;
SET @save_join_buffer_size= @@join_buffer_size;
SET @@join_buffer_size= 8192;
......
......@@ -15,10 +15,10 @@ ENGINE = ARCHIVE;
INSERT INTO t1 VALUES(CURRENT_DATE);
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DATA_LENGTH INDEX_LENGTH
8604 0
520 0
SELECT DATA_LENGTH, INDEX_LENGTH FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1';
DATA_LENGTH INDEX_LENGTH
8604 0
520 0
DROP TABLE t1;
drop database if exists db99;
drop table if exists t1;
......
......@@ -2926,7 +2926,6 @@ void append_unescaped(String *res, const char *pos, uint length)
void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
HA_CREATE_INFO *create_info, uint keys, KEY *key_info)
{
ulong length;
ulong key_comment_total_bytes= 0;
uint i;
DBUG_ENTER("prepare_frm_header");
......@@ -2947,7 +2946,6 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
fileinfo[3]= (uchar) ha_legacy_type(
ha_checktype(thd,ha_legacy_type(create_info->db_type),0,0));
int2store(fileinfo+4,3);
int2store(fileinfo+6,IO_SIZE); /* Next block starts here */
/*
Keep in sync with pack_keys() in unireg.cc
For each key:
......@@ -2971,10 +2969,7 @@ void prepare_frm_header(THD *thd, uint reclength, uchar *fileinfo,
key_length= keys * (8 + MAX_REF_PARTS * 9 + NAME_LEN + 1) + 16
+ key_comment_total_bytes;
length= next_io_size((ulong) (IO_SIZE+key_length+reclength+
create_info->extra_size));
int2store(fileinfo+8,1);
int4store(fileinfo+10,length);
tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff;
int2store(fileinfo+14,tmp_key_length);
int2store(fileinfo+16,reclength);
......
......@@ -206,24 +206,18 @@ bool mysql_create_frm(THD *thd, const char *file_name,
prepare_frm_header(thd, reclength, fileinfo, create_info, keys, key_info);
key_buff_length= uint4korr(fileinfo+47);
filepos= uint4korr(fileinfo+10);
{
size_t len1, len2, len3;
len1= FRM_HEADER_SIZE; // fileinfo
len1+= 7; // "form entry"
len2= uint2korr(fileinfo+6); // 4096
len2+= key_buff_length;
len2+= reclength;
len2+= create_info->extra_size;
frm_length= FRM_HEADER_SIZE; // fileinfo;
frm_length+= 7; // "form entry"
len3= filepos;
len3+= FRM_FORMINFO_SIZE; //forminfo
len3+= packed_fields_length(create_fields);
int2store(fileinfo+6, frm_length);
frm_length+= key_buff_length;
frm_length+= reclength; // row with default values
frm_length+= create_info->extra_size;
frm_length= len3;
}
filepos= frm_length;
frm_length+= FRM_FORMINFO_SIZE; // forminfo
frm_length+= packed_fields_length(create_fields);
frm_ptr= (uchar*) my_malloc(frm_length, MYF(MY_ZEROFILL | MY_THREAD_SPECIFIC));
if (!frm_ptr)
......
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