Browse Source

Fixed "frame size..larger thane 16384" error in MyISAM

Fixed by using my_alloc() and by using 'needed allocation size' instead
of maxium possible.
bb-10.6-bumpversion
Monty 2 months ago
parent
commit
6435aeb241
  1. 32
      storage/myisam/mi_open.c
  2. 3
      storage/myisam/myisamdef.h

32
storage/myisam/mi_open.c

@ -913,12 +913,16 @@ static void setup_key_functions(register MI_KEYDEF *keyinfo)
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;
uchar *buff, *ptr;
uint i, keys= (uint) state->header.keys,
key_blocks=state->header.max_block_size_index;
key_blocks=state->header.max_block_size_index,
key_parts= mi_uint2korr(state->header.key_parts);
int res;
DBUG_ENTER("mi_state_info_write");
buff= my_alloca(MI_STATE_INFO_SIZE + MI_STATE_EXTRA_SIZE(keys, key_parts));
ptr= buff;
memcpy(ptr, &state->header, sizeof(state->header));
ptr+=sizeof(state->header);
@ -952,7 +956,6 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
}
if (pWrite & 2) /* From isamchk */
{
uint key_parts= mi_uint2korr(state->header.key_parts);
mi_int4store(ptr,state->sec_index_changed); ptr +=4;
mi_int4store(ptr,state->sec_index_used); ptr +=4;
mi_int4store(ptr,state->version); ptr +=4;
@ -968,10 +971,13 @@ uint mi_state_info_write(File file, MI_STATE_INFO *state, uint pWrite)
}
if (pWrite & 1)
DBUG_RETURN(mysql_file_pwrite(file, buff, (size_t) (ptr-buff), 0L,
MYF(MY_NABP | MY_THREADSAFE)) != 0);
DBUG_RETURN(mysql_file_write(file, buff, (size_t) (ptr-buff),
MYF(MY_NABP)) != 0);
res= mysql_file_pwrite(file, buff, (size_t) (ptr-buff), 0L,
MYF(MY_NABP | MY_THREADSAFE)) != 0;
else
res= mysql_file_write(file, buff, (size_t) (ptr-buff),
MYF(MY_NABP)) != 0;
my_afree(buff);
DBUG_RETURN(res);
}
@ -1040,20 +1046,24 @@ uchar *mi_state_info_read(uchar *ptr, MI_STATE_INFO *state)
uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead)
{
uchar buff[MI_STATE_INFO_SIZE + MI_STATE_EXTRA_SIZE];
uchar *buff= my_alloca(state->state_length);
if (!myisam_single_user)
{
if (pRead)
{
if (mysql_file_pread(file, buff, state->state_length, 0L, MYF(MY_NABP)))
return 1;
goto err;
}
else if (mysql_file_read(file, buff, state->state_length, MYF(MY_NABP)))
return 1;
goto err;
mi_state_info_read(buff, state);
}
my_afree(buff);
return 0;
err:
my_afree(buff);
return 1;
}

3
storage/myisam/myisamdef.h

@ -97,7 +97,8 @@ typedef struct st_mi_state_info
#define MI_STATE_KEY_SIZE 8U
#define MI_STATE_KEYBLOCK_SIZE 8U
#define MI_STATE_KEYSEG_SIZE 4U
#define MI_STATE_EXTRA_SIZE ((MI_MAX_KEY+MI_MAX_KEY_BLOCK_SIZE)*MI_STATE_KEY_SIZE + MI_MAX_KEY*HA_MAX_KEY_SEG*MI_STATE_KEYSEG_SIZE)
#define MI_STATE_EXTRA_SIZE(K,P) (((K)+MI_MAX_KEY_BLOCK_SIZE)*MI_STATE_KEY_SIZE + (P)*MI_STATE_KEYSEG_SIZE)
#define MI_KEYDEF_SIZE (2+ 5*2)
#define MI_UNIQUEDEF_SIZE (2+1+1)
#define HA_KEYSEG_SIZE (6+ 2*2 + 4*2)

Loading…
Cancel
Save