23#ifndef PERSISTED_VARIABLE_H_INCLUDED
24#define PERSISTED_VARIABLE_H_INCLUDED
29#include <unordered_set>
69 return key == persist_var.
key;
101#ifdef HAVE_PSI_INTERFACE
119 int init(
int *argc,
char ***argv);
150 const char *target_var_name =
nullptr,
151 int target_var_name_length = 0);
188 bool arg_separator_added =
false,
189 bool plugin_options =
false,
197 bool &arg_separator_added);
221 std::string
to_hex(
const std::string &value);
222 std::string
from_hex(
const std::string &value);
235 bool is_read_only =
false);
244 size_t &file_key_length,
bool generate =
false);
JSON DOM abstract base class.
Definition: json_dom.h:172
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:372
Definition: persisted_variable.h:110
Key_info m_key_info
Definition: persisted_variable.h:332
bool m_keyring_support_available
Definition: persisted_variable.h:335
bool append_read_only_variables(int *argc, char ***argv, bool arg_separator_added=false, bool plugin_options=false, MEM_ROOT *root_to_use=nullptr)
append read only persisted variables to command line options with a separator.
Definition: persisted_variable.cc:2022
Persisted_variables_uset * get_persisted_dynamic_variables()
Get persisted variables.
Definition: persisted_variable.cc:2235
bool reset_persisted_variables(THD *thd, const char *name, bool if_exists)
Reset persisted options.
Definition: persisted_variable.cc:2111
void clear_sensitive_blob_and_iv()
Definition: persisted_variable.cc:2296
void unlock()
Release lock on m_persisted_dynamic_variables/m_persisted_static_variables.
Definition: persisted_variable.h:208
void load_aliases()
After extracting the variables from the JSON, we duplicate any variable definition that relates to an...
Definition: persisted_variable.cc:1740
int read_persist_file_v2(const Json_object *json_object)
Read v2 persistent file.
Definition: persisted_variable.cc:1634
void close_persist_file()
Close persisted config file.
Definition: persisted_variable.cc:872
Persisted_variables_uset m_persisted_dynamic_variables
Definition: persisted_variable.h:309
void set_parse_early_sources()
Helper to set source information for PARSE_EARLY variables.
Definition: persisted_variable.cc:889
File_version
Definition: persisted_variable.h:112
bool load_persist_file()
Search for persisted config file and if found read persistent options.
Definition: persisted_variable.cc:884
std::string to_hex(const std::string &value)
Definition: persisted_variable.cc:2301
Persisted_variables_uset * get_persisted_dynamic_parse_early_variables()
Get persisted parse-early variables.
Definition: persisted_variable.cc:2257
bool open_persist_backup_file(int flag)
Open persisted backup config file.
Definition: persisted_variable.cc:862
Persisted_variables_uset m_persisted_dynamic_parse_early_variables
Definition: persisted_variable.h:305
static Persisted_variables_cache * m_instance
Definition: persisted_variable.h:342
return_status decrypt_sensitive_variables()
Decrypt sensitive variables values.
Definition: persisted_variable.cc:2539
int read_persist_file_v1(const Json_object *json_object)
Read v1 persistent file.
Definition: persisted_variable.cc:1519
Persisted_variables_umap * get_persisted_static_sensitive_variables(THD *thd)
Get SENSITIVE persisted static variables.
Definition: persisted_variable.cc:2273
void cleanup()
Definition: persisted_variable.cc:2288
bool write_persist_file_v2(String &dest, bool &do_cleanup)
Write v2 persistent file.
Definition: persisted_variable.cc:671
bool get_file_encryption_key(std::unique_ptr< unsigned char[]> &file_key, size_t &file_key_length, bool generate=false)
Get file encryption key.
Definition: persisted_variable.cc:2340
return_status encrypt_sensitive_variables()
Encrypt sensitive variables values.
Definition: persisted_variable.cc:2467
static Persisted_variables_cache * get_instance()
Return a singleton object.
Definition: persisted_variable.cc:333
MYSQL_FILE * m_fd
Definition: persisted_variable.h:345
MEM_ROOT ro_persisted_argv_alloc
Definition: persisted_variable.h:353
std::string m_persist_filename
Definition: persisted_variable.h:346
Persisted_variables_uset m_persisted_dynamic_plugin_variables
Definition: persisted_variable.h:320
void keyring_support_available()
Set internal state to reflect keyring support status.
Definition: persisted_variable.cc:2611
Persisted_variables_uset m_persisted_dynamic_sensitive_variables
Definition: persisted_variable.h:307
Persisted_variables_umap * get_persisted_static_variables()
Get persisted static variables.
Definition: persisted_variable.cc:2265
std::string from_hex(const std::string &value)
Definition: persisted_variable.cc:2309
return_status
Definition: persisted_variable.h:242
static const char * get_variable_alias(const sys_var *system_var)
If the variable has an alias, return the name for the alias.
Definition: persisted_variable.cc:579
int read_persist_file()
Driver function: Read options from persistent file.
Definition: persisted_variable.cc:1855
Persisted_variables_uset m_persisted_dynamic_sensitive_plugin_variables
Definition: persisted_variable.h:315
bool set_variable(THD *thd, set_var *system_var)
Update in-memory copy for every SET PERSIST statement.
Definition: persisted_variable.cc:373
std::string m_sensitive_variables_blob
Definition: persisted_variable.h:337
Persisted_variables_umap m_persisted_static_variables
Definition: persisted_variable.h:302
Persisted_variables_uset * get_persisted_dynamic_sensitive_variables(THD *thd)
Get SENSITIVE persisted variables.
Definition: persisted_variable.cc:2243
mysql_mutex_t m_LOCK_persist_file
Definition: persisted_variable.h:348
void lock()
Acquire lock on m_persisted_dynamic_variables/m_persisted_static_variables.
Definition: persisted_variable.h:204
static String * get_variable_value(THD *thd, sys_var *system_var, String *str, bool *is_null)
Retrieve variables value from sys_var.
Definition: persisted_variable.cc:553
MEM_ROOT parse_early_persisted_argv_alloc
Definition: persisted_variable.h:350
std::string m_iv
Definition: persisted_variable.h:339
Persisted_variables_umap m_persisted_static_parse_early_variables
Definition: persisted_variable.h:300
Persisted_variables_cache()
Definition: persisted_variable.cc:228
bool append_parse_early_variables(int *argc, char ***argv, bool &arg_separator_added)
append PARSE EARLY read only persisted variables to command line options with a separator.
Definition: persisted_variable.cc:1942
int init(int *argc, char ***argv)
Initialize class members.
Definition: persisted_variable.cc:258
mysql_mutex_t m_LOCK_persist_variables
Definition: persisted_variable.h:341
Persisted_variables_umap m_persisted_static_sensitive_variables
Definition: persisted_variable.h:298
std::string m_persist_backup_filename
Definition: persisted_variable.h:347
void assert_lock_owner()
Assert caller that owns lock on m_persisted_dynamic_variables/m_persisted_static_variables.
Definition: persisted_variable.h:213
bool flush_to_file()
Driver: Flush in-memory copy to persistent file.
Definition: persisted_variable.cc:790
bool open_persist_file(int flag)
Open persisted config file.
Definition: persisted_variable.cc:841
File_version m_default_version
Definition: persisted_variable.h:359
bool set_persisted_options(bool plugin_options, const char *target_var_name=nullptr, int target_var_name_length=0)
set_persisted_options() will set the options read from persisted config file
Definition: persisted_variable.cc:934
bool extract_variables_from_json(const Json_dom *dom, bool is_read_only=false)
extract_variables_from_json() is used to extract all the variable information which is in the form of...
Definition: persisted_variable.cc:1416
Persisted_variables_umap * get_persisted_static_parse_early_variables()
Get persisted parse-early static variables.
Definition: persisted_variable.cc:2284
MEM_ROOT ro_persisted_plugin_argv_alloc
Definition: persisted_variable.h:355
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
set_var_base descendant for assignments to the system variables.
Definition: set_var.h:970
A class representing one system variable - that is something that can be accessed as @global....
Definition: set_var.h:104
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:49
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:56
#define mysql_mutex_assert_owner(M)
Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
Definition: mysql_mutex.h:111
static int flag
Definition: hp_test1.cc:39
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
ABI for instrumented mutexes.
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1054
std::conditional_t< !std::is_array< T >::value, std::unique_ptr< T, detail::Deleter< T > >, std::conditional_t< detail::is_unbounded_array_v< T >, std::unique_ptr< T, detail::Array_deleter< std::remove_extent_t< T > > >, void > > unique_ptr
The following is a common type that is returned by all the ut::make_unique (non-aligned) specializati...
Definition: ut0new.h:2436
void my_init_persist_psi_keys(void)
CLASS Persisted_variables_cache Holds <name,value> pair of all options which needs to be persisted to...
Definition: persisted_variable.cc:158
Instrumentation helpers for mutexes.
Performance schema instrumentation interface.
PSI_memory_key key_memory_persisted_variables_memroot
Definition: psi_memory_key.cc:119
Our own string classes, used pervasively throughout the executor.
case opt name
Definition: sslopt-case.h:32
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:82
An instrumented FILE structure.
Definition: mysql_file.h:482
Definition: persisted_variable.h:322
std::string m_file_key_iv
Definition: persisted_variable.h:328
const size_t m_master_key_size
Definition: persisted_variable.h:325
std::string m_master_key_name
Definition: persisted_variable.h:323
std::string m_master_key_type
Definition: persisted_variable.h:324
std::string m_file_key
Definition: persisted_variable.h:327
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:49
STRUCT st_persist_var_hash.
Definition: persisted_variable.h:79
size_t operator()(const st_persist_var &pv) const
Definition: persisted_variable.h:80
STRUCT st_persist_var.
Definition: persisted_variable.h:54
st_persist_var()
Definition: persisted_variable.cc:198
std::string user
Definition: persisted_variable.h:58
ulonglong timestamp
Definition: persisted_variable.h:57
std::string value
Definition: persisted_variable.h:56
bool is_null
Definition: persisted_variable.h:60
std::string key
Definition: persisted_variable.h:55
std::string host
Definition: persisted_variable.h:59
bool operator==(const st_persist_var &persist_var) const
Definition: persisted_variable.h:68