-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PS-9148: Implement dictionary flusher for masking_functions plugin
https://perconadev.atlassian.net/browse/PS-9148 - Added component_masking.dictionaries_flush_interval_seconds system variable. - Added actual flusher thread. It periodically rereads content of dictionary table and updates in-memory cache.
- Loading branch information
1 parent
15cfaae
commit 58517cf
Showing
11 changed files
with
391 additions
and
1 deletion.
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
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
70 changes: 70 additions & 0 deletions
70
mysql-test/suite/component_masking_functions/r/rpl_dictionaries_flush_interval.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,70 @@ | ||
include/master-slave.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
[connection master] | ||
SET GLOBAL DEBUG='+d, masking_functions_signal_on_cache_reload'; | ||
INSTALL COMPONENT 'file://component_masking_functions'; | ||
[connection slave] | ||
SET GLOBAL DEBUG='+d, masking_functions_signal_on_cache_reload'; | ||
INSTALL COMPONENT 'file://component_masking_functions'; | ||
[connection master] | ||
CREATE TABLE mysql.masking_dictionaries( | ||
Dictionary VARCHAR(256) NOT NULL, | ||
Term VARCHAR(256) NOT NULL, | ||
UNIQUE INDEX dictionary_term_idx (Dictionary, Term) | ||
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4; | ||
CREATE USER udftest_priv@localhost; | ||
GRANT MASKING_DICTIONARIES_ADMIN ON *.* TO udftest_priv@localhost; | ||
SELECT masking_dictionary_term_add('single_dict_1', 'entry_1'); | ||
masking_dictionary_term_add('single_dict_1', 'entry_1') | ||
1 | ||
SELECT masking_dictionary_term_add('single_dict_2', 'entry_2'); | ||
masking_dictionary_term_add('single_dict_2', 'entry_2') | ||
1 | ||
SELECT gen_dictionary('single_dict_1'); | ||
gen_dictionary('single_dict_1') | ||
entry_1 | ||
SELECT gen_dictionary('single_dict_2'); | ||
gen_dictionary('single_dict_2') | ||
entry_2 | ||
include/rpl_sync.inc | ||
[connection slave] | ||
SELECT * FROM mysql.masking_dictionaries; | ||
Dictionary Term | ||
single_dict_1 entry_1 | ||
single_dict_2 entry_2 | ||
SELECT gen_dictionary('single_dict_1'); | ||
gen_dictionary('single_dict_1') | ||
entry_1 | ||
SELECT gen_dictionary('single_dict_2'); | ||
gen_dictionary('single_dict_2') | ||
entry_2 | ||
[connection master] | ||
INSERT INTO mysql.masking_dictionaries VALUES ('single_dict_3', 'entry_3'); | ||
SET DEBUG_SYNC='now WAIT_FOR masking_functions_cache_reload_done'; | ||
SELECT gen_dictionary('single_dict_3'); | ||
gen_dictionary('single_dict_3') | ||
entry_3 | ||
include/rpl_sync.inc | ||
[connection slave] | ||
SELECT * FROM mysql.masking_dictionaries; | ||
Dictionary Term | ||
single_dict_1 entry_1 | ||
single_dict_2 entry_2 | ||
single_dict_3 entry_3 | ||
SET DEBUG_SYNC='now WAIT_FOR masking_functions_cache_reload_done'; | ||
SELECT gen_dictionary('single_dict_3'); | ||
gen_dictionary('single_dict_3') | ||
entry_3 | ||
[connection slave] | ||
SET GLOBAL DEBUG='-d, masking_functions_signal_on_cache_reload'; | ||
UNINSTALL COMPONENT 'file://component_masking_functions'; | ||
[connection master] | ||
SET GLOBAL DEBUG='-d, masking_functions_signal_on_cache_reload'; | ||
UNINSTALL COMPONENT 'file://component_masking_functions'; | ||
DROP USER udftest_priv@localhost; | ||
DROP TABLE mysql.masking_dictionaries; | ||
include/rpl_sync.inc | ||
include/rpl_end.inc |
31 changes: 31 additions & 0 deletions
31
...te/component_masking_functions/r/sys_var_dictionaries_flush_interval_seconds_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,31 @@ | ||
INSTALL COMPONENT 'file://component_masking_functions'; | ||
SELECT @@global.masking_functions.dictionaries_flush_interval_seconds; | ||
@@global.masking_functions.dictionaries_flush_interval_seconds | ||
0 | ||
SELECT NAME FROM performance_schema.threads WHERE NAME LIKE "%masking_functions%"; | ||
NAME | ||
SET GLOBAL masking_functions.dictionaries_flush_interval_seconds=100; | ||
ERROR HY000: Variable 'masking_functions.dictionaries_flush_interval_seconds' is a read only variable | ||
SET SESSION masking_functions.dictionaries_flush_interval_seconds=100; | ||
ERROR HY000: Variable 'masking_functions.dictionaries_flush_interval_seconds' is a read only variable | ||
# restart: --masking-functions.dictionaries-flush-interval-seconds=100 | ||
SELECT @@global.masking_functions.dictionaries_flush_interval_seconds; | ||
@@global.masking_functions.dictionaries_flush_interval_seconds | ||
100 | ||
CREATE TABLE mysql.masking_dictionaries( | ||
Dictionary VARCHAR(256) NOT NULL, | ||
Term VARCHAR(256) NOT NULL, | ||
UNIQUE INDEX dictionary_term_idx (Dictionary, Term) | ||
) ENGINE = InnoDB DEFAULT CHARSET=utf8mb4; | ||
CREATE USER udftest_priv@localhost; | ||
GRANT MASKING_DICTIONARIES_ADMIN ON *.* TO udftest_priv@localhost; | ||
SELECT masking_dictionary_term_add('single_dict_1', 'entry_1'); | ||
masking_dictionary_term_add('single_dict_1', 'entry_1') | ||
1 | ||
SELECT NAME FROM performance_schema.threads WHERE NAME LIKE "%masking_functions%"; | ||
NAME | ||
thread/masking_functions/masking_functions_dict_flusher | ||
UNINSTALL COMPONENT 'file://component_masking_functions'; | ||
DROP USER udftest_priv@localhost; | ||
DROP TABLE mysql.masking_dictionaries; | ||
# restart: |
2 changes: 2 additions & 0 deletions
2
mysql-test/suite/component_masking_functions/t/rpl_dictionaries_flush_interval-master.opt
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,2 @@ | ||
$MASKING_FUNCTIONS_COMPONENT_OPT | ||
--loose-masking_functions.dictionaries_flush_interval_seconds=1 |
Oops, something went wrong.