Update my_default_record_cache_size if global.read_buff_size is changed

Before this patch, my_default_record_cache_size was only updated on
server start from global_read_buff.size
This commit is contained in:
Monty 2024-12-01 16:05:58 +02:00
parent 52c29f3bdc
commit f297623345

View file

@ -2923,6 +2923,14 @@ static Sys_var_proxy_user Sys_proxy_user(
static Sys_var_external_user Sys_exterenal_user(
"external_user", "The external user account used when logging in");
static bool update_record_cache(sys_var *self, THD *thd, enum_var_type type)
{
if (type == OPT_GLOBAL)
my_default_record_cache_size= global_system_variables.read_buff_size;
return false;
}
static Sys_var_ulong Sys_read_buff_size(
"read_buffer_size",
"Each thread that does a sequential scan allocates a buffer of "
@ -2930,7 +2938,8 @@ static Sys_var_ulong Sys_read_buff_size(
"you may want to increase this value",
SESSION_VAR(read_buff_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(128*1024),
BLOCK_SIZE(IO_SIZE));
BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(0), ON_UPDATE(update_record_cache));
static bool check_read_only(sys_var *self, THD *thd, set_var *var)
{