28
28
MYISAM_SHARE *share=info->s;
29
DBUG_ENTER("mi_close");
30
DBUG_PRINT("enter",("base: 0x%lx reopen: %u locks: %u",
31
(long) info, (uint) share->reopen,
32
(uint) share->tot_locks));
30
34
pthread_mutex_lock(&THR_LOCK_myisam);
31
35
if (info->lock_type == F_EXTRA_LCK)
56
60
myisam_open_list=list_delete(myisam_open_list,&info->open_list);
57
61
pthread_mutex_unlock(&share->intern_lock);
59
void * rec_buff_ptr= mi_get_rec_buff_ptr(info, info->rec_buff);
60
if (rec_buff_ptr != NULL)
63
my_free(mi_get_rec_buff_ptr(info, info->rec_buff), MYF(MY_ALLOW_ZERO_PTR));
64
66
if (share->kfile >= 0 &&
79
81
if (my_close(share->kfile,MYF(0)))
82
88
if (share->decode_trees)
84
free((unsigned char*) share->decode_trees);
85
free((unsigned char*) share->decode_tables);
90
my_free((uchar*) share->decode_trees,MYF(0));
91
my_free((uchar*) share->decode_tables,MYF(0));
87
93
thr_lock_delete(&share->lock);
88
pthread_mutex_destroy(&share->intern_lock);
94
VOID(pthread_mutex_destroy(&share->intern_lock));
91
97
keys = share->state.header.keys;
92
rwlock_destroy(&share->mmap_lock);
98
VOID(rwlock_destroy(&share->mmap_lock));
93
99
for(i=0; i<keys; i++) {
94
rwlock_destroy(&share->key_root_lock[i]);
100
VOID(rwlock_destroy(&share->key_root_lock[i]));
97
free((unsigned char*) info->s);
103
my_free((uchar*) info->s,MYF(0));
99
105
pthread_mutex_unlock(&THR_LOCK_myisam);
101
107
if (info->dfile >= 0 && my_close(info->dfile,MYF(0)))
102
108
error = my_errno;
104
free((unsigned char*) info);
110
myisam_log_command(MI_LOG_CLOSE,info,NULL,0,error);
111
my_free((uchar*) info,MYF(0));
108
return(my_errno=error);
115
DBUG_RETURN(my_errno=error);