Skip to content

Commit 7d08434

Browse files
committed
MDEV-30849 Hashicorp Plugin: enable key version caching by default
set hashicorp_key_management_cache_version_timeout=60s by default increase hashicorp_key_management_cache_timeout to 24h by default, because key values should never change, but we don't want to remove a variable for compatibility reasons
1 parent 886a51d commit 7d08434

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

plugin/hashicorp_key_management/hashicorp_key_management_plugin.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ static int timeout;
343343
static int max_retries;
344344
static char caching_enabled;
345345
static char check_kv_version;
346-
static long cache_timeout;
347-
static long cache_version_timeout;
346+
static long cache_timeout; // for KEY_MAP key_info_cache
347+
static long cache_version_timeout; // for VER_MAP latest_version_cache
348348
static char use_cache_on_timeout;
349349

350350
static MYSQL_SYSVAR_STR(vault_ca, vault_ca,
@@ -399,7 +399,7 @@ static void cache_timeout_update (MYSQL_THD thd,
399399
static MYSQL_SYSVAR_LONG(cache_timeout, cache_timeout,
400400
PLUGIN_VAR_RQCMDARG,
401401
"Cache timeout for key data (in milliseconds)",
402-
NULL, cache_timeout_update, 60000, 0, LONG_MAX, 1);
402+
NULL, cache_timeout_update, 24*60*60*1000, 0, LONG_MAX, 1);
403403

404404
static void
405405
cache_version_timeout_update (MYSQL_THD thd,
@@ -415,7 +415,7 @@ static void
415415
static MYSQL_SYSVAR_LONG(cache_version_timeout, cache_version_timeout,
416416
PLUGIN_VAR_RQCMDARG,
417417
"Cache timeout for key version (in milliseconds)",
418-
NULL, cache_version_timeout_update, 0, 0, LONG_MAX, 1);
418+
NULL, cache_version_timeout_update, 60*1000, 0, LONG_MAX, 1);
419419

420420
static MYSQL_SYSVAR_BOOL(use_cache_on_timeout, use_cache_on_timeout,
421421
PLUGIN_VAR_RQCMDARG,

plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_encode.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
SHOW GLOBAL variables LIKE "hashicorp%";
22
Variable_name Value
3-
hashicorp_key_management_cache_timeout 60000
4-
hashicorp_key_management_cache_version_timeout 0
3+
hashicorp_key_management_cache_timeout 86400000
4+
hashicorp_key_management_cache_version_timeout 60000
55
hashicorp_key_management_caching_enabled ON
66
hashicorp_key_management_check_kv_version OFF
77
hashicorp_key_management_max_retries 3

plugin/hashicorp_key_management/mysql-test/vault/r/hashicorp_key_rotation_age.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHOW GLOBAL variables LIKE "hashicorp%";
22
Variable_name Value
3-
hashicorp_key_management_cache_timeout 60000
3+
hashicorp_key_management_cache_timeout 86400000
44
hashicorp_key_management_cache_version_timeout 0
55
hashicorp_key_management_caching_enabled ON
66
hashicorp_key_management_check_kv_version OFF

0 commit comments

Comments
 (0)