~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/mi_check.c

  • Committer: Brian Aker
  • Date: 2008-07-16 21:28:26 UTC
  • mfrom: (77.3.28 glibclient)
  • Revision ID: brian@tangent.org-20080716212826-p44t3u6v1zb0dmxg
Merge from Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
139
139
  uint delete_link_length;
140
140
  my_off_t empty, next_link, old_link= 0;
141
141
  char buff[22],buff2[22];
142
 
  DBUG_ENTER("chk_del");
143
142
 
144
143
  param->record_checksum=0;
145
144
  delete_link_length=((info->s->options & HA_OPTION_PACK_RECORD) ? 20 :
164
163
    for (i= info->state->del ; i > 0L && next_link != HA_OFFSET_ERROR ; i--)
165
164
    {
166
165
      if (*killed_ptr(param))
167
 
        DBUG_RETURN(1);
 
166
        return(1);
168
167
      if (test_flag & T_VERBOSE)
169
168
        printf(" %9s",llstr(next_link,buff));
170
169
      if (next_link >= info->state->data_file_length)
175
174
        if (test_flag & T_VERBOSE) puts("");
176
175
        mi_check_print_error(param,"Can't read delete-link at filepos: %s",
177
176
                    llstr(next_link,buff));
178
 
        DBUG_RETURN(1);
 
177
        return(1);
179
178
      }
180
179
      if (*buff != '\0')
181
180
      {
229
228
      goto wrong;
230
229
    }
231
230
  }
232
 
  DBUG_RETURN(0);
 
231
  return(0);
233
232
 
234
233
wrong:
235
234
  param->testflag|=T_RETRY_WITHOUT_QUICK;
236
235
  if (test_flag & T_VERBOSE) puts("");
237
236
  mi_check_print_error(param,"record delete-link-chain corrupted");
238
 
  DBUG_RETURN(1);
 
237
  return(1);
239
238
} /* chk_del */
240
239
 
241
240
 
248
247
  ha_rows records;
249
248
  char llbuff[21], llbuff2[21];
250
249
  uchar *buff;
251
 
  DBUG_ENTER("check_k_link");
252
 
  DBUG_PRINT("enter", ("block_size: %u", block_size));
253
250
 
254
251
  if (param->testflag & T_VERBOSE)
255
252
    printf("block_size %4u:", block_size); /* purecov: tested */
259
256
  while (next_link != HA_OFFSET_ERROR && records > 0)
260
257
  {
261
258
    if (*killed_ptr(param))
262
 
      DBUG_RETURN(1);
 
259
      return(1);
263
260
    if (param->testflag & T_VERBOSE)
264
261
      printf("%16s",llstr(next_link,llbuff));
265
262
 
271
268
                           "key block size: %u  file_length: %s",
272
269
                           llstr(next_link, llbuff), block_size,
273
270
                           llstr(info->state->key_file_length, llbuff2));
274
 
      DBUG_RETURN(1);
 
271
      return(1);
275
272
      /* purecov: end */
276
273
    }
277
274
 
282
279
      mi_check_print_error(param, "Mis-aligned key block: %s  "
283
280
                           "minimum key block length: %u",
284
281
                           llstr(next_link, llbuff), MI_MIN_KEY_BLOCK_LENGTH);
285
 
      DBUG_RETURN(1);
 
282
      return(1);
286
283
      /* purecov: end */
287
284
    }
288
285
 
299
296
      /* purecov: begin tested */
300
297
      mi_check_print_error(param, "key cache read error for block: %s",
301
298
                           llstr(next_link,llbuff));
302
 
      DBUG_RETURN(1);
 
299
      return(1);
303
300
      /* purecov: end */
304
301
    }
305
302
    next_link=mi_sizekorr(buff);
313
310
    else
314
311
      puts("");
315
312
  }
316
 
  DBUG_RETURN (next_link != HA_OFFSET_ERROR);
 
313
  return (next_link != HA_OFFSET_ERROR);
317
314
} /* check_k_link */
318
315
 
319
316
 
324
321
  int error=0;
325
322
  register my_off_t skr,size;
326
323
  char buff[22],buff2[22];
327
 
  DBUG_ENTER("chk_size");
328
324
 
329
325
  if (!(param->testflag & T_SILENT)) puts("- check file-size");
330
326
 
389
385
    mi_check_print_warning(param, "Datafile is almost full, %10s of %10s used",
390
386
                           llstr(info->state->data_file_length,buff),
391
387
                           llstr(info->s->base.max_data_file_length-1,buff2));
392
 
  DBUG_RETURN(error);
 
388
  return(error);
393
389
} /* chk_size */
394
390
 
395
391
 
405
401
  MYISAM_SHARE *share=info->s;
406
402
  MI_KEYDEF *keyinfo;
407
403
  char buff[22],buff2[22];
408
 
  DBUG_ENTER("chk_key");
409
404
 
410
405
  if (!(param->testflag & T_SILENT))
411
406
    puts("- check key delete-chain");
416
411
    {
417
412
      if (param->testflag & T_VERBOSE) puts("");
418
413
      mi_check_print_error(param,"key delete-link-chain corrupted");
419
 
      DBUG_RETURN(-1);
 
414
      return(-1);
420
415
    }
421
416
 
422
417
  if (!(param->testflag & T_SILENT)) puts("- check index reference");
460
455
      mi_check_print_error(param,"Can't read indexpage from filepos: %s",
461
456
                  llstr(share->state.key_root[key],buff));
462
457
      if (!(param->testflag & T_INFO))
463
 
        DBUG_RETURN(-1);
 
458
        return(-1);
464
459
      result= -1;
465
460
      continue;
466
461
    }
471
466
    param->max_level=0;
472
467
    if (chk_index(param,info,keyinfo,share->state.key_root[key],info->buff,
473
468
                  &keys, param->key_crc+key,1))
474
 
      DBUG_RETURN(-1);
 
469
      return(-1);
475
470
    if(!(keyinfo->flag & (HA_FULLTEXT | HA_SPATIAL)))
476
471
    {
477
472
      if (keys != info->state->records)
479
474
        mi_check_print_error(param,"Found %s keys of %s",llstr(keys,buff),
480
475
                    llstr(info->state->records,buff2));
481
476
        if (!(param->testflag & T_INFO))
482
 
        DBUG_RETURN(-1);
 
477
        return(-1);
483
478
        result= -1;
484
479
        continue;
485
480
      }
496
491
        else
497
492
          mi_check_print_error(param,"Key 1 doesn't point at all records");
498
493
        if (!(param->testflag & T_INFO))
499
 
          DBUG_RETURN(-1);
 
494
          return(-1);
500
495
        result= -1;
501
496
        continue;
502
497
      }
574
569
    param->record_checksum=old_record_checksum-init_checksum;   /* Remove delete links */
575
570
  else
576
571
    param->record_checksum=0;
577
 
  DBUG_RETURN(result);
 
572
  return(result);
578
573
} /* chk_key */
579
574
 
580
575
 
583
578
                     ha_checksum *key_checksum, uint level)
584
579
{
585
580
  char llbuff[22],llbuff2[22];
586
 
  DBUG_ENTER("chk_index_down");
587
581
 
588
582
  /* Key blocks must lay within the key file length entirely. */
589
583
  if (page + keyinfo->block_length > info->state->key_file_length)
625
619
  if (chk_index(param,info,keyinfo,page,buff,keys,key_checksum,level))
626
620
    goto err;
627
621
 
628
 
  DBUG_RETURN(0);
 
622
  return(0);
629
623
 
630
624
  /* purecov: begin tested */
631
625
err:
632
 
  DBUG_RETURN(1);
 
626
  return(1);
633
627
  /* purecov: end */
634
628
}
635
629
 
735
729
  my_off_t next_page,record;
736
730
  char llbuff[22];
737
731
  uint diff_pos[2];
738
 
  DBUG_ENTER("chk_index");
739
 
  DBUG_DUMP("buff",(uchar*) buff,mi_getint(buff));
740
732
 
741
733
  if (!(temp_buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
742
734
  {
743
735
    mi_check_print_error(param,"Not enough memory for keyblock");
744
 
    DBUG_RETURN(-1);
 
736
    return(-1);
745
737
  }
746
738
 
747
739
  if (keyinfo->flag & HA_NOSAME)
781
773
    if (keypos >= endpos ||
782
774
        (key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,key)) == 0)
783
775
      break;
784
 
    DBUG_ASSERT(key_length <= sizeof(key));
 
776
    assert(key_length <= sizeof(key));
785
777
    if (keypos > endpos)
786
778
    {
787
779
      mi_check_print_error(param,"Wrong key block length at page: %s",llstr(page,llbuff));
791
783
        (flag=ha_key_cmp(keyinfo->seg,info->lastkey,key,key_length,
792
784
                         comp_flag, diff_pos)) >=0)
793
785
    {
794
 
      DBUG_DUMP("old",(uchar*) info->lastkey, info->lastkey_length);
795
 
      DBUG_DUMP("new",(uchar*) key, key_length);
796
 
      DBUG_DUMP("new_in_page",(uchar*) old_keypos,(uint) (keypos-old_keypos));
797
 
 
798
786
      if (comp_flag & SEARCH_FIND && flag == 0)
799
787
        mi_check_print_error(param,"Found duplicated key at page %s",llstr(page,llbuff));
800
788
      else
829
817
    record= _mi_dpos(info,0,key+key_length);
830
818
    if (record >= info->state->data_file_length)
831
819
    {
832
 
#ifndef DBUG_OFF
833
 
      char llbuff2[22], llbuff3[22];
834
 
#endif
835
820
      mi_check_print_error(param,"Found key at page %s that points to record outside datafile",llstr(page,llbuff));
836
 
      DBUG_PRINT("test",("page: %s  record: %s  filelength: %s",
837
 
                         llstr(page,llbuff),llstr(record,llbuff2),
838
 
                         llstr(info->state->data_file_length,llbuff3)));
839
 
      DBUG_DUMP("key",(uchar*) key,key_length);
840
 
      DBUG_DUMP("new_in_page",(uchar*) old_keypos,(uint) (keypos-old_keypos));
841
821
      goto err;
842
822
    }
843
823
    param->record_checksum+=(ha_checksum) record;
849
829
    goto err;
850
830
  }
851
831
  my_afree((uchar*) temp_buff);
852
 
  DBUG_RETURN(0);
 
832
  return(0);
853
833
 err:
854
834
  my_afree((uchar*) temp_buff);
855
 
  DBUG_RETURN(1);
 
835
  return(1);
856
836
} /* chk_index */
857
837
 
858
838
 
861
841
static ha_checksum calc_checksum(ha_rows count)
862
842
{
863
843
  uint64_t sum,a,b;
864
 
  DBUG_ENTER("calc_checksum");
865
844
 
866
845
  sum=0;
867
846
  a=count; b=count+1;
875
854
      sum+=a;
876
855
    a<<=1; b>>=1;
877
856
  }
878
 
  DBUG_PRINT("exit",("sum: %lx",(ulong) sum));
879
 
  DBUG_RETURN((ha_checksum) sum);
 
857
  return((ha_checksum) sum);
880
858
} /* calc_checksum */
881
859
 
882
860
 
886
864
{
887
865
  uint length;
888
866
  HA_KEYSEG *keyseg;
889
 
  DBUG_ENTER("isam_key_length");
890
867
 
891
868
  length= info->s->rec_reflength;
892
869
  for (keyseg=keyinfo->seg ; keyseg->type ; keyseg++)
893
870
    length+= keyseg->length;
894
871
 
895
 
  DBUG_PRINT("exit",("length: %d",length));
896
 
  DBUG_RETURN(length);
 
872
  return(length);
897
873
} /* key_length */
898
874
 
899
875
 
913
889
  my_bool static_row_size;
914
890
  MI_KEYDEF *keyinfo;
915
891
  MI_BLOCK_INFO block_info;
916
 
  DBUG_ENTER("chk_data_link");
917
892
 
918
893
  if (!(param->testflag & T_SILENT))
919
894
  {
926
901
  if (!mi_alloc_rec_buff(info, -1, &record))
927
902
  {
928
903
    mi_check_print_error(param,"Not enough memory for record");
929
 
    DBUG_RETURN(-1);
 
904
    return(-1);
930
905
  }
931
906
  records=del_blocks=0;
932
907
  used=link_used=splits=del_length=0;
1327
1302
           llstr(empty,llbuff),llstr(link_used,llbuff2));
1328
1303
  }
1329
1304
  my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
1330
 
  DBUG_RETURN (error);
 
1305
  return (error);
1331
1306
 err:
1332
1307
  mi_check_print_error(param,"got error: %d when reading datafile at record: %s",my_errno, llstr(records,llbuff));
1333
1308
 err2:
1334
1309
  my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
1335
1310
  param->testflag|=T_RETRY_WITHOUT_QUICK;
1336
 
  DBUG_RETURN(1);
 
1311
  return(1);
1337
1312
} /* chk_data_link */
1338
1313
 
1339
1314
 
1396
1371
  MI_STATE_INFO *state= &share->state;
1397
1372
  uint i;
1398
1373
  int error;
1399
 
  DBUG_ENTER("mi_drop_all_indexes");
1400
1374
 
1401
1375
  /*
1402
1376
    If any of the disabled indexes has a key block assigned, we must
1407
1381
  */
1408
1382
  if (!force && (param->testflag & T_CREATE_MISSING_KEYS))
1409
1383
  {
1410
 
    DBUG_PRINT("repair", ("creating missing indexes"));
1411
1384
    for (i= 0; i < share->base.keys; i++)
1412
1385
    {
1413
 
      DBUG_PRINT("repair", ("index #: %u  key_root: 0x%lx  active: %d",
1414
 
                            i, (long) state->key_root[i],
1415
 
                            mi_is_key_active(state->key_map, i)));
1416
1386
      if ((state->key_root[i] != HA_OFFSET_ERROR) &&
1417
1387
          !mi_is_key_active(state->key_map, i))
1418
1388
      {
1421
1391
          We would lose its block(s) if would just recreate it.
1422
1392
          So we need to drop and recreate all indexes.
1423
1393
        */
1424
 
        DBUG_PRINT("repair", ("nonempty and disabled: recreate all"));
1425
1394
        break;
1426
1395
      }
1427
1396
    }
1432
1401
        Flush dirty blocks of this index file from key cache and remove
1433
1402
        all blocks of this index file from key cache.
1434
1403
      */
1435
 
      DBUG_PRINT("repair", ("all disabled are empty: create missing"));
1436
1404
      error= flush_key_blocks(share->key_cache, share->kfile,
1437
1405
                              FLUSH_FORCE_WRITE);
1438
1406
      goto end;
1443
1411
      disabled indexes and enable them.
1444
1412
    */
1445
1413
    mi_clear_all_keys_active(state->key_map);
1446
 
    DBUG_PRINT("repair", ("declared all indexes disabled"));
1447
1414
  }
1448
1415
 
1449
1416
  /* Remove all key blocks of this index file from key cache. */
1462
1429
  /* Reset index file length to end of index file header. */
1463
1430
  info->state->key_file_length= share->base.keystart;
1464
1431
 
1465
 
  DBUG_PRINT("repair", ("dropped all indexes"));
1466
1432
  /* error= 0; set by last (error= flush_key_bocks()). */
1467
1433
 
1468
1434
 end:
1469
 
  DBUG_RETURN(error);
 
1435
  return(error);
1470
1436
}
1471
1437
 
1472
1438
 
1484
1450
  char llbuff[22],llbuff2[22];
1485
1451
  SORT_INFO sort_info;
1486
1452
  MI_SORT_PARAM sort_param;
1487
 
  DBUG_ENTER("mi_repair");
1488
1453
 
1489
1454
  bzero((char *)&sort_info, sizeof(sort_info));
1490
1455
  bzero((char *)&sort_param, sizeof(sort_param));
1593
1558
    {
1594
1559
      if (my_errno != HA_ERR_FOUND_DUPP_KEY)
1595
1560
        goto err;
1596
 
      DBUG_DUMP("record",(uchar*) sort_param.record,share->base.pack_reclength);
1597
1561
      mi_check_print_info(param,"Duplicate key %2d for record at %10s against new record at %10s",
1598
1562
                          info->errkey+1,
1599
1563
                          llstr(sort_param.start_recpos,llbuff),
1602
1566
      {
1603
1567
        VOID(_mi_make_key(info,(uint) info->errkey,info->lastkey,
1604
1568
                          sort_param.record,0L));
1605
 
        _mi_print_key(stdout,share->keyinfo[info->errkey].seg,info->lastkey,
1606
 
                      USE_WHOLE_KEY);
1607
1569
      }
1608
1570
      sort_info.dupp++;
1609
1571
      if ((param->testflag & (T_FORCE_UNIQUENESS|T_QUICK)) == T_QUICK)
1729
1691
  }
1730
1692
  share->state.changed|= (STATE_NOT_OPTIMIZED_KEYS | STATE_NOT_SORTED_PAGES |
1731
1693
                          STATE_NOT_ANALYZED);
1732
 
  DBUG_RETURN(got_error);
 
1694
  return(got_error);
1733
1695
}
1734
1696
 
1735
1697
 
1742
1704
  MI_INFO  *info=   sort_param->sort_info->info;
1743
1705
  uchar    *buff=   sort_param->record;
1744
1706
  my_off_t filepos= sort_param->filepos;
1745
 
  DBUG_ENTER("writekeys");
1746
1707
 
1747
1708
  key=info->lastkey+info->s->base.max_key_length;
1748
1709
  for (i=0 ; i < info->s->base.keys ; i++)
1756
1717
      }
1757
1718
    }
1758
1719
  }
1759
 
  DBUG_RETURN(0);
 
1720
  return(0);
1760
1721
 
1761
1722
 err:
1762
1723
  if (my_errno == HA_ERR_FOUND_DUPP_KEY)
1777
1738
  /* Remove checksum that was added to glob_crc in sort_get_next_record */
1778
1739
  if (sort_param->calc_checksum)
1779
1740
    sort_param->sort_info->param->glob_crc-= info->checksum;
1780
 
  DBUG_PRINT("error",("errno: %d",my_errno));
1781
 
  DBUG_RETURN(-1);
 
1741
  return(-1);
1782
1742
} /* writekeys */
1783
1743
 
1784
1744
 
1790
1750
  register uint i;
1791
1751
  uchar *key;
1792
1752
  uint key_length;
1793
 
  DBUG_ENTER("movepoint");
1794
1753
 
1795
1754
  key=info->lastkey+info->s->base.max_key_length;
1796
1755
  for (i=0 ; i < info->s->base.keys; i++)
1806
1765
        if (_mi_search(info,keyinfo,key,USE_WHOLE_KEY,
1807
1766
                       (uint) (SEARCH_SAME | SEARCH_SAVE_BUFF),
1808
1767
                       info->s->state.key_root[i]))
1809
 
          DBUG_RETURN(-1);
 
1768
          return(-1);
1810
1769
        nod_flag=mi_test_if_nod(info->buff);
1811
1770
        _mi_dpointer(info,info->int_keypos-nod_flag-
1812
1771
                     info->s->rec_reflength,newpos);
1813
1772
        if (_mi_write_keypage(info,keyinfo,info->last_keypage,
1814
1773
                              DFLT_INIT_HITS,info->buff))
1815
 
          DBUG_RETURN(-1);
 
1774
          return(-1);
1816
1775
      }
1817
1776
      else
1818
1777
      {                                 /* Change old key to new */
1819
1778
        if (_mi_ck_delete(info,i,key,key_length))
1820
 
          DBUG_RETURN(-1);
 
1779
          return(-1);
1821
1780
        key_length=_mi_make_key(info,i,key,record,newpos);
1822
1781
        if (_mi_ck_write(info,i,key,key_length))
1823
 
          DBUG_RETURN(-1);
 
1782
          return(-1);
1824
1783
      }
1825
1784
    }
1826
1785
  }
1827
 
  DBUG_RETURN(0);
 
1786
  return(0);
1828
1787
} /* movepoint */
1829
1788
 
1830
1789
 
1871
1830
  int old_lock;
1872
1831
  MYISAM_SHARE *share=info->s;
1873
1832
  MI_STATE_INFO old_state;
1874
 
  DBUG_ENTER("mi_sort_index");
1875
1833
 
1876
1834
  /* cannot sort index files with R-tree indexes */
1877
1835
  for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ;
1888
1846
  {
1889
1847
    mi_check_print_error(param,"Can't create new tempfile: '%s'",
1890
1848
                         param->temp_filename);
1891
 
    DBUG_RETURN(-1);
 
1849
    return(-1);
1892
1850
  }
1893
1851
  if (filecopy(param, new_file,share->kfile,0L,
1894
1852
               (ulong) share->base.keystart, "headerblock"))
1947
1905
    info->s->state.key_del[key]=  HA_OFFSET_ERROR;
1948
1906
 
1949
1907
  info->s->state.changed&= ~STATE_NOT_SORTED_PAGES;
1950
 
  DBUG_RETURN(0);
 
1908
  return(0);
1951
1909
 
1952
1910
err:
1953
1911
  VOID(my_close(new_file,MYF(MY_WME)));
1954
1912
err2:
1955
1913
  VOID(my_delete(param->temp_filename,MYF(MY_WME)));
1956
 
  DBUG_RETURN(-1);
 
1914
  return(-1);
1957
1915
} /* mi_sort_index */
1958
1916
 
1959
1917
 
1967
1925
  uchar key[HA_MAX_POSSIBLE_KEY_BUFF];
1968
1926
  my_off_t new_page_pos,next_page;
1969
1927
  char llbuff[22];
1970
 
  DBUG_ENTER("sort_one_index");
1971
1928
 
1972
1929
  new_page_pos=param->new_file_pos;
1973
1930
  param->new_file_pos+=keyinfo->block_length;
1975
1932
  if (!(buff=(uchar*) my_alloca((uint) keyinfo->block_length)))
1976
1933
  {
1977
1934
    mi_check_print_error(param,"Not enough memory for key block");
1978
 
    DBUG_RETURN(-1);
 
1935
    return(-1);
1979
1936
  }
1980
1937
  if (!_mi_fetch_keypage(info,keyinfo,pagepos,DFLT_INIT_HITS,buff,0))
1981
1938
  {
1996
1953
        _mi_kpointer(info,keypos-nod_flag,param->new_file_pos); /* Save new pos */
1997
1954
        if (sort_one_index(param,info,keyinfo,next_page,new_file))
1998
1955
        {
1999
 
          DBUG_PRINT("error",
2000
 
                     ("From page: %ld, keyoffset: %lu  used_length: %d",
2001
 
                      (ulong) pagepos, (ulong) (keypos - buff),
2002
 
                      (int) used_length));
2003
 
          DBUG_DUMP("buff",(uchar*) buff,used_length);
2004
1956
          goto err;
2005
1957
        }
2006
1958
      }
2007
1959
      if (keypos >= endpos ||
2008
1960
          (key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,key)) == 0)
2009
1961
        break;
2010
 
      DBUG_ASSERT(keypos <= endpos);
 
1962
      assert(keypos <= endpos);
2011
1963
    }
2012
1964
  }
2013
1965
 
2021
1973
    goto err;
2022
1974
  }
2023
1975
  my_afree((uchar*) buff);
2024
 
  DBUG_RETURN(0);
 
1976
  return(0);
2025
1977
err:
2026
1978
  my_afree((uchar*) buff);
2027
 
  DBUG_RETURN(1);
 
1979
  return(1);
2028
1980
} /* sort_one_index */
2029
1981
 
2030
1982
 
2051
2003
} /* change_to_newfile */
2052
2004
 
2053
2005
 
 
2006
 
2054
2007
        /* Copy a block between two files */
2055
2008
 
2056
2009
int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
2058
2011
{
2059
2012
  char tmp_buff[IO_SIZE],*buff;
2060
2013
  ulong buff_length;
2061
 
  DBUG_ENTER("filecopy");
2062
2014
 
2063
2015
  buff_length=(ulong) min(param->write_buffer_length,length);
2064
2016
  if (!(buff=my_malloc(buff_length,MYF(0))))
2079
2031
    goto err;
2080
2032
  if (buff != tmp_buff)
2081
2033
    my_free(buff,MYF(0));
2082
 
  DBUG_RETURN(0);
 
2034
  return(0);
2083
2035
err:
2084
2036
  if (buff != tmp_buff)
2085
2037
    my_free(buff,MYF(0));
2086
2038
  mi_check_print_error(param,"Can't copy %s to tempfile, error %d",
2087
2039
                       type,my_errno);
2088
 
  DBUG_RETURN(1);
 
2040
  return(1);
2089
2041
}
2090
2042
 
2091
2043
 
2120
2072
  char llbuff[22];
2121
2073
  SORT_INFO sort_info;
2122
2074
  uint64_t key_map= 0;
2123
 
  DBUG_ENTER("mi_repair_by_sort");
2124
2075
 
2125
2076
  start_records=info->state->records;
2126
2077
  got_error=1;
2253
2204
             (char*) (share->state.rec_per_key_part +
2254
2205
                      (uint) (rec_per_key_part - param->rec_per_key_part)),
2255
2206
             sort_param.keyinfo->keysegs*sizeof(*rec_per_key_part));
2256
 
      DBUG_PRINT("repair", ("skipping seemingly disabled index #: %u",
2257
 
                            sort_param.key));
2258
2207
      continue;
2259
2208
    }
2260
2209
 
2303
2252
                       (uint64_t) info->state->records);
2304
2253
    /* Enable this index in the permanent (not the copied) key_map. */
2305
2254
    mi_set_key_active(share->state.key_map, sort_param.key);
2306
 
    DBUG_PRINT("repair", ("set enabled index #: %u", sort_param.key));
2307
2255
 
2308
2256
    if (sort_param.fix_datafile)
2309
2257
    {
2439
2387
    share->state.header.options[0]&= (uchar) ~HA_OPTION_COMPRESS_RECORD;
2440
2388
    share->pack.header_length=0;
2441
2389
  }
2442
 
  DBUG_RETURN(got_error);
 
2390
  return(got_error);
2443
2391
}
2444
2392
 
2445
2393
/*
2504
2452
  uint64_t key_map= 0;
2505
2453
  pthread_attr_t thr_attr;
2506
2454
  ulong max_pack_reclength;
2507
 
  DBUG_ENTER("mi_repair_parallel");
2508
2455
 
2509
2456
  start_records=info->state->records;
2510
2457
  got_error=1;
2549
2496
      position 'new_header_length'.
2550
2497
    }
2551
2498
  */
2552
 
  DBUG_PRINT("info", ("is quick repair: %d", rep_quick));
2553
2499
  bzero((char*)&sort_info,sizeof(sort_info));
2554
2500
  /* Initialize pthread structures before goto err. */
2555
2501
  pthread_mutex_init(&sort_info.mutex, MY_MUTEX_INIT_FAST);
2765
2711
    */
2766
2712
    sort_param[i].read_cache= ((rep_quick || !i) ? param->read_cache :
2767
2713
                               new_data_cache);
2768
 
    DBUG_PRINT("io_cache_share", ("thread: %u  read_cache: 0x%lx",
2769
 
                                  i, (long) &sort_param[i].read_cache));
2770
2714
 
2771
2715
    /*
2772
2716
      two approaches: the same amount of memory for each thread
2788
2732
      /* Cleanup: Detach from the share. Avoid others to be blocked. */
2789
2733
      if (io_share.total_threads)
2790
2734
        remove_io_thread(&sort_param[i].read_cache);
2791
 
      DBUG_PRINT("error", ("Cannot start a repair thread"));
2792
2735
      sort_info.got_error=1;
2793
2736
    }
2794
2737
    else
2952
2895
    share->state.header.options[0]&= (uchar) ~HA_OPTION_COMPRESS_RECORD;
2953
2896
    share->pack.header_length=0;
2954
2897
  }
2955
 
  DBUG_RETURN(got_error);
 
2898
  return(got_error);
2956
2899
}
2957
2900
 
2958
2901
        /* Read next record and return next key */
2962
2905
  int error;
2963
2906
  SORT_INFO *sort_info=sort_param->sort_info;
2964
2907
  MI_INFO *info=sort_info->info;
2965
 
  DBUG_ENTER("sort_key_read");
2966
2908
 
2967
2909
  if ((error=sort_get_next_record(sort_param)))
2968
 
    DBUG_RETURN(error);
 
2910
    return(error);
2969
2911
  if (info->state->records == sort_info->max_records)
2970
2912
  {
2971
2913
    mi_check_print_error(sort_info->param,
2972
2914
                         "Key %d - Found too many records; Can't continue",
2973
2915
                         sort_param->key+1);
2974
 
    DBUG_RETURN(1);
 
2916
    return(1);
2975
2917
  }
2976
2918
  sort_param->real_key_length=
2977
2919
    (info->s->rec_reflength+
2981
2923
  bzero(key+sort_param->real_key_length,
2982
2924
        (sort_param->key_length-sort_param->real_key_length));
2983
2925
#endif
2984
 
  DBUG_RETURN(sort_write_record(sort_param));
 
2926
  return(sort_write_record(sort_param));
2985
2927
} /* sort_key_read */
2986
2928
 
2987
2929
 
3029
2971
  MI_INFO *info=sort_info->info;
3030
2972
  MYISAM_SHARE *share=info->s;
3031
2973
  char llbuff[22],llbuff2[22];
3032
 
  DBUG_ENTER("sort_get_next_record");
3033
2974
 
3034
2975
  if (*killed_ptr(param))
3035
 
    DBUG_RETURN(1);
 
2976
    return(1);
3036
2977
 
3037
2978
  switch (share->data_file_type) {
3038
2979
  case STATIC_RECORD:
3045
2986
          param->out_flag |= O_DATA_LOST;
3046
2987
        param->retry_repair=1;
3047
2988
        param->testflag|=T_RETRY_WITHOUT_QUICK;
3048
 
        DBUG_RETURN(-1);
 
2989
        return(-1);
3049
2990
      }
3050
2991
      sort_param->start_recpos=sort_param->pos;
3051
2992
      if (!sort_param->fix_datafile)
3060
3001
        if (sort_param->calc_checksum)
3061
3002
          param->glob_crc+= (info->checksum=
3062
3003
                             mi_static_checksum(info,sort_param->record));
3063
 
        DBUG_RETURN(0);
 
3004
        return(0);
3064
3005
      }
3065
3006
      if (!sort_param->fix_datafile && sort_param->master)
3066
3007
      {
3111
3052
                                llstr(sort_param->start_recpos,llbuff),errno);
3112
3053
            goto try_next;
3113
3054
          }
3114
 
          DBUG_RETURN(-1);
 
3055
          return(-1);
3115
3056
        }
3116
3057
        if (searching && ! sort_param->fix_datafile)
3117
3058
        {
3118
3059
          param->error_printed=1;
3119
3060
          param->retry_repair=1;
3120
3061
          param->testflag|=T_RETRY_WITHOUT_QUICK;
3121
 
          DBUG_RETURN(1);       /* Something wrong with data */
 
3062
          return(1);    /* Something wrong with data */
3122
3063
        }
3123
3064
        b_type=_mi_get_block_info(&block_info,-1,pos);
3124
3065
        if ((b_type & (BLOCK_ERROR | BLOCK_FATAL_ERROR)) ||
3250
3191
                mi_check_print_error(param,"Not enough memory for blob at %s (need %lu)",
3251
3192
                                     llstr(sort_param->start_recpos,llbuff),
3252
3193
                                     (ulong) block_info.rec_len);
3253
 
                DBUG_RETURN(1);
 
3194
                return(1);
3254
3195
              }
3255
3196
              else
3256
3197
              {
3332
3273
                         sort_param->find_length) != MY_FILE_ERROR)
3333
3274
      {
3334
3275
        if (sort_param->read_cache.error < 0)
3335
 
          DBUG_RETURN(1);
 
3276
          return(1);
3336
3277
        if (sort_param->calc_checksum)
3337
3278
          info->checksum= mi_checksum(info, sort_param->record);
3338
3279
        if ((param->testflag & (T_EXTEND | T_REP)) || searching)
3350
3291
        }
3351
3292
        if (sort_param->calc_checksum)
3352
3293
          param->glob_crc+= info->checksum;
3353
 
        DBUG_RETURN(0);
 
3294
        return(0);
3354
3295
      }
3355
3296
      if (!searching)
3356
3297
        mi_check_print_info(param,"Key %d - Found wrong stored record at %s",
3366
3307
      if (_mi_read_cache(&sort_param->read_cache,(uchar*) block_info.header,
3367
3308
                         sort_param->pos,
3368
3309
                         share->pack.ref_length,READING_NEXT))
3369
 
        DBUG_RETURN(-1);
 
3310
        return(-1);
3370
3311
      if (searching && ! sort_param->fix_datafile)
3371
3312
      {
3372
3313
        param->error_printed=1;
3373
3314
        param->retry_repair=1;
3374
3315
        param->testflag|=T_RETRY_WITHOUT_QUICK;
3375
 
        DBUG_RETURN(1);         /* Something wrong with data */
 
3316
        return(1);              /* Something wrong with data */
3376
3317
      }
3377
3318
      sort_param->start_recpos=sort_param->pos;
3378
3319
      if (_mi_pack_get_block_info(info, &sort_param->bit_buff, &block_info,
3379
3320
                                  &sort_param->rec_buff, -1, sort_param->pos))
3380
 
        DBUG_RETURN(-1);
 
3321
        return(-1);
3381
3322
      if (!block_info.rec_len &&
3382
3323
          sort_param->pos + MEMMAP_EXTRA_MARGIN ==
3383
3324
          sort_param->read_cache.end_of_file)
3384
 
        DBUG_RETURN(-1);
 
3325
        return(-1);
3385
3326
      if (block_info.rec_len < (uint) share->min_pack_length ||
3386
3327
          block_info.rec_len > (uint) share->max_pack_length)
3387
3328
      {
3420
3361
      if (sort_param->calc_checksum)
3421
3362
        param->glob_crc+= (info->checksum=
3422
3363
                           mi_checksum(info, sort_param->record));
3423
 
      DBUG_RETURN(0);
 
3364
      return(0);
3424
3365
    }
3425
3366
  case BLOCK_RECORD:
3426
3367
    assert(0);                                  /* Impossible */
3427
3368
  }
3428
 
  DBUG_RETURN(1);                               /* Impossible */
 
3369
  return(1);                               /* Impossible */
3429
3370
}
3430
3371
 
3431
3372
 
3455
3396
  MI_CHECK *param=sort_info->param;
3456
3397
  MI_INFO *info=sort_info->info;
3457
3398
  MYISAM_SHARE *share=info->s;
3458
 
  DBUG_ENTER("sort_write_record");
3459
3399
 
3460
3400
  if (sort_param->fix_datafile)
3461
3401
  {
3465
3405
                     share->base.pack_reclength))
3466
3406
      {
3467
3407
        mi_check_print_error(param,"%d when writing to datafile",my_errno);
3468
 
        DBUG_RETURN(1);
 
3408
        return(1);
3469
3409
      }
3470
3410
      sort_param->filepos+=share->base.pack_reclength;
3471
3411
      info->s->state.split++;
3486
3426
          if (!(sort_info->buff=my_realloc(sort_info->buff, (uint) reclength,
3487
3427
                                           MYF(MY_FREE_ON_ERROR |
3488
3428
                                               MY_ALLOW_ZERO_PTR))))
3489
 
            DBUG_RETURN(1);
 
3429
            return(1);
3490
3430
          sort_info->buff_length=reclength;
3491
3431
        }
3492
3432
        from= sort_info->buff+ALIGN_SIZE(MI_MAX_DYN_BLOCK_HEADER);
3511
3451
                                  &from,&reclength,&flag))
3512
3452
        {
3513
3453
          mi_check_print_error(param,"%d when writing to datafile",my_errno);
3514
 
          DBUG_RETURN(1);
 
3454
          return(1);
3515
3455
        }
3516
3456
        sort_param->filepos+=block_length;
3517
3457
        info->s->state.split++;
3529
3469
          my_b_write(&info->rec_cache,(uchar*) sort_param->rec_buff,reclength))
3530
3470
      {
3531
3471
        mi_check_print_error(param,"%d when writing to datafile",my_errno);
3532
 
        DBUG_RETURN(1);
 
3472
        return(1);
3533
3473
      }
3534
3474
      /* sort_info->param->glob_crc+=info->checksum; */
3535
3475
      sort_param->filepos+=reclength+length;
3550
3490
      VOID(fflush(stdout));
3551
3491
    }
3552
3492
  }
3553
 
  DBUG_RETURN(0);
 
3493
  return(0);
3554
3494
} /* sort_write_record */
3555
3495
 
3556
3496
 
3613
3553
                                                    lastkey),
3614
3554
                                 llbuff2));
3615
3555
    param->testflag|=T_RETRY_WITHOUT_QUICK;
3616
 
    if (sort_info->param->testflag & T_VERBOSE)
3617
 
      _mi_print_key(stdout,sort_param->seg,(uchar*) a, USE_WHOLE_KEY);
3618
3556
    return (sort_delete_record(sort_param));
3619
3557
  }
3620
 
#ifndef DBUG_OFF
3621
 
  if (cmp > 0)
3622
 
  {
3623
 
    mi_check_print_error(param,
3624
 
                         "Internal error: Keys are not in order from sort");
3625
 
    return(1);
3626
 
  }
3627
 
#endif
3628
3558
  return (sort_insert_key(sort_param,sort_info->key_block,
3629
3559
                          (uchar*) a, HA_OFFSET_ERROR));
3630
3560
} /* sort_key_write */
3653
3583
  MI_KEYDEF *keyinfo=sort_param->keyinfo;
3654
3584
  SORT_INFO *sort_info= sort_param->sort_info;
3655
3585
  MI_CHECK *param=sort_info->param;
3656
 
  DBUG_ENTER("sort_insert_key");
3657
3586
 
3658
3587
  anc_buff=key_block->buff;
3659
3588
  info=sort_info->info;
3667
3596
    if (key_block == sort_info->key_block_end)
3668
3597
    {
3669
3598
      mi_check_print_error(param,"To many key-block-levels; Try increasing sort_key_blocks");
3670
 
      DBUG_RETURN(1);
 
3599
      return(1);
3671
3600
    }
3672
3601
    a_length=2+nod_flag;
3673
3602
    key_block->end_pos=anc_buff+2;
3691
3620
  {
3692
3621
    VOID(_mi_move_key(keyinfo,key_block->lastkey,key));
3693
3622
    key_block->last_length=a_length-t_length;
3694
 
    DBUG_RETURN(0);
 
3623
    return(0);
3695
3624
  }
3696
3625
 
3697
3626
        /* Fill block with end-zero and write filled block */
3700
3629
        keyinfo->block_length- key_block->last_length);
3701
3630
  key_file_length=info->state->key_file_length;
3702
3631
  if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
3703
 
    DBUG_RETURN(1);
 
3632
    return(1);
3704
3633
 
3705
3634
  /* If we read the page from the key cache, we have to write it back to it */
3706
3635
  if (key_file_length == info->state->key_file_length)
3707
3636
  {
3708
3637
    if (_mi_write_keypage(info, keyinfo, filepos, DFLT_INIT_HITS, anc_buff))
3709
 
      DBUG_RETURN(1);
 
3638
      return(1);
3710
3639
  }
3711
3640
  else if (my_pwrite(info->s->kfile,(uchar*) anc_buff,
3712
3641
                     (uint) keyinfo->block_length,filepos, param->myf_rw))
3713
 
    DBUG_RETURN(1);
3714
 
  DBUG_DUMP("buff",(uchar*) anc_buff,mi_getint(anc_buff));
 
3642
    return(1);
3715
3643
 
3716
3644
        /* Write separator-key to block in next level */
3717
3645
  if (sort_insert_key(sort_param,key_block+1,key_block->lastkey,filepos))
3718
 
    DBUG_RETURN(1);
 
3646
    return(1);
3719
3647
 
3720
3648
        /* clear old block and write new key in it */
3721
3649
  key_block->inited=0;
3722
 
  DBUG_RETURN(sort_insert_key(sort_param, key_block,key,prev_block));
 
3650
  return(sort_insert_key(sort_param, key_block,key,prev_block));
3723
3651
} /* sort_insert_key */
3724
3652
 
3725
3653
 
3733
3661
  SORT_INFO *sort_info=sort_param->sort_info;
3734
3662
  MI_CHECK *param=sort_info->param;
3735
3663
  MI_INFO *info=sort_info->info;
3736
 
  DBUG_ENTER("sort_delete_record");
3737
3664
 
3738
3665
  if ((param->testflag & (T_FORCE_UNIQUENESS|T_QUICK)) == T_QUICK)
3739
3666
  {
3740
3667
    mi_check_print_error(param,
3741
3668
                         "Quick-recover aborted; Run recovery without switch -q or with switch -qq");
3742
 
    DBUG_RETURN(1);
 
3669
    return(1);
3743
3670
  }
3744
3671
  if (info->s->options & HA_OPTION_COMPRESS_RECORD)
3745
3672
  {
3746
3673
    mi_check_print_error(param,
3747
3674
                         "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);;
3748
 
    DBUG_RETURN(1);
 
3675
    return(1);
3749
3676
  }
3750
3677
 
3751
3678
  old_file=info->dfile;
3758
3685
    {
3759
3686
      mi_check_print_error(param,"Can't read record to be removed");
3760
3687
      info->dfile=old_file;
3761
 
      DBUG_RETURN(1);
 
3688
      return(1);
3762
3689
    }
3763
3690
 
3764
3691
    for (i=0 ; i < sort_info->current_key ; i++)
3768
3695
      {
3769
3696
        mi_check_print_error(param,"Can't delete key %d from record to be removed",i+1);
3770
3697
        info->dfile=old_file;
3771
 
        DBUG_RETURN(1);
 
3698
        return(1);
3772
3699
      }
3773
3700
    }
3774
3701
    if (sort_param->calc_checksum)
3777
3704
  error=flush_io_cache(&info->rec_cache) || (*info->s->delete_record)(info);
3778
3705
  info->dfile=old_file;                         /* restore actual value */
3779
3706
  info->state->records--;
3780
 
  DBUG_RETURN(error);
 
3707
  return(error);
3781
3708
} /* sort_delete_record */
3782
3709
 
3783
3710
        /* Fix all pending blocks and flush everything to disk */
3791
3718
  myf myf_rw=sort_info->param->myf_rw;
3792
3719
  MI_INFO *info=sort_info->info;
3793
3720
  MI_KEYDEF *keyinfo=sort_param->keyinfo;
3794
 
  DBUG_ENTER("flush_pending_blocks");
3795
3721
 
3796
3722
  filepos= HA_OFFSET_ERROR;                     /* if empty file */
3797
3723
  nod_flag=0;
3804
3730
    key_file_length=info->state->key_file_length;
3805
3731
    bzero((uchar*) key_block->buff+length, keyinfo->block_length-length);
3806
3732
    if ((filepos=_mi_new(info,keyinfo,DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
3807
 
      DBUG_RETURN(1);
 
3733
      return(1);
3808
3734
 
3809
3735
    /* If we read the page from the key cache, we have to write it back */
3810
3736
    if (key_file_length == info->state->key_file_length)
3811
3737
    {
3812
3738
      if (_mi_write_keypage(info, keyinfo, filepos,
3813
3739
                            DFLT_INIT_HITS, key_block->buff))
3814
 
        DBUG_RETURN(1);
 
3740
        return(1);
3815
3741
    }
3816
3742
    else if (my_pwrite(info->s->kfile,(uchar*) key_block->buff,
3817
3743
                       (uint) keyinfo->block_length,filepos, myf_rw))
3818
 
      DBUG_RETURN(1);
3819
 
    DBUG_DUMP("buff",(uchar*) key_block->buff,length);
 
3744
      return(1);
3820
3745
    nod_flag=1;
3821
3746
  }
3822
3747
  info->s->state.key_root[sort_param->key]=filepos; /* Last is root for tree */
3823
 
  DBUG_RETURN(0);
 
3748
  return(0);
3824
3749
} /* flush_pending_blocks */
3825
3750
 
3826
3751
        /* alloc space and pointers for key_blocks */
3830
3755
{
3831
3756
  register uint i;
3832
3757
  SORT_KEY_BLOCKS *block;
3833
 
  DBUG_ENTER("alloc_key_blocks");
3834
3758
 
3835
3759
  if (!(block=(SORT_KEY_BLOCKS*) my_malloc((sizeof(SORT_KEY_BLOCKS)+
3836
3760
                                            buffer_length+IO_SIZE)*blocks,
3844
3768
    block[i].inited=0;
3845
3769
    block[i].buff=(uchar*) (block+blocks)+(buffer_length+IO_SIZE)*i;
3846
3770
  }
3847
 
  DBUG_RETURN(block);
 
3771
  return(block);
3848
3772
} /* alloc_key_blocks */
3849
3773
 
3850
3774
 
3876
3800
  ha_rows max_records;
3877
3801
  uint64_t file_length,tmp_length;
3878
3802
  MI_CREATE_INFO create_info;
3879
 
  DBUG_ENTER("recreate_table");
3880
3803
 
3881
3804
  error=1;                                      /* Default error */
3882
3805
  info= **org_info;
3886
3809
  unpack= (share.options & HA_OPTION_COMPRESS_RECORD) &&
3887
3810
    (param->testflag & T_UNPACK);
3888
3811
  if (!(keyinfo=(MI_KEYDEF*) my_alloca(sizeof(MI_KEYDEF)*share.base.keys)))
3889
 
    DBUG_RETURN(0);
 
3812
    return(0);
3890
3813
  memcpy((uchar*) keyinfo,(uchar*) share.keyinfo,
3891
3814
         (size_t) (sizeof(MI_KEYDEF)*share.base.keys));
3892
3815
 
3895
3818
                                       (key_parts+share.base.keys))))
3896
3819
  {
3897
3820
    my_afree((uchar*) keyinfo);
3898
 
    DBUG_RETURN(1);
 
3821
    return(1);
3899
3822
  }
3900
3823
  if (!(recdef=(MI_COLUMNDEF*)
3901
3824
        my_alloca(sizeof(MI_COLUMNDEF)*(share.base.fields+1))))
3902
3825
  {
3903
3826
    my_afree((uchar*) keyinfo);
3904
3827
    my_afree((uchar*) keysegs);
3905
 
    DBUG_RETURN(1);
 
3828
    return(1);
3906
3829
  }
3907
3830
  if (!(uniquedef=(MI_UNIQUEDEF*)
3908
3831
        my_alloca(sizeof(MI_UNIQUEDEF)*(share.state.header.uniques+1))))
3910
3833
    my_afree((uchar*) recdef);
3911
3834
    my_afree((uchar*) keyinfo);
3912
3835
    my_afree((uchar*) keysegs);
3913
 
    DBUG_RETURN(1);
 
3836
    return(1);
3914
3837
  }
3915
3838
 
3916
3839
  /* Copy the column definitions */
4029
3952
  my_afree((uchar*) keyinfo);
4030
3953
  my_afree((uchar*) recdef);
4031
3954
  my_afree((uchar*) keysegs);
4032
 
  DBUG_RETURN(error);
 
3955
  return(error);
4033
3956
}
4034
3957
 
4035
3958
 
4132
4055
                               my_bool repair_only)
4133
4056
{
4134
4057
  uchar *record= 0;
4135
 
  DBUG_ENTER("update_auto_increment_key");
4136
4058
 
4137
4059
  if (!info->s->base.auto_key ||
4138
4060
      ! mi_is_key_active(info->s->state.key_map, info->s->base.auto_key - 1))
4141
4063
      mi_check_print_info(param,
4142
4064
                          "Table: %s doesn't have an auto increment key\n",
4143
4065
                          param->isam_file_name);
4144
 
    DBUG_VOID_RETURN;
 
4066
    return;
4145
4067
  }
4146
4068
  if (!(param->testflag & T_SILENT) &&
4147
4069
      !(param->testflag & T_REP))
4153
4075
  if (!mi_alloc_rec_buff(info, -1, &record))
4154
4076
  {
4155
4077
    mi_check_print_error(param,"Not enough memory for extra record");
4156
 
    DBUG_VOID_RETURN;
 
4078
    return;
4157
4079
  }
4158
4080
 
4159
4081
  mi_extra(info,HA_EXTRA_KEYREAD,0);
4164
4086
      mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
4165
4087
      my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
4166
4088
      mi_check_print_error(param,"%d when reading last record",my_errno);
4167
 
      DBUG_VOID_RETURN;
 
4089
      return;
4168
4090
    }
4169
4091
    if (!repair_only)
4170
4092
      info->s->state.auto_increment=param->auto_increment_value;
4179
4101
  mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
4180
4102
  my_free(mi_get_rec_buff_ptr(info, record), MYF(0));
4181
4103
  update_state_info(param, info, UPDATE_AUTO_INC);
4182
 
  DBUG_VOID_RETURN;
 
4104
  return;
4183
4105
}
4184
4106
 
4185
4107
 
4310
4232
  MI_KEYDEF    *key=share->keyinfo;
4311
4233
  uint          i;
4312
4234
 
4313
 
  DBUG_ASSERT(info->state->records == 0 &&
 
4235
  assert(info->state->records == 0 &&
4314
4236
              (!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES));
4315
4237
  for (i=0 ; i < share->base.keys ; i++,key++)
4316
4238
  {