diff options
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/mi_cache.c | 4 | ||||
-rw-r--r-- | myisam/mi_check.c | 24 | ||||
-rw-r--r-- | myisam/mi_packrec.c | 2 | ||||
-rw-r--r-- | myisam/myisamchk.c | 4 |
4 files changed, 19 insertions, 15 deletions
diff --git a/myisam/mi_cache.c b/myisam/mi_cache.c index 0e630cae22b..69a1cb0d7a5 100644 --- a/myisam/mi_cache.c +++ b/myisam/mi_cache.c @@ -73,7 +73,7 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, if (!(flag & READING_HEADER) || info->error == -1 || (uint) info->error+in_buff_length < 3) { - if (!my_errno) + if (!my_errno || my_errno == -1) my_errno=HA_ERR_WRONG_IN_RECORD; DBUG_RETURN(1); } @@ -87,7 +87,7 @@ int _mi_read_cache(IO_CACHE *info, byte *buff, my_off_t pos, uint length, if (!(flag & READING_HEADER) || (int) read_length == -1 || read_length+in_buff_length < 3) { - if (!my_errno) + if (!my_errno || my_errno == -1) my_errno=HA_ERR_WRONG_IN_RECORD; DBUG_RETURN(1); } diff --git a/myisam/mi_check.c b/myisam/mi_check.c index 0caedbe1a51..64bc5d7b8e5 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -708,7 +708,7 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) puts("- check record links"); } - if (!(record= (byte*) my_alloca(info->s->base.pack_reclength))) + if (!(record= (byte*) my_malloc(info->s->base.pack_reclength,MYF(0)))) { mi_check_print_error(param,"Not Enough memory"); DBUG_RETURN(-1); @@ -924,8 +924,9 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) if (block_info.rec_len < (uint) info->s->min_pack_length || block_info.rec_len > (uint) info->s->max_pack_length) { - mi_check_print_error(param,"Found block with wrong recordlength: %d at %s", - block_info.rec_len, llstr(start_recpos,llbuff)); + mi_check_print_error(param, + "Found block with wrong recordlength: %d at %s", + block_info.rec_len, llstr(start_recpos,llbuff)); got_error=1; break; } @@ -934,7 +935,8 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) goto err; if (_mi_pack_rec_unpack(info,record,info->rec_buff,block_info.rec_len)) { - mi_check_print_error(param,"Found wrong record at %s", llstr(start_recpos,llbuff)); + mi_check_print_error(param,"Found wrong record at %s", + llstr(start_recpos,llbuff)); got_error=1; } if (static_row_size) @@ -1082,12 +1084,12 @@ int chk_data_link(MI_CHECK *param, MI_INFO *info,int extend) printf("Lost space: %12s Linkdata: %10s\n", llstr(empty,llbuff),llstr(link_used,llbuff2)); } - my_afree((gptr) record); + my_free((gptr) record,MYF(0)); DBUG_RETURN (error); err: - mi_check_print_error(param,"got error: %d when reading datafile",my_errno); + mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff)); err2: - my_afree((gptr) record); + my_free((gptr) record,MYF(0)); param->retry_without_quick=1; DBUG_RETURN(1); } /* chk_data_link */ @@ -1188,7 +1190,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, del=info->state->del; info->state->records=info->state->del=share->state.split=0; info->state->empty=0; - if (sort_info->new_data_file_type != COMPRESSED_RECORD && !rep_quick) + if (!rep_quick) share->state.checksum=0; info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); for (i=0 ; i < info->s->base.keys ; i++) @@ -1866,8 +1868,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info, sort_param.sort_info=sort_info; del=info->state->del; - if (sort_info->new_data_file_type != COMPRESSED_RECORD && - ! rep_quick) + if (! rep_quick) share->state.checksum=0; rec_per_key_part= param->rec_per_key_part; @@ -2414,6 +2415,7 @@ static int sort_get_next_record(SORT_INFO *sort_info) llstr(sort_info->pos,llbuff)); continue; } + info->checksum=mi_checksum(info,sort_info->record); if (!sort_info->fix_datafile) sort_info->filepos=sort_info->pos; sort_info->max_pos=(sort_info->pos=block_info.filepos+ @@ -2492,6 +2494,7 @@ int sort_write_record(SORT_INFO *sort_info) DBUG_RETURN(1); } sort_info->filepos+=block_length; + info->s->state.checksum+=info->checksum; break; case COMPRESSED_RECORD: reclength=info->packed_length; @@ -2504,6 +2507,7 @@ int sort_write_record(SORT_INFO *sort_info) mi_check_print_error(param,"%d when writing to datafile",my_errno); DBUG_RETURN(1); } + info->s->state.checksum+=info->checksum; sort_info->filepos+=reclength+length; break; } diff --git a/myisam/mi_packrec.c b/myisam/mi_packrec.c index be7f9dcae0a..68d546b2010 100644 --- a/myisam/mi_packrec.c +++ b/myisam/mi_packrec.c @@ -962,7 +962,7 @@ int _mi_read_rnd_pack_record(MI_INFO *info, byte *buf, b_type=_mi_pack_get_block_info(info,&block_info,info->dfile,filepos, info->rec_buff); if (b_type) - goto err; + goto err; /* Error code is already set */ #ifndef DBUG_OFF if (block_info.rec_len > share->max_pack_length) { diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index ec3f0c8dca4..996e4749e53 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -201,7 +201,7 @@ static struct option long_options[] = static void print_version(void) { - printf("%s Ver 1.49 for %s at %s\n",my_progname,SYSTEM_TYPE, + printf("%s Ver 1.50 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); } @@ -953,7 +953,7 @@ static void descript(MI_CHECK *param, register MI_INFO *info, my_string name) share->base.raid_chunks, share->base.raid_chunksize); } - if (share->options & HA_OPTION_CHECKSUM) + if (share->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD)) printf("Checksum: %23s\n",llstr(info->s->state.checksum,llbuff)); ; if (share->options & HA_OPTION_DELAY_KEY_WRITE) |