Commit 4f845f4c authored by serg@serg.mylan's avatar serg@serg.mylan

two bugs in parallel repair fixed

parent 52ad8214
...@@ -922,7 +922,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) ...@@ -922,7 +922,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend)
info->checksum=mi_checksum(info,record); info->checksum=mi_checksum(info,record);
if (param->testflag & (T_EXTEND | T_MEDIUM | T_VERBOSE)) if (param->testflag & (T_EXTEND | T_MEDIUM | T_VERBOSE))
{ {
if (_mi_rec_check(info,record, info->rec_buff)) if (_mi_rec_check(info,record, info->rec_buff,block_info.rec_len))
{ {
mi_check_print_error(param,"Found wrong packed record at %s", mi_check_print_error(param,"Found wrong packed record at %s",
llstr(start_recpos,llbuff)); llstr(start_recpos,llbuff));
...@@ -2350,6 +2350,11 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info, ...@@ -2350,6 +2350,11 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
sort_param[i].record= (((char *)(sort_param+share->base.keys))+ sort_param[i].record= (((char *)(sort_param+share->base.keys))+
(share->base.pack_reclength * i)); (share->base.pack_reclength * i));
if (!mi_alloc_rec_buff(info, -1, &sort_param[i].rec_buff))
{
mi_check_print_error(param,"Not enough memory!");
goto err;
}
sort_param[i].key_length=share->rec_reflength; sort_param[i].key_length=share->rec_reflength;
for (keyseg=sort_param[i].keyinfo->seg; keyseg->type != HA_KEYTYPE_END; for (keyseg=sort_param[i].keyinfo->seg; keyseg->type != HA_KEYTYPE_END;
...@@ -2911,7 +2916,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) ...@@ -2911,7 +2916,8 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param)
info->checksum=mi_checksum(info,sort_param->record); info->checksum=mi_checksum(info,sort_param->record);
if ((param->testflag & (T_EXTEND | T_REP)) || searching) if ((param->testflag & (T_EXTEND | T_REP)) || searching)
{ {
if (_mi_rec_check(info, sort_param->record, sort_param->rec_buff)) if (_mi_rec_check(info, sort_param->record, sort_param->rec_buff,
sort_param->find_length))
{ {
mi_check_print_info(param,"Found wrong packed record at %s", mi_check_print_info(param,"Found wrong packed record at %s",
llstr(sort_param->start_recpos,llbuff)); llstr(sort_param->start_recpos,llbuff));
......
...@@ -148,7 +148,7 @@ static int write_dynamic_record(MI_INFO *info, const byte *record, ...@@ -148,7 +148,7 @@ static int write_dynamic_record(MI_INFO *info, const byte *record,
} while (reclength); } while (reclength);
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -744,7 +744,8 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) ...@@ -744,7 +744,8 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from)
Returns 0 if record is ok. Returns 0 if record is ok.
*/ */
my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff) my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff,
ulong packed_length)
{ {
uint length,new_length,flag,bit,i; uint length,new_length,flag,bit,i;
char *pos,*end,*packpos,*to; char *pos,*end,*packpos,*to;
...@@ -836,8 +837,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff) ...@@ -836,8 +837,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff)
to+=length; to+=length;
} }
} }
if (info->packed_length != (uint) (to - rec_buff) if (packed_length != (uint) (to - rec_buff) + test(info->s->calc_checksum) ||
+ test(info->s->calc_checksum) ||
(bit != 1 && (flag & ~(bit - 1)))) (bit != 1 && (flag & ~(bit - 1))))
goto err; goto err;
if (info->s->calc_checksum) if (info->s->calc_checksum)
...@@ -850,7 +850,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff) ...@@ -850,7 +850,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff)
} }
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
DBUG_RETURN(1); DBUG_RETURN(1);
} }
...@@ -966,8 +966,8 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, ...@@ -966,8 +966,8 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from,
if (info->s->calc_checksum) if (info->s->calc_checksum)
from++; from++;
if (to == to_end && from == from_end && (bit == 1 || !(flag & ~(bit-1)))) if (to == to_end && from == from_end && (bit == 1 || !(flag & ~(bit-1))))
DBUG_RETURN((info->packed_length=found_length)); DBUG_RETURN(found_length);
err: err:
my_errno=HA_ERR_RECORD_DELETED; my_errno=HA_ERR_RECORD_DELETED;
DBUG_PRINT("error",("to_end: %lx -> %lx from_end: %lx -> %lx", DBUG_PRINT("error",("to_end: %lx -> %lx from_end: %lx -> %lx",
to,to_end,from,from_end)); to,to_end,from,from_end));
...@@ -1210,7 +1210,7 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record) ...@@ -1210,7 +1210,7 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record)
} }
} }
my_errno=0; my_errno=0;
err: err:
if (buffer != info->rec_buff) if (buffer != info->rec_buff)
my_afree((gptr) buffer); my_afree((gptr) buffer);
DBUG_RETURN(my_errno); DBUG_RETURN(my_errno);
......
...@@ -244,6 +244,8 @@ struct st_myisam_info { ...@@ -244,6 +244,8 @@ struct st_myisam_info {
my_off_t last_search_keypage; /* Last keypage when searching */ my_off_t last_search_keypage; /* Last keypage when searching */
my_off_t dupp_key_pos; my_off_t dupp_key_pos;
ha_checksum checksum; ha_checksum checksum;
/* QQ: the folloing two xxx_length fields should be removed,
as they are not compatible with parallel repair */
ulong packed_length,blob_length; /* Length of found, packed record */ ulong packed_length,blob_length; /* Length of found, packed record */
int dfile; /* The datafile */ int dfile; /* The datafile */
uint opt_flag; /* Optim. for space/speed */ uint opt_flag; /* Optim. for space/speed */
...@@ -536,7 +538,8 @@ extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**); ...@@ -536,7 +538,8 @@ extern byte *mi_alloc_rec_buff(MI_INFO *,ulong, byte**);
extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from, extern ulong _mi_rec_unpack(MI_INFO *info,byte *to,byte *from,
ulong reclength); ulong reclength);
extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos); extern my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *packpos,
ulong reclength);
extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length, extern int _mi_write_part_record(MI_INFO *info,my_off_t filepos,ulong length,
my_off_t next_filepos,byte **record, my_off_t next_filepos,byte **record,
ulong *reclength,int *flag); ulong *reclength,int *flag);
......
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