summaryrefslogtreecommitdiff
path: root/myisam/mi_locking.c
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2003-08-02 02:43:18 -0700
committerunknown <igor@rurik.mysql.com>2003-08-02 02:43:18 -0700
commitb6d27e20e19e1998b745a438dbde635261ebc5d4 (patch)
treeadd5cbee3049a38799b03ee640b5ae06fbc34ef1 /myisam/mi_locking.c
parent4f6f7f7ded18764b8aa382c3a84261657fea66f8 (diff)
downloadmariadb-git-b6d27e20e19e1998b745a438dbde635261ebc5d4.tar.gz
Many files:
Added key cache assignment mi_locking.c: Added key cache assignment: correction my_sys.h: Added key cache variable structure include/my_sys.h: Added key cache variable structure include/my_base.h: Added key cache assignment include/myisam.h: Added key cache assignment include/my_global.h: Added key cache assignment isam/_page.c: Added key cache assignment isam/close.c: Added key cache assignment isam/isamchk.c: Added key cache assignment isam/isamlog.c: Added key cache assignment isam/panic.c: Added key cache assignment isam/_locking.c: Added key cache assignment isam/test2.c: Added key cache assignment isam/test3.c: Added key cache assignment myisam/myisamdef.h: Added key cache assignment myisam/mi_check.c: Added key cache assignment myisam/mi_close.c: Added key cache assignment myisam/mi_extra.c: Added key cache assignment myisam/mi_page.c: Added key cache assignment myisam/mi_panic.c: Added key cache assignment myisam/mi_preload.c: Added key cache assignment myisam/mi_test1.c: Added key cache assignment myisam/mi_test2.c: Added key cache assignment myisam/mi_test3.c: Added key cache assignment myisam/myisamchk.c: Added key cache assignment myisam/myisamlog.c: Added key cache assignment myisam/mi_delete_all.c: Added key cache assignment myisam/mi_locking.c: Added key cache assignment: correction myisam/mi_keycache.c: Added key cache assignment sql/handler.h: Added key cache assignment sql/mysql_priv.h: Added key cache assignment sql/set_var.h: Added key cache assignment sql/table.h: Added key cache assignment sql/ha_myisam.cc: Added key cache assignment sql/ha_myisammrg.cc: Added key cache assignment sql/handler.cc: Added key cache assignment sql/mysqld.cc: Added key cache assignment sql/set_var.cc: Added key cache assignment sql/sql_base.cc: Added key cache assignment sql/sql_table.cc: Added key cache assignment sql/sql_test.cc: Added key cache assignment sql/sql_yacc.yy: Added key cache assignment mysys/mf_keycache.c: Added key cache assignment mysql-test/t/key_cache.test: Added key cache assignment mysql-test/r/key_cache.result: Added key cache assignment
Diffstat (limited to 'myisam/mi_locking.c')
-rw-r--r--myisam/mi_locking.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 7ede4852ccd..fa415269d61 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -34,6 +34,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
uint count;
MYISAM_SHARE *share=info->s;
uint flag;
+ uint switch_fl= 0;
DBUG_ENTER("mi_lock_database");
if (share->options & HA_OPTION_READ_ONLY_DATA ||
@@ -50,13 +51,26 @@ int mi_lock_database(MI_INFO *info, int lock_type)
else
count= --share->w_locks;
--share->tot_locks;
+ /*
+ During a key cache reassignment the current and registered
+ key caches for the table are different.
+ Although at present key cache ressignment is always
+ performed with a shared cache for the table acquired,
+ for future possible optimizations we still
+ handle this situation as if we could come to this point
+ during the ressignment (in non-reassignment thread).
+ */
if (info->lock_type == F_WRLCK && !share->w_locks &&
- !share->delay_key_write &&
- flush_key_blocks(dflt_keycache,share->kfile,FLUSH_KEEP))
+ ((switch_fl= share->keycache != share->reg_keycache) ||
+ !share->delay_key_write) &&
+ flush_key_blocks(*share->keycache, share->kfile,
+ switch_fl ? FLUSH_RELEASE : FLUSH_KEEP))
{
error=my_errno;
mi_mark_crashed(info); /* Mark that table must be checked */
}
+ if (switch_fl)
+ share->keycache= share->reg_keycache;
if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))
{
if (end_io_cache(&info->rec_cache))
@@ -386,7 +400,7 @@ int _mi_test_if_changed(register MI_INFO *info)
{ /* Keyfile has changed */
DBUG_PRINT("info",("index file changed"));
if (share->state.process != share->this_process)
- VOID(flush_key_blocks(dflt_keycache,share->kfile,FLUSH_RELEASE));
+ VOID(flush_key_blocks(*share->keycache,share->kfile,FLUSH_RELEASE));
share->last_process=share->state.process;
info->last_unique= share->state.unique;
info->last_loop= share->state.update_count;