145
145
int chk_del(MI_CHECK *param, register MI_INFO *info, uint32_t test_flag)
148
147
uint32_t delete_link_length;
149
148
my_off_t empty, next_link, old_link= 0;
150
149
char buff[22],buff2[22];
152
151
param->record_checksum=0;
153
delete_link_length=((info->s->options & HA_OPTION_PACK_RECORD) ? 20 :
154
info->s->rec_reflength+1);
152
delete_link_length=((info->s->options & HA_OPTION_PACK_RECORD) ? 20 : info->s->rec_reflength+1);
156
154
if (!(test_flag & T_SILENT))
157
155
puts("- check record delete-chain");
169
167
if (test_flag & T_VERBOSE)
170
168
printf("Recordlinks: ");
172
for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
170
ha_rows i= info->state->del;
171
for (; i > 0 && next_link != HA_OFFSET_ERROR; i--)
174
173
if (*killed_ptr(param))
176
175
if (test_flag & T_VERBOSE)
177
printf(" %9s",llstr(next_link,buff));
176
printf(" %9s",llstr(next_link,buff));
178
177
if (next_link >= info->state->data_file_length)
180
if (my_pread(info->dfile, (unsigned char*) buff,delete_link_length,
181
next_link,MYF(MY_NABP)))
179
if (my_pread(info->dfile, (unsigned char*) buff,delete_link_length, next_link,MYF(MY_NABP)))
183
if (test_flag & T_VERBOSE) puts("");
184
mi_check_print_error(param,"Can't read delete-link at filepos: %s",
185
llstr(next_link,buff));
181
if (test_flag & T_VERBOSE) puts("");
182
mi_check_print_error(param,"Can't read delete-link at filepos: %s",
183
llstr(next_link,buff));
188
186
if (*buff != '\0')
190
if (test_flag & T_VERBOSE) puts("");
191
mi_check_print_error(param,"Record at pos: %s is not remove-marked",
192
llstr(next_link,buff));
188
if (test_flag & T_VERBOSE) puts("");
189
mi_check_print_error(param,"Record at pos: %s is not remove-marked",
190
llstr(next_link,buff));
195
193
if (info->s->options & HA_OPTION_PACK_RECORD)
197
my_off_t prev_link=mi_sizekorr(buff+12);
198
if (empty && prev_link != old_link)
200
if (test_flag & T_VERBOSE) puts("");
201
mi_check_print_error(param,"Deleted block at %s doesn't point back at previous delete link",llstr(next_link,buff2));
205
next_link=mi_sizekorr(buff+4);
206
empty+=mi_uint3korr(buff+1);
195
my_off_t prev_link=mi_sizekorr(buff+12);
196
if (empty && prev_link != old_link)
198
if (test_flag & T_VERBOSE) puts("");
199
mi_check_print_error(param,"Deleted block at %s doesn't point back at previous delete link",llstr(next_link,buff2));
203
next_link=mi_sizekorr(buff+4);
204
empty+=mi_uint3korr(buff+1);
210
param->record_checksum+=(ha_checksum) next_link;
211
next_link=_mi_rec_pos(info->s,(unsigned char*) buff+1);
212
empty+=info->s->base.pack_reclength;
208
param->record_checksum+=(ha_checksum) next_link;
209
next_link=_mi_rec_pos(info->s,(unsigned char*) buff+1);
210
empty+=info->s->base.pack_reclength;
215
213
if (test_flag & T_VERBOSE)
217
215
if (empty != info->state->empty)
219
217
mi_check_print_warning(param,
220
"Found %s deleted space in delete link chain. Should be %s",
222
llstr(info->state->empty,buff));
218
"Found %s deleted space in delete link chain. Should be %s",
220
llstr(info->state->empty,buff));
224
222
if (next_link != HA_OFFSET_ERROR)
226
224
mi_check_print_error(param,
227
"Found more than the expected %s deleted rows in delete link chain",
228
llstr(info->state->del, buff));
225
"Found more than the expected %s deleted rows in delete link chain",
226
llstr(info->state->del, buff));
233
mi_check_print_error(param,
234
"Found %s deleted rows in delete link chain. Should be %s",
235
llstr(info->state->del - i, buff2),
236
llstr(info->state->del, buff));
231
mi_check_print_error(param, "Found %s deleted rows in delete link chain. Should be %s", llstr(info->state->del - i, buff2), llstr(info->state->del, buff));
243
238
param->testflag|=T_RETRY_WITHOUT_QUICK;
244
239
if (test_flag & T_VERBOSE) puts("");
245
240
mi_check_print_error(param,"record delete-link-chain corrupted");