summaryrefslogtreecommitdiff
path: root/storage/myisam
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2006-05-03 15:59:17 +0300
committerunknown <monty@mysql.com>2006-05-03 15:59:17 +0300
commitd50ae1656932907a9414b713372cf1c6c40c97a0 (patch)
treebe19707bb5edcf9cc7b289bbcb00a51e8771e29c /storage/myisam
parent79cc1546b23f757266dc2f4ed67317865c9d0f2f (diff)
downloadmariadb-git-d50ae1656932907a9414b713372cf1c6c40c97a0.tar.gz
Added support for key_block_size for key and table level (WL#602)
Added support for key_block_size to MyISAM. Simplify interface to 'new Key' to make it easier to add new key options. mysqld option --new is used to define where key options are printed. (In 5.3 we should move all key options to after key part definition to avoid problem with reserved names) Fixed some compiler warnings and a memory leak in ssl include/my_base.h: Added flag to check if block size for key was secified include/my_sys.h: Added new support function to round up to a power of two include/myisam.h: Rename block_size -> block_size_index to avoid confusion with 'block_size' include/violite.h: Added function to free memory after new_VioSSLAcceptorFd (Will rename all vio_ssl functions in a future changeset) mysql-test/mysql-test-run.pl: Don't print port number info when we use --extern mysql-test/r/myisam.result: Added test for key_block_size mysql-test/t/myisam.test: Added test for key_block_size mysys/mf_keycache.c: Simplify code mysys/my_bit.c: Added new support function to round up to a power of two sql/ha_myisam.cc: Tell MyISAM to use the specified key_block_size MyISAM also updates the global key_block_size from the used values. sql/handler.cc: Added 'default_key_create_info' to be used as 'dummy' argument to 'new Key' sql/handler.h: Added KEY_CREATE_INFO, to be used as for general options for KEY's sql/item_func.h: Removed compiler warning sql/lex.h: Added new symbol sql/mysqld.cc: Fixed memory leak in ssl (new_VioSSLAcceptorFd) sql/sql_class.h: Change 'new Key' to use KEY_CREATE_INFO instead of 'algoritm', parser, key_page_size. This makes it easier to add new key options in the future. sql/sql_lex.h: Added key create options sql/sql_parse.cc: Use new interface to 'new Key' sql/sql_show.cc: Added support for key_block_size If --new is used, key options are printed after the key part definition. sql/sql_table.cc: Use new interface to 'new Key' Add support for key_block_size sql/sql_yacc.yy: Add support for key_block_size Allow key options before and after key_parts (In future they should be always after the key_part defintion) Use new interface to 'new Key' sql/structs.h: Added block_size to keys sql/table.cc: Remmeber and read key_block_size for table and key level sql/table.h: Added default key_block_size for table sql/unireg.cc: Remember key_block_size for key storage/myisam/ft_eval.c: Set block_length to 0 to get default key page size storage/myisam/ft_test1.c: Set block_length to 0 to get default key page size storage/myisam/mi_check.c: block_size -> block_size_index storage/myisam/mi_create.c: Added support for block size per key. Block size is rounded up to next power of two and enforced between MIN and MAX KEY_BLOCK_LENGTH. Align start of key block to start at an even offset of max_key_block_length to ensure key cache works good if all key pages are of same size. storage/myisam/mi_open.c: block_size -> block_size_index storage/myisam/mi_page.c: block_size -> block_size_index storage/myisam/mi_test1.c: Set block_length to 0 to get default key page size storage/myisam/mi_test2.c: Set block_length to 0 to get default key page size storage/myisam/mi_test3.c: Set block_length to 0 to get default key page size storage/myisam/myisamdef.h: block_size -> block_size_index to avoid confusion with 'block_size' in MySQL Added block_size as argument to MI_BLOCK_SIZE Added missing prototypes to get rid of compiler warnings storage/myisam/myisampack.c: Removed compiler warning block_size -> block_size_index vio/viosslfactories.c: Fixed memory leak in ssl (new_VioSSLAcceptorFd) mysql-test/r/myisam-system.result: New BitKeeper file ``mysql-test/r/myisam-system.result'' mysql-test/t/myisam-system.test: New BitKeeper file ``mysql-test/t/myisam-system.test''
Diffstat (limited to 'storage/myisam')
-rw-r--r--storage/myisam/ft_eval.c1
-rw-r--r--storage/myisam/ft_test1.c1
-rw-r--r--storage/myisam/mi_check.c10
-rw-r--r--storage/myisam/mi_create.c27
-rw-r--r--storage/myisam/mi_open.c10
-rw-r--r--storage/myisam/mi_page.c9
-rw-r--r--storage/myisam/mi_test1.c1
-rw-r--r--storage/myisam/mi_test2.c14
-rw-r--r--storage/myisam/mi_test3.c2
-rw-r--r--storage/myisam/myisamdef.h6
-rw-r--r--storage/myisam/myisampack.c3
11 files changed, 56 insertions, 28 deletions
diff --git a/storage/myisam/ft_eval.c b/storage/myisam/ft_eval.c
index eab9d37af0b..459742d2aff 100644
--- a/storage/myisam/ft_eval.c
+++ b/storage/myisam/ft_eval.c
@@ -54,6 +54,7 @@ int main(int argc, char *argv[])
/* Define a key over the first column */
keyinfo[0].seg=keyseg;
keyinfo[0].keysegs=1;
+ keyinfo[0].block_length= 0; /* Default block length */
keyinfo[0].seg[0].type= HA_KEYTYPE_TEXT;
keyinfo[0].seg[0].flag= HA_BLOB_PART;
keyinfo[0].seg[0].start=recinfo[0].length;
diff --git a/storage/myisam/ft_test1.c b/storage/myisam/ft_test1.c
index d54b344e2cd..28dcfb2b758 100644
--- a/storage/myisam/ft_test1.c
+++ b/storage/myisam/ft_test1.c
@@ -89,6 +89,7 @@ static int run_test(const char *filename)
/* Define a key over the first column */
keyinfo[0].seg=keyseg;
keyinfo[0].keysegs=1;
+ keyinfo[0].block_length= 0; /* Default block length */
keyinfo[0].seg[0].type= key_type;
keyinfo[0].seg[0].flag= (key_field == FIELD_BLOB) ? HA_BLOB_PART:
(key_field == FIELD_VARCHAR) ? HA_VAR_LENGTH_PART:0;
diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c
index eb2f42697ce..fff35a8ad3c 100644
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@ -358,7 +358,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
puts("- check key delete-chain");
param->key_file_blocks=info->s->base.keystart;
- for (key=0 ; key < info->s->state.header.max_block_size ; key++)
+ for (key=0 ; key < info->s->state.header.max_block_size_index ; key++)
if (check_k_link(param,info,key))
{
if (param->testflag & T_VERBOSE) puts("");
@@ -1411,7 +1411,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
share->state.key_root[i]= HA_OFFSET_ERROR;
/* Drop the delete chain. */
- for (i=0 ; i < share->state.header.max_block_size ; i++)
+ for (i=0 ; i < share->state.header.max_block_size_index ; i++)
share->state.key_del[i]= HA_OFFSET_ERROR;
/*
@@ -1795,7 +1795,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
for (key=0 ; key < info->s->base.keys ; key++)
info->s->state.key_root[key]=index_pos[key];
- for (key=0 ; key < info->s->state.header.max_block_size ; key++)
+ for (key=0 ; key < info->s->state.header.max_block_size_index ; key++)
info->s->state.key_del[key]= HA_OFFSET_ERROR;
info->s->state.changed&= ~STATE_NOT_SORTED_PAGES;
@@ -2095,7 +2095,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
/* Clear the pointers to the given rows */
for (i=0 ; i < share->base.keys ; i++)
share->state.key_root[i]= HA_OFFSET_ERROR;
- for (i=0 ; i < share->state.header.max_block_size ; i++)
+ for (i=0 ; i < share->state.header.max_block_size_index ; i++)
share->state.key_del[i]= HA_OFFSET_ERROR;
info->state->key_file_length=share->base.keystart;
}
@@ -2463,7 +2463,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
/* Clear the pointers to the given rows */
for (i=0 ; i < share->base.keys ; i++)
share->state.key_root[i]= HA_OFFSET_ERROR;
- for (i=0 ; i < share->state.header.max_block_size ; i++)
+ for (i=0 ; i < share->state.header.max_block_size_index ; i++)
share->state.key_del[i]= HA_OFFSET_ERROR;
info->state->key_file_length=share->base.keystart;
}
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c
index 3be998b2c17..22cbde278be 100644
--- a/storage/myisam/mi_create.c
+++ b/storage/myisam/mi_create.c
@@ -28,9 +28,9 @@
#endif
#include <m_ctype.h>
- /*
- ** Old options is used when recreating database, from isamchk
- */
+/*
+ Old options is used when recreating database, from myisamchk
+*/
int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
uint columns, MI_COLUMNDEF *recinfo,
@@ -45,6 +45,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_length,info_length,key_segs,options,min_key_length_skip,
base_pos,long_varchar_count,varchar_length,
max_key_block_length,unique_key_parts,fulltext_keys,offset;
+ uint aligned_key_start, block_length;
ulong reclength, real_reclength,min_pack_length;
char filename[FN_REFLEN],linkname[FN_REFLEN], *linkname_ptr;
ulong pack_reclength;
@@ -428,8 +429,16 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
key_segs)
share.state.rec_per_key_part[key_segs-1]=1L;
length+=key_length;
+ /* Get block length for key, if defined by user */
+ block_length= (keydef->block_length ?
+ my_round_up_to_next_power(keydef->block_length) :
+ myisam_block_size);
+ block_length= max(block_length, MI_MIN_KEY_BLOCK_LENGTH);
+ block_length= min(block_length, MI_MAX_KEY_BLOCK_LENGTH);
+
keydef->block_length= MI_BLOCK_SIZE(length-real_length_diff,
- pointer,MI_MAX_KEYPTR_SIZE);
+ pointer,MI_MAX_KEYPTR_SIZE,
+ block_length);
if (keydef->block_length > MI_MAX_KEY_BLOCK_LENGTH ||
length >= MI_MAX_KEY_BUFF)
{
@@ -485,7 +494,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
mi_int2store(share.state.header.base_pos,base_pos);
share.state.header.language= (ci->language ?
ci->language : default_charset_info->number);
- share.state.header.max_block_size=max_key_block_length/MI_MIN_KEY_BLOCK_LENGTH;
+ share.state.header.max_block_size_index= max_key_block_length/MI_MIN_KEY_BLOCK_LENGTH;
share.state.dellink = HA_OFFSET_ERROR;
share.state.process= (ulong) getpid();
@@ -512,8 +521,12 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
mi_int2store(share.state.header.unique_key_parts,unique_key_parts);
mi_set_all_keys_active(share.state.key_map, keys);
- share.base.keystart = share.state.state.key_file_length=
- MY_ALIGN(info_length, myisam_block_size);
+ aligned_key_start= my_round_up_to_next_power(max_key_block_length ?
+ max_key_block_length :
+ myisam_block_size);
+
+ share.base.keystart= share.state.state.key_file_length=
+ MY_ALIGN(info_length, aligned_key_start);
share.base.max_key_block_length=max_key_block_length;
share.base.max_key_length=ALIGN_SIZE(max_key_length+4);
share.base.records=ci->max_rows;
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 91bf438035f..b61c1af24da 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -295,7 +295,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
&share->data_file_name,strlen(data_name)+1,
&share->state.key_root,keys*sizeof(my_off_t),
&share->state.key_del,
- (share->state.header.max_block_size*sizeof(my_off_t)),
+ (share->state.header.max_block_size_index*sizeof(my_off_t)),
#ifdef THREAD
&share->key_root_lock,sizeof(rw_lock_t)*keys,
#endif
@@ -310,7 +310,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
(char*) key_root, sizeof(my_off_t)*keys);
memcpy((char*) share->state.key_del,
(char*) key_del, (sizeof(my_off_t) *
- share->state.header.max_block_size));
+ share->state.header.max_block_size_index));
strmov(share->unique_file_name, name_buff);
share->unique_name_length= strlen(name_buff);
strmov(share->index_file_name, index_name);
@@ -820,7 +820,7 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
uchar buff[MI_STATE_INFO_SIZE + MI_STATE_EXTRA_SIZE];
uchar *ptr=buff;
uint i, keys= (uint) state->header.keys,
- key_blocks=state->header.max_block_size;
+ key_blocks=state->header.max_block_size_index;
DBUG_ENTER("mi_state_info_write");
memcpy_fixed(ptr,&state->header,sizeof(state->header));
@@ -886,7 +886,7 @@ uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state)
ptr +=sizeof(state->header);
keys=(uint) state->header.keys;
key_parts=mi_uint2korr(state->header.key_parts);
- key_blocks=state->header.max_block_size;
+ key_blocks=state->header.max_block_size_index;
state->open_count = mi_uint2korr(ptr); ptr +=2;
state->changed= (bool) *ptr++;
@@ -1059,7 +1059,7 @@ char *mi_keydef_read(char *ptr, MI_KEYDEF *keydef)
keydef->keylength = mi_uint2korr(ptr); ptr +=2;
keydef->minlength = mi_uint2korr(ptr); ptr +=2;
keydef->maxlength = mi_uint2korr(ptr); ptr +=2;
- keydef->block_size = keydef->block_length/MI_MIN_KEY_BLOCK_LENGTH-1;
+ keydef->block_size_index= keydef->block_length/MI_MIN_KEY_BLOCK_LENGTH-1;
keydef->underflow_block_length=keydef->block_length/3;
keydef->version = 0; /* Not saved */
keydef->parser = &ft_default_parser;
diff --git a/storage/myisam/mi_page.c b/storage/myisam/mi_page.c
index 5240c063fba..a5e2b01ed0f 100644
--- a/storage/myisam/mi_page.c
+++ b/storage/myisam/mi_page.c
@@ -112,8 +112,8 @@ int _mi_dispose(register MI_INFO *info, MI_KEYDEF *keyinfo, my_off_t pos,
DBUG_ENTER("_mi_dispose");
DBUG_PRINT("enter",("pos: %ld", (long) pos));
- old_link=info->s->state.key_del[keyinfo->block_size];
- info->s->state.key_del[keyinfo->block_size]=pos;
+ old_link= info->s->state.key_del[keyinfo->block_size_index];
+ info->s->state.key_del[keyinfo->block_size_index]= pos;
mi_sizestore(buff,old_link);
info->s->state.changed|= STATE_NOT_SORTED_PAGES;
DBUG_RETURN(key_cache_write(info->s->key_cache,
@@ -132,7 +132,8 @@ my_off_t _mi_new(register MI_INFO *info, MI_KEYDEF *keyinfo, int level)
char buff[8];
DBUG_ENTER("_mi_new");
- if ((pos=info->s->state.key_del[keyinfo->block_size]) == HA_OFFSET_ERROR)
+ if ((pos= info->s->state.key_del[keyinfo->block_size_index]) ==
+ HA_OFFSET_ERROR)
{
if (info->state->key_file_length >=
info->s->base.max_key_file_length - keyinfo->block_length)
@@ -152,7 +153,7 @@ my_off_t _mi_new(register MI_INFO *info, MI_KEYDEF *keyinfo, int level)
(uint) keyinfo->block_length,0))
pos= HA_OFFSET_ERROR;
else
- info->s->state.key_del[keyinfo->block_size]=mi_sizekorr(buff);
+ info->s->state.key_del[keyinfo->block_size_index]= mi_sizekorr(buff);
}
info->s->state.changed|= STATE_NOT_SORTED_PAGES;
DBUG_PRINT("exit",("Pos: %ld",(long) pos));
diff --git a/storage/myisam/mi_test1.c b/storage/myisam/mi_test1.c
index 0e62b074376..0b78ac8a7ff 100644
--- a/storage/myisam/mi_test1.c
+++ b/storage/myisam/mi_test1.c
@@ -95,6 +95,7 @@ static int run_test(const char *filename)
/* Define a key over the first column */
keyinfo[0].seg=keyseg;
keyinfo[0].keysegs=1;
+ keyinfo[0].block_length= 0; /* Default block length */
keyinfo[0].key_alg=HA_KEY_ALG_BTREE;
keyinfo[0].seg[0].type= key_type;
keyinfo[0].seg[0].flag= pack_seg;
diff --git a/storage/myisam/mi_test2.c b/storage/myisam/mi_test2.c
index e77a37d853f..357ebb1b9bc 100644
--- a/storage/myisam/mi_test2.c
+++ b/storage/myisam/mi_test2.c
@@ -95,6 +95,7 @@ int main(int argc, char *argv[])
keyinfo[0].key_alg=HA_KEY_ALG_BTREE;
keyinfo[0].keysegs=1;
keyinfo[0].flag = pack_type;
+ keyinfo[0].block_length= 0; /* Default block length */
keyinfo[1].seg= &glob_keyseg[1][0];
keyinfo[1].seg[0].start=7;
keyinfo[1].seg[0].length=6;
@@ -111,6 +112,7 @@ int main(int argc, char *argv[])
keyinfo[1].key_alg=HA_KEY_ALG_BTREE;
keyinfo[1].keysegs=2;
keyinfo[1].flag =0;
+ keyinfo[1].block_length= MI_MIN_KEY_BLOCK_LENGTH; /* Diff blocklength */
keyinfo[2].seg= &glob_keyseg[2][0];
keyinfo[2].seg[0].start=12;
keyinfo[2].seg[0].length=8;
@@ -121,6 +123,7 @@ int main(int argc, char *argv[])
keyinfo[2].key_alg=HA_KEY_ALG_BTREE;
keyinfo[2].keysegs=1;
keyinfo[2].flag =HA_NOSAME;
+ keyinfo[2].block_length= 0; /* Default block length */
keyinfo[3].seg= &glob_keyseg[3][0];
keyinfo[3].seg[0].start=0;
keyinfo[3].seg[0].length=reclength-(use_blob ? 8 : 0);
@@ -132,6 +135,7 @@ int main(int argc, char *argv[])
keyinfo[3].key_alg=HA_KEY_ALG_BTREE;
keyinfo[3].keysegs=1;
keyinfo[3].flag = pack_type;
+ keyinfo[3].block_length= 0; /* Default block length */
keyinfo[4].seg= &glob_keyseg[4][0];
keyinfo[4].seg[0].start=0;
keyinfo[4].seg[0].length=5;
@@ -143,6 +147,7 @@ int main(int argc, char *argv[])
keyinfo[4].key_alg=HA_KEY_ALG_BTREE;
keyinfo[4].keysegs=1;
keyinfo[4].flag = pack_type;
+ keyinfo[4].block_length= 0; /* Default block length */
keyinfo[5].seg= &glob_keyseg[5][0];
keyinfo[5].seg[0].start=0;
keyinfo[5].seg[0].length=4;
@@ -154,6 +159,7 @@ int main(int argc, char *argv[])
keyinfo[5].key_alg=HA_KEY_ALG_BTREE;
keyinfo[5].keysegs=1;
keyinfo[5].flag = pack_type;
+ keyinfo[5].block_length= 0; /* Default block length */
recinfo[0].type=pack_fields ? FIELD_SKIP_PRESPACE : 0;
recinfo[0].length=7;
@@ -813,7 +819,7 @@ end:
printf("Write records: %d\nUpdate records: %d\nSame-key-read: %d\nDelete records: %d\n", write_count,update,dupp_keys,opt_delete);
if (rec_pointer_size)
printf("Record pointer size: %d\n",rec_pointer_size);
- printf("myisam_block_size: %u\n", myisam_block_size);
+ printf("myisam_block_size: %lu\n", myisam_block_size);
if (key_cacheing)
{
puts("Key cache used");
@@ -914,13 +920,13 @@ static void get_options(int argc, char **argv)
}
break;
case 'e': /* myisam_block_length */
- if ((myisam_block_size=atoi(++pos)) < MI_MIN_KEY_BLOCK_LENGTH ||
+ if ((myisam_block_size= atoi(++pos)) < MI_MIN_KEY_BLOCK_LENGTH ||
myisam_block_size > MI_MAX_KEY_BLOCK_LENGTH)
{
fprintf(stderr,"Wrong myisam_block_length\n");
exit(1);
}
- myisam_block_size=1 << my_bit_log2(myisam_block_size);
+ myisam_block_size= my_round_up_to_next_power(myisam_block_size);
break;
case 'E': /* myisam_block_length */
if ((key_cache_block_size=atoi(++pos)) < MI_MIN_KEY_BLOCK_LENGTH ||
@@ -929,7 +935,7 @@ static void get_options(int argc, char **argv)
fprintf(stderr,"Wrong key_cache_block_size\n");
exit(1);
}
- key_cache_block_size=1 << my_bit_log2(key_cache_block_size);
+ key_cache_block_size= my_round_up_to_next_power(key_cache_block_size);
break;
case 'f':
if ((first_key=atoi(++pos)) < 0 || first_key >= MYISAM_KEYS)
diff --git a/storage/myisam/mi_test3.c b/storage/myisam/mi_test3.c
index 4e764c6f971..173fbe64cf5 100644
--- a/storage/myisam/mi_test3.c
+++ b/storage/myisam/mi_test3.c
@@ -76,6 +76,7 @@ int main(int argc,char **argv)
keyinfo[0].key_alg=HA_KEY_ALG_BTREE;
keyinfo[0].keysegs=1;
keyinfo[0].flag = (uint8) HA_PACK_KEY;
+ keyinfo[0].block_length= 0; /* Default block length */
keyinfo[1].seg= &keyseg[1][0];
keyinfo[1].seg[0].start=8;
keyinfo[1].seg[0].length=4; /* Long is always 4 in myisam */
@@ -84,6 +85,7 @@ int main(int argc,char **argv)
keyinfo[1].key_alg=HA_KEY_ALG_BTREE;
keyinfo[1].keysegs=1;
keyinfo[1].flag =HA_NOSAME;
+ keyinfo[1].block_length= 0; /* Default block length */
recinfo[0].type=0;
recinfo[0].length=sizeof(record.id);
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index caf6254c321..0b450de9c03 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -55,7 +55,7 @@ typedef struct st_mi_state_info
uchar keys; /* number of keys in file */
uchar uniques; /* number of UNIQUE definitions */
uchar language; /* Language for indexes */
- uchar max_block_size; /* max keyblock size */
+ uchar max_block_size_index; /* max keyblock size */
uchar fulltext_keys;
uchar not_used; /* To align to 8 */
} header;
@@ -431,7 +431,7 @@ typedef struct st_mi_sort_param
#define MI_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */
#define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH)
-#define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/myisam_block_size+1)*myisam_block_size)
+#define MI_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size))
#define MI_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */
#define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */
@@ -742,6 +742,8 @@ my_bool check_table_is_closed(const char *name, const char *where);
int mi_open_datafile(MI_INFO *info, MYISAM_SHARE *share, File file_to_dup);
int mi_open_keyfile(MYISAM_SHARE *share);
void mi_setup_functions(register MYISAM_SHARE *share);
+my_bool mi_dynmap_file(MI_INFO *info, my_off_t size);
+void mi_remap_file(MI_INFO *info, my_off_t size);
/* Functions needed by mi_check */
volatile int *killed_ptr(MI_CHECK *param);
diff --git a/storage/myisam/myisampack.c b/storage/myisam/myisampack.c
index e80a3ffacd9..5b3067cb115 100644
--- a/storage/myisam/myisampack.c
+++ b/storage/myisam/myisampack.c
@@ -2726,6 +2726,7 @@ static int compress_isam_file(PACK_MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
break;
}
case FIELD_LAST:
+ case FIELD_enum_val_count:
abort(); /* Impossible */
}
start_pos+=count->max_zero_fill;
@@ -2965,7 +2966,7 @@ static int save_state(MI_INFO *isam_file,PACK_MRG_INFO *mrg,my_off_t new_length,
mi_clear_all_keys_active(share->state.key_map);
for (key=0 ; key < share->base.keys ; key++)
share->state.key_root[key]= HA_OFFSET_ERROR;
- for (key=0 ; key < share->state.header.max_block_size ; key++)
+ for (key=0 ; key < share->state.header.max_block_size_index ; key++)
share->state.key_del[key]= HA_OFFSET_ERROR;
isam_file->state->checksum=crc; /* Save crc here */
share->changed=1; /* Force write of header */