-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mysql-5.6][PR] FB8-180: Implemented TTL base cache eviction policy f…
…or "open table" and "table description" caches Summary: Jira issue: https://jira.percona.com/browse/FB8-180 Reference Patch: ec9e122 MySQL has variable "flush_time". If it is set to a nonzero value, all tables are closed every "flush_time" seconds to free up resources and synchronize unflushed data to disk. This option is best used only on systems with minimal resources. I added variable "flush_only_old_cache_entries" which were open more than "flush_time" seconds. Originally Reviewed By: anirbanr-fb GitHub Author: Volodymyr Verovkin <[email protected]> Test Plan: Imported from GitHub, without a `Test Plan:` line. Reviewers: Subscribers: Differential Revision: https://phabricator.intern.facebook.com/D14884057 Tasks: Tags: Blame Revision:
- Loading branch information
1 parent
7cac65b
commit 1bd4eb8
Showing
17 changed files
with
273 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SET @start_global_value = @@global.flush_only_old_table_cache_entries; | ||
SET @@global.debug= '+d,tdc_flush_unused_tables'; | ||
SET debug_sync = 'now WAIT_FOR signal.disabled'; | ||
SET @@global.flush_only_old_table_cache_entries = true; | ||
SET debug_sync = 'now WAIT_FOR signal.enabled'; | ||
SET @@global.debug= '-d,tdc_flush_unused_tables'; | ||
SET @@global.flush_only_old_table_cache_entries = @start_global_value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
mysql-test/suite/sys_vars/r/flush_only_old_table_cache_entries_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
set @start_global_value = @@global.flush_only_old_table_cache_entries; | ||
select @@global.flush_only_old_table_cache_entries; | ||
@@global.flush_only_old_table_cache_entries | ||
0 | ||
select @@session.flush_only_old_table_cache_entries; | ||
ERROR HY000: Variable 'flush_only_old_table_cache_entries' is a GLOBAL variable | ||
show global variables like 'flush_only_old_table_cache_entries'; | ||
Variable_name Value | ||
flush_only_old_table_cache_entries OFF | ||
show session variables like 'flush_only_old_table_cache_entries'; | ||
Variable_name Value | ||
flush_only_old_table_cache_entries OFF | ||
select * from performance_schema.global_variables where variable_name='flush_only_old_table_cache_entries'; | ||
VARIABLE_NAME VARIABLE_VALUE | ||
flush_only_old_table_cache_entries OFF | ||
select * from performance_schema.session_variables where variable_name='flush_only_old_table_cache_entries'; | ||
VARIABLE_NAME VARIABLE_VALUE | ||
flush_only_old_table_cache_entries OFF | ||
set global flush_only_old_table_cache_entries = ON; | ||
select @@global.flush_only_old_table_cache_entries; | ||
@@global.flush_only_old_table_cache_entries | ||
1 | ||
set session flush_only_old_table_cache_entries = ON; | ||
ERROR HY000: Variable 'flush_only_old_table_cache_entries' is a GLOBAL variable and should be set with SET GLOBAL | ||
set @@global.flush_only_old_table_cache_entries = ON; | ||
select @@global.flush_only_old_table_cache_entries; | ||
@@global.flush_only_old_table_cache_entries | ||
1 | ||
set @@global.flush_only_old_table_cache_entries = OFF; | ||
select @@global.flush_only_old_table_cache_entries; | ||
@@global.flush_only_old_table_cache_entries | ||
0 | ||
set @@global.flush_only_old_table_cache_entries = 0; | ||
select @@global.flush_only_old_table_cache_entries; | ||
@@global.flush_only_old_table_cache_entries | ||
0 | ||
set @@global.flush_only_old_table_cache_entries = 1; | ||
select @@global.flush_only_old_table_cache_entries; | ||
@@global.flush_only_old_table_cache_entries | ||
1 | ||
set @@global.flush_only_old_table_cache_entries = TRUE; | ||
select @@global.flush_only_old_table_cache_entries; | ||
@@global.flush_only_old_table_cache_entries | ||
1 | ||
set @@global.flush_only_old_table_cache_entries = FALSE; | ||
select @@global.flush_only_old_table_cache_entries; | ||
@@global.flush_only_old_table_cache_entries | ||
0 | ||
set @@global.flush_only_old_table_cache_entries = 'ONN'; | ||
ERROR 42000: Variable 'flush_only_old_table_cache_entries' can't be set to the value of 'ONN' | ||
set @@global.flush_only_old_table_cache_entries = "OFFF"; | ||
ERROR 42000: Variable 'flush_only_old_table_cache_entries' can't be set to the value of 'OFFF' | ||
set @@global.flush_only_old_table_cache_entries = OF; | ||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OF' at line 1 | ||
set @@global.flush_only_old_table_cache_entries = TTRUE; | ||
ERROR 42000: Variable 'flush_only_old_table_cache_entries' can't be set to the value of 'TTRUE' | ||
set @@global.flush_only_old_table_cache_entries = FELSE; | ||
ERROR 42000: Variable 'flush_only_old_table_cache_entries' can't be set to the value of 'FELSE' | ||
set @@global.flush_only_old_table_cache_entries = -1024; | ||
ERROR 42000: Variable 'flush_only_old_table_cache_entries' can't be set to the value of '-1024' | ||
set @@global.flush_only_old_table_cache_entries = 65536; | ||
ERROR 42000: Variable 'flush_only_old_table_cache_entries' can't be set to the value of '65536' | ||
set @@global.flush_only_old_table_cache_entries = 65530.34; | ||
ERROR 42000: Incorrect argument type to variable 'flush_only_old_table_cache_entries' | ||
set @@global.flush_only_old_table_cache_entries = test; | ||
ERROR 42000: Variable 'flush_only_old_table_cache_entries' can't be set to the value of 'test' | ||
set @@global.flush_only_old_table_cache_entries = @start_global_value; |
57 changes: 57 additions & 0 deletions
57
mysql-test/suite/sys_vars/t/flush_only_old_table_cache_entries_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
set @start_global_value = @@global.flush_only_old_table_cache_entries; | ||
|
||
select @@global.flush_only_old_table_cache_entries; | ||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
select @@session.flush_only_old_table_cache_entries; | ||
show global variables like 'flush_only_old_table_cache_entries'; | ||
show session variables like 'flush_only_old_table_cache_entries'; | ||
select * from performance_schema.global_variables where variable_name='flush_only_old_table_cache_entries'; | ||
select * from performance_schema.session_variables where variable_name='flush_only_old_table_cache_entries'; | ||
|
||
# | ||
# show that it's writable | ||
# | ||
set global flush_only_old_table_cache_entries = ON; | ||
select @@global.flush_only_old_table_cache_entries; | ||
--error ER_GLOBAL_VARIABLE | ||
set session flush_only_old_table_cache_entries = ON; | ||
|
||
# | ||
# Change the value of variable to a valid value for GLOBAL Scope # | ||
# | ||
set @@global.flush_only_old_table_cache_entries = ON; | ||
select @@global.flush_only_old_table_cache_entries; | ||
set @@global.flush_only_old_table_cache_entries = OFF; | ||
select @@global.flush_only_old_table_cache_entries; | ||
set @@global.flush_only_old_table_cache_entries = 0; | ||
select @@global.flush_only_old_table_cache_entries; | ||
set @@global.flush_only_old_table_cache_entries = 1; | ||
select @@global.flush_only_old_table_cache_entries; | ||
set @@global.flush_only_old_table_cache_entries = TRUE; | ||
select @@global.flush_only_old_table_cache_entries; | ||
set @@global.flush_only_old_table_cache_entries = FALSE; | ||
select @@global.flush_only_old_table_cache_entries; | ||
|
||
# | ||
# Change the value of flush_only_old_table_cache_entries to an invalid value # | ||
# | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
set @@global.flush_only_old_table_cache_entries = 'ONN'; | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
set @@global.flush_only_old_table_cache_entries = "OFFF"; | ||
--error ER_PARSE_ERROR | ||
set @@global.flush_only_old_table_cache_entries = OF; | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
set @@global.flush_only_old_table_cache_entries = TTRUE; | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
set @@global.flush_only_old_table_cache_entries = FELSE; | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
set @@global.flush_only_old_table_cache_entries = -1024; | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
set @@global.flush_only_old_table_cache_entries = 65536; | ||
--error ER_WRONG_TYPE_FOR_VAR | ||
set @@global.flush_only_old_table_cache_entries = 65530.34; | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
set @@global.flush_only_old_table_cache_entries = test; | ||
|
||
set @@global.flush_only_old_table_cache_entries = @start_global_value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--flush-time=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--source include/have_debug.inc | ||
--source include/have_debug_sync.inc | ||
|
||
SET @start_global_value = @@global.flush_only_old_table_cache_entries; | ||
SET @@global.debug= '+d,tdc_flush_unused_tables'; | ||
|
||
# Check if flush_only_old_table_cache_entries is disabled | ||
SET debug_sync = 'now WAIT_FOR signal.disabled'; | ||
|
||
# Check if flush_only_old_table_cache_entries is enabled | ||
SET @@global.flush_only_old_table_cache_entries = true; | ||
SET debug_sync = 'now WAIT_FOR signal.enabled'; | ||
|
||
# Clean up | ||
SET @@global.debug= '-d,tdc_flush_unused_tables'; | ||
SET @@global.flush_only_old_table_cache_entries = @start_global_value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.