1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-10296 - Multi-instance table cache

Improve scalability by implementing multi-instance table cache.
This commit is contained in:
Sergey Vojtovich
2016-06-29 16:33:08 +04:00
parent 6c1c27ea11
commit 7e9ac7b8ac
9 changed files with 189 additions and 188 deletions

View File

@ -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.