/* Delete record when we found a duplicated key */
static int sort_delete_record(MI_CHECK *param)
{
uint i;
int old_file,error;
uchar *key;
MI_INFO *info;
SORT_INFO *sort_info= ¶m->sort_info;
DBUG_ENTER("sort_delete_record");
if (param->opt_rep_quick == 1)
{
mi_check_print_error(param,
"Quick-recover aborted; Run recovery without switch 'q' or with switch -qq");
DBUG_RETURN(1);
}
info=sort_info->info;
if (info->s->options & HA_OPTION_COMPRESS_RECORD)
{
mi_check_print_error(param,
"Recover aborted; Can't run standard recovery on compressed tables with errors in data-file. Use switch 'myisamchk --safe-recover' to fix it\n",stderr);;
DBUG_RETURN(1);
}
old_file=info->dfile;
info->dfile=info->rec_cache.file;
if (sort_info->key)
{
key=info->lastkey+info->s->base.max_key_length;
if ((error=(*info->s->read_rnd)(info,sort_info->record,info->lastpos,0)) &&
error != HA_ERR_RECORD_DELETED)
{
mi_check_print_error(param,"Can't read record to be removed");