diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2016-06-29 16:33:08 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2016-09-16 15:46:15 +0400 |
commit | 7e9ac7b8ac6752b741099a8dbff8a55736f0f32c (patch) | |
tree | e938bb1fc2d505ac1446d48826df5f7df23ae950 /sql/table_cache.h | |
parent | 6c1c27ea11559e6244694db0d61fa9a52d43ab42 (diff) | |
download | mariadb-git-7e9ac7b8ac6752b741099a8dbff8a55736f0f32c.tar.gz |
MDEV-10296 - Multi-instance table cache
Improve scalability by implementing multi-instance table cache.
Diffstat (limited to 'sql/table_cache.h')
-rw-r--r-- | sql/table_cache.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sql/table_cache.h b/sql/table_cache.h index c05baae1f15..24b04acf9bc 100644 --- a/sql/table_cache.h +++ b/sql/table_cache.h @@ -18,6 +18,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +struct Share_free_tables +{ + typedef I_P_List <TABLE, TABLE_share> List; + List list; + /** Avoid false sharing between instances */ + char pad[CPU_LEVEL1_DCACHE_LINESIZE]; +}; + + struct TDC_element { uchar m_key[NAME_LEN + 1 + NAME_LEN + 1]; @@ -26,10 +35,8 @@ struct TDC_element bool flushed; TABLE_SHARE *share; - typedef I_P_List <TABLE, TABLE_share> TABLE_list; /** - Protects ref_count, m_flush_tickets, all_tables, free_tables, flushed, - all_tables_refs. + Protects ref_count, m_flush_tickets, all_tables, flushed, all_tables_refs. */ mysql_mutex_t LOCK_table_share; mysql_cond_t COND_release; @@ -45,7 +52,9 @@ struct TDC_element for this share. */ All_share_tables_list all_tables; - TABLE_list free_tables; + /** Avoid false sharing between TDC_element and free_tables */ + char pad[CPU_LEVEL1_DCACHE_LINESIZE]; + Share_free_tables free_tables[1]; }; @@ -59,8 +68,9 @@ enum enum_tdc_remove_table_type extern ulong tdc_size; extern ulong tc_size; +extern ulong tc_instances; -extern void tdc_init(void); +extern bool tdc_init(void); extern void tdc_start_shutdown(void); extern void tdc_deinit(void); extern ulong tdc_records(void); @@ -86,7 +96,7 @@ extern int tdc_iterate(THD *thd, my_hash_walk_action action, void *argument, extern uint tc_records(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); +extern void tc_release_table(TABLE *table); /** Create a table cache key for non-temporary table. |