16 #include "myisam_priv.h"
29 int mi_panic(
enum ha_panic_function flag)
34 THR_LOCK_myisam.lock();
35 list<MI_INFO *>::iterator it= myisam_open_list.begin();
36 while (it != myisam_open_list.end())
41 THR_LOCK_myisam.unlock();
44 THR_LOCK_myisam.lock();
47 #ifdef CANT_OPEN_FILES_TWICE
48 if (info->s->options & HA_OPTION_READ_ONLY_DATA)
51 if (info->opt_flag & WRITE_CACHE_USED)
52 if (info->rec_cache.flush())
54 if (info->opt_flag & READ_CACHE_USED)
56 if (info->rec_cache.flush())
58 info->rec_cache.
reinit_io_cache(internal::READ_CACHE,0, (
bool) (info->lock_type != F_UNLCK),1);
60 if (info->lock_type != F_UNLCK && ! info->was_locked)
62 info->was_locked=info->lock_type;
63 if (mi_lock_database(info,F_UNLCK))
66 #ifdef CANT_OPEN_FILES_TWICE
67 if (info->s->kfile >= 0 && internal::my_close(info->s->kfile,MYF(0)))
69 if (info->dfile >= 0 && internal::my_close(info->dfile,MYF(0)))
71 info->s->kfile=info->dfile= -1;
75 #ifdef CANT_OPEN_FILES_TWICE
77 char name_buff[FN_REFLEN];
78 if (info->s->kfile < 0)
79 if ((info->s->kfile= internal::my_open(internal::fn_format(name_buff,info->filename,
"",
80 N_NAME_IEXT,4),info->mode,
85 if ((info->dfile= internal::my_open(internal::fn_format(name_buff,info->filename,
"",
86 N_NAME_DEXT,4),info->mode,
89 info->rec_cache.file=info->dfile;
95 if (mi_lock_database(info, info->was_locked))
103 THR_LOCK_myisam.unlock();
TODO: Rename this file - func.h is stupid.
bool reinit_io_cache(cache_type type_arg, my_off_t seek_offset, bool use_async_io, bool clear_cache)
Reset the cache.