diff options
author | serg@serg.mylan <> | 2004-01-20 09:05:37 +0100 |
---|---|---|
committer | serg@serg.mylan <> | 2004-01-20 09:05:37 +0100 |
commit | 4f845f4c124f57a3d3034bd216cbe45512940b99 (patch) | |
tree | 899c7b90b7eb09c15d506c7a4e3177ac9075b59c /myisam | |
parent | 52ad8214d1f8b05a899d5061548ed190699cd59c (diff) | |
download | mariadb-git-4f845f4c124f57a3d3034bd216cbe45512940b99.tar.gz |
two bugs in parallel repair fixed
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/mi_check.c | 10 | ||||
-rw-r--r-- | myisam/mi_dynrec.c | 16 | ||||
-rw-r--r-- | myisam/myisamdef.h | 5 |
3 files changed, 20 insertions, 11 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 38e48eb5e06..8581f79c99d 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -922,7 +922,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) info->checksum=mi_checksum(info,record); 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", llstr(start_recpos,llbuff)); @@ -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))+ (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; 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) info->checksum=mi_checksum(info,sort_param->record); 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", llstr(sort_param->start_recpos,llbuff)); diff --git a/myisam/mi_dynrec.c b/myisam/mi_dynrec.c index e1bfe4c3ac5..e4e83b716ec 100644 --- a/myisam/mi_dynrec.c +++ b/myisam/mi_dynrec.c @@ -148,7 +148,7 @@ static int write_dynamic_record(MI_INFO *info, const byte *record, } while (reclength); DBUG_RETURN(0); - err: +err: DBUG_RETURN(1); } @@ -744,7 +744,8 @@ uint _mi_rec_pack(MI_INFO *info, register byte *to, register const byte *from) 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; char *pos,*end,*packpos,*to; @@ -836,8 +837,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff) to+=length; } } - if (info->packed_length != (uint) (to - rec_buff) - + test(info->s->calc_checksum) || + if (packed_length != (uint) (to - rec_buff) + test(info->s->calc_checksum) || (bit != 1 && (flag & ~(bit - 1)))) goto err; if (info->s->calc_checksum) @@ -850,7 +850,7 @@ my_bool _mi_rec_check(MI_INFO *info,const char *record, byte *rec_buff) } DBUG_RETURN(0); - err: +err: DBUG_RETURN(1); } @@ -966,8 +966,8 @@ ulong _mi_rec_unpack(register MI_INFO *info, register byte *to, byte *from, if (info->s->calc_checksum) from++; if (to == to_end && from == from_end && (bit == 1 || !(flag & ~(bit-1)))) - DBUG_RETURN((info->packed_length=found_length)); - err: + DBUG_RETURN(found_length); +err: my_errno=HA_ERR_RECORD_DELETED; DBUG_PRINT("error",("to_end: %lx -> %lx from_end: %lx -> %lx", to,to_end,from,from_end)); @@ -1210,7 +1210,7 @@ int _mi_cmp_dynamic_record(register MI_INFO *info, register const byte *record) } } my_errno=0; - err: +err: if (buffer != info->rec_buff) my_afree((gptr) buffer); DBUG_RETURN(my_errno); diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h index e1df1d73191..51a2dd3a2b3 100644 --- a/myisam/myisamdef.h +++ b/myisam/myisamdef.h @@ -244,6 +244,8 @@ struct st_myisam_info { my_off_t last_search_keypage; /* Last keypage when searching */ my_off_t dupp_key_pos; 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 */ int dfile; /* The datafile */ uint opt_flag; /* Optim. for space/speed */ @@ -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, 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, my_off_t next_filepos,byte **record, ulong *reclength,int *flag); |