~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_close.cc

  • Committer: Brian Aker
  • Date: 2010-09-10 16:41:50 UTC
  • mto: (1759.2.1 build)
  • mto: This revision was merged to the branch mainline in revision 1762.
  • Revision ID: brian@tangent.org-20100910164150-grktr2kjfgvk4iw2
This add a couple of utility table functions to be used with testing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
  int error=0,flag;
31
31
  MYISAM_SHARE *share=info->s;
32
32
 
33
 
  pthread_mutex_lock(&THR_LOCK_myisam);
 
33
  THR_LOCK_myisam.lock();
34
34
  if (info->lock_type == F_EXTRA_LCK)
35
35
    info->lock_type=F_UNLCK;                    /* HA_EXTRA_NO_USER_CHANGE */
36
36
 
42
42
    if (mi_lock_database(info,F_UNLCK))
43
43
      error=errno;
44
44
  }
45
 
  pthread_mutex_lock(&share->intern_lock);
46
45
 
47
46
  if (share->options & HA_OPTION_READ_ONLY_DATA)
48
47
  {
57
56
  }
58
57
  flag= !--share->reopen;
59
58
  myisam_open_list.remove(info);
60
 
  pthread_mutex_unlock(&share->intern_lock);
61
59
 
62
60
  void * rec_buff_ptr= mi_get_rec_buff_ptr(info, info->rec_buff);
63
61
  if (rec_buff_ptr != NULL)
65
63
  if (flag)
66
64
  {
67
65
    if (share->kfile >= 0 &&
68
 
        flush_key_blocks(share->key_cache, share->kfile,
 
66
        flush_key_blocks(share->getKeyCache(), share->kfile,
69
67
                         share->temporary ? FLUSH_IGNORE_CHANGED :
70
68
                         FLUSH_RELEASE))
71
69
      error=errno;
 
70
    end_key_cache(share->getKeyCache(), true);
72
71
    if (share->kfile >= 0)
73
72
    {
74
73
      /*
87
86
      free((unsigned char*) share->decode_trees);
88
87
      free((unsigned char*) share->decode_tables);
89
88
    }
90
 
    thr_lock_delete(&share->lock);
91
 
    pthread_mutex_destroy(&share->intern_lock);
92
 
    {
93
 
      int i,keys;
94
 
      keys = share->state.header.keys;
95
 
      pthread_rwlock_destroy(&share->mmap_lock);
96
 
      for(i=0; i<keys; i++) {
97
 
        pthread_rwlock_destroy(&share->key_root_lock[i]);
98
 
      }
99
 
    }
 
89
    share->lock.deinit();
100
90
    delete info->s->in_use;
101
91
    free((unsigned char*) info->s);
102
92
  }
103
 
  pthread_mutex_unlock(&THR_LOCK_myisam);
 
93
  THR_LOCK_myisam.unlock();
104
94
 
105
95
  if (info->dfile >= 0 && internal::my_close(info->dfile,MYF(0)))
106
96
    error = errno;