summaryrefslogtreecommitdiff
path: root/myisam/mi_locking.c
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2003-08-26 00:13:22 -0700
committerunknown <igor@rurik.mysql.com>2003-08-26 00:13:22 -0700
commitf6758b47fb75fb7f39e4883d53523bfda589adfd (patch)
tree8f6c56f59666be1b54701f57e779e904575b1a4a /myisam/mi_locking.c
parent3b799e8fd8eb13c7ad6e2bb01a922e37d9101ea7 (diff)
parentb9a90dffb6c429ab405d036734b3b04b98df69d6 (diff)
downloadmariadb-git-f6758b47fb75fb7f39e4883d53523bfda589adfd.tar.gz
Manual merge
include/my_base.h: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged myisam/mi_check.c: Auto merged myisam/mi_extra.c: Auto merged myisam/mi_locking.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamdef.h: Auto merged mysql-test/r/key_cache.result: Auto merged mysql-test/t/key_cache.test: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/mysql_priv.h: Auto merged sql/opt_range.cc: Auto merged sql/set_var.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/table.h: Auto merged
Diffstat (limited to 'myisam/mi_locking.c')
-rw-r--r--myisam/mi_locking.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 22772a3dd2e..14d0b60741f 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 ||
@@ -58,12 +59,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(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))
@@ -393,7 +408,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(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;