MySQL 8.4.3
Source Code Documentation
|
A class representing one system variable - that is something that can be accessed as @global.variable_name or @session.variable_name, visible in SHOW xxx VARIABLES and in INFORMATION_SCHEMA.xxx_VARIABLES, optionally it can be assigned to, optionally it can have a command-line counterpart with the same name. More...
#include <set_var.h>
Public Types | |
enum | flag_enum { GLOBAL = 0x0001 , SESSION = 0x0002 , ONLY_SESSION = 0x0004 , SCOPE_MASK = 0x03FF , READONLY = 0x0400 , ALLOCATED = 0x0800 , INVISIBLE = 0x1000 , TRI_LEVEL = 0x2000 , NOTPERSIST = 0x4000 , HINT_UPDATEABLE = 0x8000 , PERSIST_AS_READ_ONLY = 0x10000 , SENSITIVE = 0x20000 } |
enum | binlog_status_enum { VARIABLE_NOT_IN_BINLOG , SESSION_VARIABLE_IN_BINLOG } |
Enumeration type to indicate for a system variable whether it will be written to the binlog or not. More... | |
Public Member Functions | |
sys_var (sys_var_chain *chain, const char *name_arg, const char *comment, int flag_args, ptrdiff_t off, int getopt_id, enum get_opt_arg_type getopt_arg_type, SHOW_TYPE show_val_type_arg, longlong def_val, PolyLock *lock, enum binlog_status_enum binlog_status_arg, on_check_function on_check_func, on_update_function on_update_func, const char *substitute, int parse_flag, sys_var *persisted_alias=nullptr, bool is_persisted_deprecated=false) | |
sys_var constructor More... | |
virtual | ~sys_var ()=default |
const char * | get_deprecation_substitute () |
virtual void | cleanup () |
All the cleanup procedures should be performed here. More... | |
virtual sys_var_pluginvar * | cast_pluginvar () |
downcast for sys_var_pluginvar. More... | |
bool | check (THD *thd, set_var *var) |
const uchar * | value_ptr (THD *running_thd, THD *target_thd, enum_var_type type, std::string_view keycache_name) |
const uchar * | value_ptr (THD *thd, enum_var_type type, std::string_view keycache_name) |
virtual void | update_default (longlong new_def_value) |
virtual longlong | get_default () |
virtual longlong | get_min_value () |
virtual ulonglong | get_max_value () |
virtual ulong | get_var_type () |
Returns variable type. More... | |
virtual void | set_arg_source (get_opt_arg_source *) |
virtual void | set_is_plugin (bool) |
virtual enum_variable_source | get_source () |
virtual const char * | get_source_name () |
virtual void | set_source (enum_variable_source src) |
virtual bool | set_source_name (const char *path) |
virtual bool | set_user (const char *usr) |
virtual const char * | get_user () |
virtual const char * | get_host () |
virtual bool | set_host (const char *hst) |
virtual ulonglong | get_timestamp () const |
virtual void | set_user_host (THD *thd) |
my_option * | get_option () |
virtual void | set_timestamp () |
virtual void | set_timestamp (ulonglong ts) |
virtual bool | is_non_persistent () |
bool | set_default (THD *thd, set_var *var) |
Update the system variable with the default value from either session or global scope. More... | |
bool | update (THD *thd, set_var *var) |
virtual void | saved_value_to_string (THD *thd, set_var *var, char *def_val)=0 |
This function converts value stored in save_result to string. More... | |
SHOW_TYPE | show_type () |
int | scope () const |
const CHARSET_INFO * | charset (THD *thd) |
bool | is_readonly () const |
bool | not_visible () const |
bool | is_trilevel () const |
bool | is_persist_readonly () const |
bool | is_parse_early () const |
bool | is_sensitive () const |
bool | is_hint_updateable () const |
Check if the variable can be set using SET_VAR hint. More... | |
bool | is_struct () |
the following is only true for keycache variables, that support the syntax @keycache_name.variable_name More... | |
bool | is_written_to_binlog (enum_var_type type) |
virtual bool | check_update_type (Item_result type)=0 |
bool | check_scope (enum_var_type query_type) |
Return true for success if: Global query and variable scope is GLOBAL or SESSION, or Session query and variable scope is SESSION or ONLY_SESSION. More... | |
bool | is_global_persist (enum_var_type type) |
bool | is_settable_at_command_line () |
Return true if settable at the command line. More... | |
bool | register_option (std::vector< my_option > *array, int parse_flags) |
void | do_deprecated_warning (THD *thd) |
Item * | copy_value (THD *thd) |
Create item from system variable value. More... | |
void | save_default (THD *thd, set_var *var) |
bool | check_if_sensitive_in_context (THD *, bool suppress_errors=true) const |
Public Attributes | |
sys_var * | next |
LEX_CSTRING | name |
sys_var * | m_persisted_alias |
If the variable has an alias in the persisted variables file, this should point to it. More... | |
bool | m_is_persisted_deprecated |
If m_persist_alias is set, and the current variable is deprecated and m_persist_alias is the recommended substitute, then this flag should be set to true. More... | |
enum sys_var::binlog_status_enum | binlog_status |
Static Public Attributes | |
static const int | PARSE_EARLY = 1 |
static const int | PARSE_NORMAL = 2 |
Protected Types | |
typedef bool(* | on_check_function) (sys_var *self, THD *thd, set_var *var) |
typedef bool(* | pre_update_function) (sys_var *self, THD *thd, set_var *var) |
typedef bool(* | on_update_function) (sys_var *self, THD *thd, enum_var_type type) |
Protected Member Functions | |
virtual const uchar * | session_value_ptr (THD *running_thd, THD *target_thd, std::string_view keycache_name) |
A pointer to a value of the variable for SHOW. More... | |
virtual const uchar * | global_value_ptr (THD *thd, std::string_view keycache_name) |
uchar * | session_var_ptr (THD *thd) |
A pointer to a storage area of the variable, to the raw data. More... | |
uchar * | global_var_ptr () |
Protected Attributes | |
int | flags |
or'ed flag_enum values More... | |
int | m_parse_flag |
either PARSE_EARLY or PARSE_NORMAL. More... | |
const SHOW_TYPE | show_val_type |
what value_ptr() returns for sql_show.cc More... | |
my_option | option |
min, max, default values are stored here More... | |
PolyLock * | guard |
second lock that protects the variable More... | |
ptrdiff_t | offset |
offset to the value from global_system_variables More... | |
on_check_function | on_check |
pre_update_function | pre_update |
Pointer to function to be invoked before updating system variable (but after calling on_check hook), while we do not hold any locks yet. More... | |
on_update_function | on_update |
const char *const | deprecation_substitute |
bool | is_os_charset |
true if the value is in character_set_filesystem More... | |
struct get_opt_arg_source | source |
char | user [USERNAME_CHAR_LENGTH+1] |
char | host [HOSTNAME_LENGTH+1] |
ulonglong | timestamp |
Private Member Functions | |
virtual bool | do_check (THD *thd, set_var *var)=0 |
virtual void | session_save_default (THD *thd, set_var *var)=0 |
save the session default value of the variable in var More... | |
virtual void | global_save_default (THD *thd, set_var *var)=0 |
save the global default value of the variable in var More... | |
virtual bool | session_update (THD *thd, set_var *var)=0 |
virtual bool | global_update (THD *thd, set_var *var)=0 |
Static Private Member Functions | |
static bool | set_and_truncate (char *dst, const char *string, size_t sizeof_dst) |
Like strncpy, but ensures the destination is '\0'-terminated. More... | |
Friends | |
class | Sys_var_alias |
A class representing one system variable - that is something that can be accessed as @global.variable_name or @session.variable_name, visible in SHOW xxx VARIABLES and in INFORMATION_SCHEMA.xxx_VARIABLES, optionally it can be assigned to, optionally it can have a command-line counterpart with the same name.
|
protected |
enum sys_var::flag_enum |
sys_var::sys_var | ( | sys_var_chain * | chain, |
const char * | name_arg, | ||
const char * | comment, | ||
int | flags_arg, | ||
ptrdiff_t | off, | ||
int | getopt_id, | ||
enum get_opt_arg_type | getopt_arg_type, | ||
SHOW_TYPE | show_val_type_arg, | ||
longlong | def_val, | ||
PolyLock * | lock, | ||
enum binlog_status_enum | binlog_status_arg, | ||
on_check_function | on_check_func, | ||
on_update_function | on_update_func, | ||
const char * | substitute, | ||
int | parse_flag, | ||
sys_var * | persisted_alias = nullptr , |
||
bool | is_persisted_deprecated = false |
||
) |
sys_var constructor
chain | variables are linked into chain for add_static_system_variable_chain() or add_dynamic_system_variable_chain() |
name_arg | the name of the variable. Must be 0-terminated and exist for the lifetime of the sys_var object. |
comment | shown in mysqld –help, |
flags_arg | or'ed flag_enum values |
off | offset of the global variable value from the &global_system_variables. |
getopt_id | -1 for no command-line option, otherwise |
getopt_arg_type | no|optional|required value |
show_val_type_arg | what value_ptr() returns for sql_show.cc |
def_val | default value, |
lock | mutex or rw_lock that protects the global variable in addition* to LOCK_global_system_variables. |
binlog_status_arg | if the sysvar will be written to binlog or not |
on_check_func | a function to be called at the end of sys_var::check, put your additional checks here |
on_update_func | a function to be called at the end of sys_var::update, any post-update activity should happen here |
substitute | If non-NULL, this variable is deprecated and the string describes what one should use instead. If an empty string, the variable is deprecated but no replacement is offered. |
parse_flag | either PARSE_EARLY or PARSE_NORMAL |
persisted_alias | If this variable is persisted, it will appear in the file both under its own name, and using 'persisted_alias'. |
is_persisted_deprecated | If this variable is found in the persisted, variables file, and its alias is not found, a deprecation warning will be issued if is_persisted_deprecated is true. This flag must be false if persisted_alias is null. |
|
virtualdefault |
|
inlinevirtual |
downcast for sys_var_pluginvar.
Returns this if it's an instance of sys_var_pluginvar, and 0 otherwise.
Reimplemented in sys_var_pluginvar, and Sys_var_alias.
const CHARSET_INFO * sys_var::charset | ( | THD * | thd | ) |
bool sys_var::check_if_sensitive_in_context | ( | THD * | thd, |
bool | suppress_errors = true |
||
) | const |
|
inline |
Return true for success if: Global query and variable scope is GLOBAL or SESSION, or Session query and variable scope is SESSION or ONLY_SESSION.
|
pure virtual |
Implemented in sys_var_pluginvar, Sys_var_integer< T, ARGT, SHOWT, SIGNED >, Sys_var_alias, Sys_var_typelib, Sys_var_multi_enum, Sys_var_charptr, Sys_var_dbug, Sys_var_double, Sys_var_plugin, Sys_var_struct< Struct_type, Name_getter >, Sys_var_tz, Sys_var_gtid_next, Sys_var_gtid_purged, Sys_var_proxy_user, Sys_var_have, and Sys_var_charptr_func.
|
inlinevirtual |
All the cleanup procedures should be performed here.
Reimplemented in Sys_var_alias, and Sys_var_charptr.
Create item from system variable value.
thd | pointer to THD object |
Implemented in Sys_var_proxy_user, Sys_var_have, Sys_var_struct< Struct_type, Name_getter >, Sys_var_gtid_next, Sys_var_charptr_func, Sys_var_typelib, Sys_var_multi_enum, Sys_var_set, sys_var_pluginvar, Sys_var_integer< T, ARGT, SHOWT, SIGNED >, Sys_var_alias, Sys_var_charptr, Sys_var_dbug, Sys_var_double, Sys_var_flagset, Sys_var_plugin, Sys_var_tz, and Sys_var_gtid_purged.
void sys_var::do_deprecated_warning | ( | THD * | thd | ) |
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inline |
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in sys_var_pluginvar, and Sys_var_alias.
|
inlinevirtual |
Reimplemented in sys_var_pluginvar, and Sys_var_alias.
|
inline |
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
save the global default value of the variable in var
Implemented in sys_var_pluginvar, Sys_var_proxy_user, Sys_var_session_special, Sys_var_session_special_double, Sys_var_have, Sys_var_gtid_next, Sys_var_charptr_func, Sys_var_gtid_purged, Sys_var_integer< T, ARGT, SHOWT, SIGNED >, Sys_var_enum, Sys_var_bool, Sys_var_multi_enum, Sys_var_charptr, Sys_var_dbug, Sys_var_double, Sys_var_flagset, Sys_var_set, Sys_var_bit, Sys_var_struct< Struct_type, Name_getter >, Sys_var_tz, Sys_var_alias, and Sys_var_plugin.
Implemented in Sys_var_multi_enum, Sys_var_proxy_user, Sys_var_session_special, Sys_var_session_special_double, Sys_var_have, Sys_var_gtid_next, Sys_var_charptr_func, Sys_var_integer< T, ARGT, SHOWT, SIGNED >, Sys_var_enum, Sys_var_bool, Sys_var_dbug, Sys_var_double, Sys_var_flagset, Sys_var_set, Sys_var_plugin, Sys_var_bit, Sys_var_struct< Struct_type, Name_getter >, Sys_var_tz, sys_var_pluginvar, Sys_var_alias, Sys_var_charptr, Sys_var_lexstring, Sys_var_keycache, Sys_var_enum_binlog_checksum, Sys_var_gtid_purged, Sys_var_gtid_mode, Sys_var_enforce_gtid_consistency, and Sys_var_binlog_encryption.
|
protectedvirtual |
Reimplemented in Sys_var_enum, Sys_var_multi_enum, Sys_var_test_flag, Sys_var_session_special, Sys_var_session_special_double, Sys_var_have, Sys_var_struct< Struct_type, Name_getter >, Sys_var_tz, Sys_var_gtid_next, Sys_var_charptr_func, Sys_var_system_time_zone, sys_var_pluginvar, Sys_var_alias, Sys_var_version, Sys_var_keycache, Sys_var_dbug, Sys_var_flagset, Sys_var_set, Sys_var_plugin, Sys_var_bit, Sys_var_have_func, Sys_var_gtid_executed, Sys_var_gtid_purged, and Sys_var_gtid_owned.
|
protected |
|
inline |
|
inline |
Check if the variable can be set using SET_VAR hint.
|
inlinevirtual |
Reimplemented in sys_var_pluginvar, and Sys_var_alias.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Return true if settable at the command line.
|
inline |
the following is only true for keycache variables, that support the syntax @keycache_name.variable_name
|
inline |
|
inline |
|
inline |
|
inline |
|
pure virtual |
This function converts value stored in save_result to string.
This function must be called after calling save_default() as save_default() will store default value to save_result.
Implemented in Sys_var_proxy_user, Sys_var_session_special, Sys_var_session_special_double, Sys_var_have, Sys_var_gtid_next, Sys_var_charptr_func, Sys_var_gtid_purged, Sys_var_integer< T, ARGT, SHOWT, SIGNED >, Sys_var_enum, Sys_var_bool, Sys_var_multi_enum, Sys_var_charptr, Sys_var_dbug, Sys_var_double, Sys_var_plugin, Sys_var_bit, Sys_var_struct< Struct_type, Name_getter >, Sys_var_tz, sys_var_pluginvar, Sys_var_alias, Sys_var_flagset, and Sys_var_set.
|
inline |
save the session default value of the variable in var
Implemented in sys_var_pluginvar, Sys_var_multi_enum, Sys_var_proxy_user, Sys_var_dbug, Sys_var_have, Sys_var_charptr_func, Sys_var_gtid_purged, Sys_var_enum, Sys_var_charptr, Sys_var_double, Sys_var_flagset, Sys_var_set, Sys_var_bit, Sys_var_session_special, Sys_var_session_special_double, Sys_var_struct< Struct_type, Name_getter >, Sys_var_tz, Sys_var_gtid_next, Sys_var_integer< T, ARGT, SHOWT, SIGNED >, Sys_var_alias, Sys_var_bool, and Sys_var_plugin.
Implemented in Sys_var_multi_enum, Sys_var_proxy_user, Sys_var_have, Sys_var_charptr_func, Sys_var_gtid_purged, Sys_var_dbug, sys_var_pluginvar, Sys_var_integer< T, ARGT, SHOWT, SIGNED >, Sys_var_alias, Sys_var_enum, Sys_var_bool, Sys_var_charptr, Sys_var_double, Sys_var_flagset, Sys_var_set, Sys_var_plugin, Sys_var_bit, Sys_var_session_special, Sys_var_session_special_double, Sys_var_struct< Struct_type, Name_getter >, Sys_var_tz, Sys_var_transaction_isolation, Sys_var_transaction_read_only, and Sys_var_gtid_next.
|
protectedvirtual |
A pointer to a value of the variable for SHOW.
It must be of show_val_type type (bool for SHOW_BOOL, int for SHOW_INT, longlong for SHOW_LONGLONG, etc).
Reimplemented in Sys_var_multi_enum, Sys_var_have, Sys_var_charptr_func, Sys_var_gtid_purged, Sys_var_enum, Sys_var_proxy_user, Sys_var_external_user, Sys_var_struct< Struct_type, Name_getter >, Sys_var_tz, Sys_var_dbug, sys_var_pluginvar, Sys_var_alias, Sys_var_max_user_conn, Sys_var_flagset, Sys_var_set, Sys_var_plugin, Sys_var_bit, Sys_var_session_special, Sys_var_session_special_double, Sys_var_gtid_next, and Sys_var_gtid_owned.
A pointer to a storage area of the variable, to the raw data.
Typically it's the same as session_value_ptr(), but it's different, for example, for ENUM, that is printed as a string, but stored as a number.
|
inlinestaticprivate |
Like strncpy, but ensures the destination is '\0'-terminated.
Is also safe to call if dst==string (but not if they overlap in any other way).
dst | Target string |
string | Source string |
sizeof_dst | Size of the dst buffer |
false | The entire string was copied to dst |
true | strlen(string) was bigger than or equal to sizeof_dst, so dst contains only the sizeof_dst-1 first characters of string. |
|
inlinevirtual |
Reimplemented in Sys_var_alias, and sys_var_pluginvar.
Update the system variable with the default value from either session or global scope.
The default value is stored in the 'var' argument. Return false when successful.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in Sys_var_alias, and sys_var_pluginvar.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
inlinevirtual |
Reimplemented in Sys_var_alias.
|
virtual |
Reimplemented in Sys_var_alias.
|
inline |
|
inlinevirtual |
Reimplemented in Sys_var_alias.
const uchar * sys_var::value_ptr | ( | THD * | running_thd, |
THD * | target_thd, | ||
enum_var_type | type, | ||
std::string_view | keycache_name | ||
) |
const uchar * sys_var::value_ptr | ( | THD * | thd, |
enum_var_type | type, | ||
std::string_view | keycache_name | ||
) |
|
friend |
enum sys_var::binlog_status_enum sys_var::binlog_status |
|
protected |
|
protected |
or'ed flag_enum values
|
protected |
second lock that protects the variable
|
protected |
|
protected |
true if the value is in character_set_filesystem
bool sys_var::m_is_persisted_deprecated |
If m_persist_alias is set, and the current variable is deprecated and m_persist_alias is the recommended substitute, then this flag should be set to true.
This has the consequence that the code that loads persisted variables will generate a warning if it encounters this variable but does not encounter the alias.
|
protected |
either PARSE_EARLY or PARSE_NORMAL.
sys_var* sys_var::m_persisted_alias |
If the variable has an alias in the persisted variables file, this should point to it.
This has the following consequences:
LEX_CSTRING sys_var::name |
sys_var* sys_var::next |
|
protected |
offset to the value from global_system_variables
|
protected |
|
protected |
|
protected |
min, max, default values are stored here
|
static |
|
static |
|
protected |
Pointer to function to be invoked before updating system variable (but after calling on_check hook), while we do not hold any locks yet.
|
protected |
what value_ptr() returns for sql_show.cc
|
protected |
|
protected |
|
protected |