diff --git a/docs/data-masking-function-list.md b/docs/data-masking-function-list.md index c587b9adbf0..4f3df14093a 100644 --- a/docs/data-masking-function-list.md +++ b/docs/data-masking-function-list.md @@ -24,6 +24,7 @@ The feature is in [tech preview](glossary.md#tech-preview). | [`mask_ssn(str [,mask_char])`](#mask_ssnstr-mask_char) | Masks the US Social Security number | | [`mask_uk_nin(str [,mask_char])`](#mask_uk_ninstr-mask_char) | Masks the United Kingdom National Insurance number | | [`mask_uuid(str [,mask_char])`](#mask_uuidstr-mask_char) | Masks the Universally Unique Identifier | +| [masking_dictionaries_flush()](masking_dictionaries_flush()) | Resyncs the internal dictionary term cache | | [`masking_dictionary_remove(dictionary_name)`](#masking_dictionary_removedictionary_name) | Removes the dictionary | | [`masking_dictionary_term_add(dictionary_name, term_name)`](#masking_dictionary_term_adddictionary_name-term_name) | Adds a term to the masking dictionary | | [`masking_dictionary_term_remove(dictionary_name, term_name)`](#masking_dictionary_term_removedictionary_name-term_name) | Removes a term from the masking dictionary | @@ -32,6 +33,12 @@ The feature is in [tech preview](glossary.md#tech-preview). Replaces a term from one dictionary with a randomly selected term in another dictionary. +### Version update + +Percona Server for MySQL 8.0.41 introduces an internal term cache. Instead of querying the underlying `mysql.masking_dictionaries` table each time a function is executed, the server now utilizes internal in-memory data structures for lookups. This enhancement significantly improves performance, particularly when processing multiple rows. + + + ### Parameters | Parameter | Optional | Description | Type | @@ -760,6 +767,33 @@ mysql> SELECT mask_uuid('9a3b642c-06c6-11ee-be56-0242ac120002'); +-------------------------------------------------------+ ``` +## masking_dictionaries_flush() + +Resyncs the internal dictionary term cache. + +### Parameters + +None + +### Returns + +Returns a string value of `1` (one) when successful. + +### Example + +```{.bash data-prompt="mysql>"} +mysql> SELECT masking_dictionaries_flush(); +``` +??? example "Expected output" + + ```{.text .no-copy} + +------------------------------+ + | masking_dictionaries_flush() | + +------------------------------+ + | 1 | + +---------------------------- + + ``` + ## masking_dictionary_remove(dictionary_name) Removes all of the terms and then removes the dictionary. diff --git a/docs/data-masking-overview.md b/docs/data-masking-overview.md index e9fbe76eb5b..069e31fd51b 100644 --- a/docs/data-masking-overview.md +++ b/docs/data-masking-overview.md @@ -16,6 +16,21 @@ These examples underscore how data masking serves as a crucial safeguard for sen Data masking helps to limit the exposure of sensitive data by preventing access to non-authorized users. Masking provides a way to create a version of the data in situations, such as a presentation, sales demo, or software testing, when the real data should not be used. Data masking changes the data values while using the same format and cannot be reverse engineered. Masking reduces an organization's risk by making the data useless to an outside party. +## Version updates + +Percona Server for MySQL 8.0.41 introduces an internal term cache for the +following functions in the [data masking component](data-masking-function-list.md): + +* [gen_blocklist](data-masking-function-list.md#gen_blockliststr-from_dictionary_name-to_dictionary_name) + +* [gen_dictionary](data-masking-function-list.md#gen_dictionarydictionary_name) + +Instead of querying the underlying `mysql.masking_dictionaries` table each time a function is executed, the server now utilizes internal in-memory data structures for lookups. This enhancement significantly improves performance, particularly when processing multiple rows. + +With this redesign, the internal dictionary term cache might get out of sync with the underlying dictionaries table (default is `mysql.masking_dictionaries`). This can happen if you directly change the table instead of using the dedicated dictionary manipulation functions (`[masking_dictionary_term_add()]((data-masking-function-list.md#masking_dictionary_term_adddictionary_name-term_name`), [`masking_dictionary_term_remove()`](data-masking-function-list.md#masking_dictionary_term_removedictionary_name-term_name), [`masking_dictionary_remove()`](data-masking-function-list.md#masking_dictionary_removedictionary_name). + +To resync the internal dictionary term cache, we added a new function called `masking_dictionaries_flush()`. This function takes no arguments and returns 1 when it succeeds. + ## Data masking techniques The common data masking techniques are the following: