~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/archive/ha_archive.cc

  • Committer: Brian Aker
  • Date: 2009-11-26 03:10:24 UTC
  • mfrom: (1222.1.14 staging)
  • mto: This revision was merged to the branch mainline in revision 1227.
  • Revision ID: brian@gaz-20091126031024-2t9yhghfq2m6tv4u
Small cleanups.

Show diffs side-by-side

added added

removed removed

Lines of Context:
548
548
  Init out lock.
549
549
  We open the file we will read from.
550
550
*/
551
 
int ha_archive::open(const char *name, int, uint32_t open_options)
 
551
int ha_archive::open(const char *name, int, uint32_t)
552
552
{
553
553
  int rc= 0;
554
554
  share= get_share(name, &rc);
555
555
 
556
 
  if (rc == HA_ERR_CRASHED_ON_USAGE && !(open_options & HA_OPEN_FOR_REPAIR))
 
556
  /** 
 
557
    We either fix it ourselves, or we just take it offline 
 
558
 
 
559
    @todo Create some documentation in the recovery tools shipped with the engine.
 
560
  */
 
561
  if (rc == HA_ERR_CRASHED_ON_USAGE)
557
562
  {
558
563
    free_share();
559
 
    return(rc);
 
564
    rc= repair();
 
565
 
 
566
    return 0;
560
567
  }
561
568
  else if (rc == HA_ERR_OUT_OF_MEM)
562
569
  {
576
583
 
577
584
  thr_lock_data_init(&share->lock, &lock, NULL);
578
585
 
579
 
  if (rc == HA_ERR_CRASHED_ON_USAGE && open_options & HA_OPEN_FOR_REPAIR)
580
 
  {
581
 
    return(0);
582
 
  }
583
 
  else
584
 
    return(rc);
 
586
  return(rc);
585
587
}
586
588
 
587
589
 
1083
1085
  rewriting the meta file. Currently it does this by calling optimize with
1084
1086
  the extended flag.
1085
1087
*/
1086
 
int ha_archive::repair(Session* session)
 
1088
int ha_archive::repair()
1087
1089
{
1088
 
  int rc= optimize(session);
 
1090
  int rc= optimize();
1089
1091
 
1090
1092
  if (rc)
1091
1093
    return(HA_ERR_CRASHED_ON_REPAIR);
1098
1100
  The table can become fragmented if data was inserted, read, and then
1099
1101
  inserted again. What we do is open up the file and recompress it completely.
1100
1102
*/
1101
 
int ha_archive::optimize(Session *)
 
1103
int ha_archive::optimize()
1102
1104
{
1103
1105
  int rc= 0;
1104
1106
  azio_stream writer;