Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions mysql-test/main/mysqld--help.result
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,10 @@ The following specify which files/extra groups are read (specified before remain
The number of cached open tables
--table-open-cache-instances=#
Maximum number of table cache instances
--table-open-cache-instances-fix
Activate all table_open_cache_instances early. Can be
useful for cases when table cache warm up period is
undesired. Such as benchmarking
--tc-heuristic-recover=name
Decision to use in heuristic recover process. One of: OFF,
COMMIT, ROLLBACK
Expand Down Expand Up @@ -2055,6 +2059,7 @@ sysdate-is-now FALSE
system-versioning-alter-history ERROR
system-versioning-insert-history FALSE
table-definition-cache 400
table-open-cache-instances-fix FALSE
tc-heuristic-recover OFF
tcp-keepalive-interval 0
tcp-keepalive-probes 0
Expand Down
10 changes: 10 additions & 0 deletions mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
Original file line number Diff line number Diff line change
Expand Up @@ -3942,6 +3942,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE_INSTANCES_FIX
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Activate all table_open_cache_instances early. Can be useful for cases when table cache warm up period is undesired. Such as benchmarking
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME TCP_KEEPALIVE_INTERVAL
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT
Expand Down
10 changes: 10 additions & 0 deletions mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
Original file line number Diff line number Diff line change
Expand Up @@ -4722,6 +4722,16 @@ NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TABLE_OPEN_CACHE_INSTANCES_FIX
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Activate all table_open_cache_instances early. Can be useful for cases when table cache warm up period is undesired. Such as benchmarking
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME TCP_KEEPALIVE_INTERVAL
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SHOW VARIABLES LIKE 'table_open_cache_instances_fix';
Variable_name Value
table_open_cache_instances_fix ON
SHOW VARIABLES LIKE 'table_open_cache_instances';
Variable_name Value
table_open_cache_instances 4
SHOW STATUS LIKE 'table_open_cache_active_instances';
Variable_name Value
Table_open_cache_active_instances 4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--table-open-cache-instances-fix --table-open-cache=100 --table-open-cache-instances=4
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SHOW VARIABLES LIKE 'table_open_cache_instances_fix';
SHOW VARIABLES LIKE 'table_open_cache_instances';
SHOW STATUS LIKE 'table_open_cache_active_instances';
8 changes: 8 additions & 0 deletions sql/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4299,6 +4299,14 @@ static Sys_var_ulong Sys_table_cache_size(
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
ON_UPDATE(fix_table_open_cache));

static Sys_var_mybool Sys_table_cache_instances_fix(
"table_open_cache_instances_fix",
"Activate all table_open_cache_instances early. Can be useful for "
"cases when table cache warm up period is undesired. Such as "
"benchmarking",
READ_ONLY GLOBAL_VAR(tc_instances_fix), CMD_LINE(OPT_ARG),
DEFAULT(FALSE));

static Sys_var_uint Sys_table_cache_instances(
"table_open_cache_instances", "Maximum number of table cache instances",
READ_ONLY GLOBAL_VAR(tc_instances), CMD_LINE(REQUIRED_ARG),
Expand Down
3 changes: 3 additions & 0 deletions sql/table_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ I_P_List <TDC_element,
I_P_List_fast_push_back<TDC_element> > unused_shares;

static bool tdc_inited;
my_bool tc_instances_fix;


/**
Expand Down Expand Up @@ -612,6 +613,8 @@ bool tdc_init(void)
DBUG_RETURN(true);
tc_allocated_size= (tc_instances + 1) * sizeof *tc;
update_malloc_size(tc_allocated_size, 0);
if (tc_instances_fix)
tc_active_instances.store(tc_instances, std::memory_order_relaxed);
tdc_inited= true;
mysql_mutex_init(key_LOCK_unused_shares, &LOCK_unused_shares,
MY_MUTEX_INIT_FAST);
Expand Down
1 change: 1 addition & 0 deletions sql/table_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct TDC_element
extern ulong tdc_size;
extern ulong tc_size;
extern uint32 tc_instances;
extern my_bool tc_instances_fix;

extern bool tdc_init(void);
extern void tdc_start_shutdown(void);
Expand Down