MySQL  8.0.26
Source Code Documentation
persisted_variable.cc File Reference
#include "sql/persisted_variable.h"
#include "my_config.h"
#include <assert.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include <memory>
#include <new>
#include <utility>
#include "lex_string.h"
#include "m_ctype.h"
#include "m_string.h"
#include "my_compiler.h"
#include "my_default.h"
#include "my_getopt.h"
#include "my_io.h"
#include "my_loglevel.h"
#include "my_macros.h"
#include "my_sys.h"
#include "my_thread.h"
#include "mysql/components/services/bits/psi_bits.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/log_shared.h"
#include "mysql/components/services/psi_file_bits.h"
#include "mysql/components/services/psi_memory_bits.h"
#include "mysql/components/services/psi_mutex_bits.h"
#include "mysql/components/services/system_variable_source_type.h"
#include "mysql/psi/mysql_file.h"
#include "mysql/psi/mysql_memory.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/status_var.h"
#include "mysql_version.h"
#include "mysqld_error.h"
#include "prealloced_array.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_internal.h"
#include "sql/auth/sql_security_ctx.h"
#include "sql/current_thd.h"
#include "sql/debug_sync.h"
#include "sql/derror.h"
#include "sql/item.h"
#include "sql/json_dom.h"
#include "sql/log.h"
#include "sql/mysqld.h"
#include "sql/set_var.h"
#include "sql/sql_class.h"
#include "sql/sql_error.h"
#include "sql/sql_lex.h"
#include "sql/sql_list.h"
#include "sql/sql_show.h"
#include "sql/sys_vars_shared.h"
#include "sql/thr_malloc.h"
#include "sql_string.h"
#include "template_utils.h"
#include "thr_mutex.h"
#include "typelib.h"

Classes

struct  sort_tv_by_timestamp
 A comparison operator to sort persistent variables entries by timestamp. More...
 

Functions

const string version ("\"Version\"")
 
const string name ("\"Name\"")
 
const string value ("\"Value\"")
 
const string metadata ("\"Metadata\"")
 
const string timestamp ("\"Timestamp\"")
 
const string user ("\"User\"")
 
const string host ("\"Host\"")
 
const string mysqld_section ("\"mysql_server\"")
 
const string static_section ("\"mysql_server_static_options\"")
 
const string colon (" : ")
 
const string comma (" , ")
 
const string open_brace ("{ ")
 
const string close_brace (" }")
 
void my_init_persist_psi_keys (void)
 CLASS Persisted_variables_cache Holds <name,value> pair of all options which needs to be persisted to a file. More...
 
static bool check_boolean_value (const char *value, String &bool_str)
 For boolean variable types do validation on what value is set for the variable and then report error in case an invalid value is set. More...
 

Variables

const int file_version = 1
 
PSI_file_key key_persist_file_cnf
 
static PSI_file_info all_persist_files []
 
PSI_mutex_key key_persist_file
 
PSI_mutex_key key_persist_variables
 
static PSI_mutex_info all_persist_mutexes []
 
PSI_memory_key key_memory_persisted_variables
 
static PSI_memory_info all_options []
 

Function Documentation

◆ check_boolean_value()

static bool check_boolean_value ( const char *  value,
String bool_str 
)
static

For boolean variable types do validation on what value is set for the variable and then report error in case an invalid value is set.

Parameters
[in]valueValue which needs to be checked for.
[out]bool_strTarget String into which correct value needs to be stored after validation.
Returns
true Failure if value is set to anything other than "true", "on", "1", "false" , "off", "0"
false Success

◆ close_brace()

const string close_brace ( " }"  )

◆ colon()

const string colon ( " : "  )

◆ comma()

const string comma ( ,
 
)

◆ host()

const string host ( "\"Host\""  )

◆ metadata()

const string metadata ( "\"Metadata\""  )

◆ my_init_persist_psi_keys()

void my_init_persist_psi_keys ( void  )

CLASS Persisted_variables_cache Holds <name,value> pair of all options which needs to be persisted to a file.

OVERVIEW

When first SET PERSIST statement is executed we instantiate Persisted_variables_cache which loads the config file if present into m_persist_variables set. This is a singleton operation. m_persist_variables is an in-memory copy of config file itself. If the SET statement passes then this in-memory is updated and flushed to file as an atomic operation.

Next SET PERSIST statement would only update the in-memory copy and sync to config file instead of loading the file again.

◆ mysqld_section()

const string mysqld_section ( "\"mysql_server\""  )

◆ name()

const string name ( "\"Name\""  )

◆ open_brace()

const string open_brace ( )

◆ static_section()

const string static_section ( "\"mysql_server_static_options\""  )

◆ timestamp()

const string timestamp ( "\"Timestamp\""  )

◆ user()

const string user ( "\"User\""  )

◆ value()

const string value ( "\"Value\""  )

◆ version()

const string version ( "\"Version\""  )

Variable Documentation

◆ all_options

PSI_memory_info all_options[]
static
Initial value:
= {
{&key_memory_persisted_variables, "persisted_options_root", 0,
#define PSI_DOCUMENT_ME
Definition: component_common.h:28
#define PSI_FLAG_ONLY_GLOBAL_STAT
Global stat only flag.
Definition: psi_bits.h:103
PSI_memory_key key_memory_persisted_variables
Definition: persisted_variable.cc:122

◆ all_persist_files

PSI_file_info all_persist_files[]
static
Initial value:
= {
PSI_file_key key_persist_file_cnf
Definition: persisted_variable.cc:106

◆ all_persist_mutexes

PSI_mutex_info all_persist_mutexes[]
static
Initial value:
= {
{&key_persist_file, "m_LOCK_persist_file", 0, 0, PSI_DOCUMENT_ME},
{&key_persist_variables, "m_LOCK_persist_variables", 0, 0,
PSI_mutex_key key_persist_file
Definition: persisted_variable.cc:113
PSI_mutex_key key_persist_variables
Definition: persisted_variable.cc:113

◆ file_version

const int file_version = 1

◆ key_memory_persisted_variables

PSI_memory_key key_memory_persisted_variables

◆ key_persist_file

PSI_mutex_key key_persist_file

◆ key_persist_file_cnf

PSI_file_key key_persist_file_cnf

◆ key_persist_variables

PSI_mutex_key key_persist_variables