summaryrefslogtreecommitdiff
path: root/myisam/mi_locking.c
diff options
context:
space:
mode:
authorunknown <igor@rurik.mysql.com>2003-10-01 20:16:36 -0700
committerunknown <igor@rurik.mysql.com>2003-10-01 20:16:36 -0700
commit7c7ee4d2f4ae29df2167b0ca0e9ab6dfd93a1c07 (patch)
treee1116ef7faa18e25e4ea484099e4c14d6fbbf7f1 /myisam/mi_locking.c
parentcce14aabfc09628b246b3bc6ba40e6d83308da4f (diff)
parent7de7c38f2f1b678e6d1894b94dd9abe9de9d8c70 (diff)
downloadmariadb-git-7c7ee4d2f4ae29df2167b0ca0e9ab6dfd93a1c07.tar.gz
Manual merge after improving concurrency for key cache reassignment
include/myisam.h: Auto merged isam/isamchk.c: Auto merged myisam/mi_check.c: Auto merged myisam/mi_locking.c: Auto merged myisam/mi_search.c: Auto merged myisam/mi_write.c: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamlog.c: Auto merged mysql-test/r/func_group.result: Auto merged mysys/mf_keycache.c: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisam.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/mysqld.cc: Auto merged sql/set_var.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_test.cc: Auto merged sql/sql_yacc.yy: Auto merged
Diffstat (limited to 'myisam/mi_locking.c')
-rw-r--r--myisam/mi_locking.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index a707eb294a9..785979235ce 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");
DBUG_PRINT("info",("lock_type: %d", lock_type));
@@ -60,12 +61,21 @@ 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.
+ */
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_REMOVE : 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))
@@ -400,7 +410,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;