summaryrefslogtreecommitdiff
path: root/sql/table_cache.h
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2014-02-13 10:44:10 +0400
committerSergey Vojtovich <svoj@mariadb.org>2014-02-13 10:44:10 +0400
commit048e9c40a661476d1b742f61d692f211acbd24d2 (patch)
tree8f54dde52aa39fd3a5ac523764820747508b0975 /sql/table_cache.h
parenta25d87e50f2636263d03246ba8a7ca827f43c48b (diff)
downloadmariadb-git-048e9c40a661476d1b742f61d692f211acbd24d2.tar.gz
MDEV-5492 - Reduce usage of LOCK_open: TABLE::in_use
Move TABLE::in_use out of LOCK_open. This is done with assumtion that foreign threads accessing TABLE::in_use will only need consistent value _after_ marking table for flush and purging unused table instances. In this case TABLE::in_use will always point to a valid thread object. Previously FLUSH TABLES thread may wait for tables flushed subsequently by concurrent threads which breaks the above assumption, e.g.: open tables: t1 (version= 1) thr1 (FLUSH TABLES): refresh_version++ thr1 (FLUSH TABLES): purge table cache open tables: none thr2 (SELECT * FROM t1): open tables: t1 open tables: t1 (version= 2) thr2 (FLUSH TABLES): refresh_version++ thr2 (FLUSH TABLES): purge table cache thr1 (FLUSH TABLES): wait for old tables (including t1 with version 2) It is fixed so that FLUSH TABLES waits only for tables that were open heretofore.
Diffstat (limited to 'sql/table_cache.h')
-rw-r--r--sql/table_cache.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/table_cache.h b/sql/table_cache.h
index 7b7fb239131..a30a07b8357 100644
--- a/sql/table_cache.h
+++ b/sql/table_cache.h
@@ -47,13 +47,14 @@ extern bool tdc_remove_table(THD *thd, enum_tdc_remove_table_type remove_type,
bool kill_delayed_threads);
extern int tdc_wait_for_old_version(THD *thd, const char *db,
const char *table_name,
- ulong wait_timeout, uint deadlock_weight);
+ ulong wait_timeout, uint deadlock_weight,
+ ulong refresh_version= ULONG_MAX);
extern ulong tdc_refresh_version(void);
-extern void tdc_increment_refresh_version(void);
+extern ulong tdc_increment_refresh_version(void);
extern void tdc_assign_new_table_id(TABLE_SHARE *share);
extern uint tc_records(void);
-extern void tc_purge(void);
+extern void tc_purge(bool mark_flushed= false);
extern void tc_add_table(THD *thd, TABLE *table);
extern bool tc_release_table(TABLE *table);