summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_extra.c
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-10-09 18:55:18 +0300
committerMonty <monty@mariadb.org>2018-12-09 22:12:25 +0200
commit163b34fe25919b25ff83860f30f2440b44c8b53b (patch)
tree7d21575247bdba318889ad4bc650028e59549781 /storage/myisam/mi_extra.c
parent306b7a2243eb3c3e8dcc567ef6d4e7e50dca21a4 (diff)
downloadmariadb-git-163b34fe25919b25ff83860f30f2440b44c8b53b.tar.gz
Optimize flush tables with read lock (FTWRL) to not wait for select's
Part of MDEV-5336 Implement LOCK FOR BACKUP The idea is that instead of waiting in close_cached_tables() for all tables to be closed, we instead call flush_tables() that does: - Flush not used objects in table cache to free memory - Collect all tables that are open - Call HA_EXTRA_FLUSH on the objects, to get them into "closed state" - Added HA_EXTRA_FLUSH support to archive and CSV - Added multi-user protection to HA_EXTRA_FLUSH in MyISAM and Aria The benefit compared to old code is: - FTWRL doesn't have to wait for long running read operations or open HANDLER's
Diffstat (limited to 'storage/myisam/mi_extra.c')
-rw-r--r--storage/myisam/mi_extra.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c
index c10bf61a477..194ad5bf07a 100644
--- a/storage/myisam/mi_extra.c
+++ b/storage/myisam/mi_extra.c
@@ -332,7 +332,11 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
if (!share->temporary)
flush_key_blocks(share->key_cache, share->kfile, &share->dirty_part_map,
FLUSH_KEEP);
+ mysql_mutex_lock(&share->intern_lock);
+ /* Tell mi_lock_database() that we locked the intern_lock mutex */
+ info->intern_lock_locked= 1;
_mi_decrement_open_count(info);
+ info->intern_lock_locked= 0;
if (share->not_flushed)
{
share->not_flushed=0;
@@ -349,6 +353,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
}
if (share->base.blobs)
mi_alloc_rec_buff(info, -1, &info->rec_buff);
+ mysql_mutex_unlock(&share->intern_lock);
break;
case HA_EXTRA_NORMAL: /* Theese isn't in use */
info->quick_mode=0;