MySQL  8.0.16
Source Code Documentation
persisted_variable.cc File Reference
#include "sql/persisted_variable.h"
#include "my_config.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_dbug.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/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/psi/psi_base.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 ("\ersion\)
 
const string name ("\ame\)
 
const string value ("\alue\)
 
const string metadata ("\etadata\)
 
const string timestamp ("\imestamp\)
 
const string user ("\ser\)
 
const string host ("\ost\)
 
const string mysqld_section ("\ysql_server\)
 
const string static_section ("\ysql_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...
 

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

◆ close_brace()

const string close_brace ( " }"  )

◆ colon()

const string colon ( " : "  )

◆ comma()

const string comma ( ,
 
)

◆ host()

const string host ( "\t\  )

◆ metadata()

const string metadata ( "\adata\  )

◆ 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 vector. 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 ( "\ql_server\  )

◆ name()

const string name ( "\e\  )

◆ open_brace()

const string open_brace ( )

◆ static_section()

const string static_section ( "\ql_server_static_options\  )

◆ timestamp()

const string timestamp ( "\estamp\  )

◆ user()

const string user ( "\r\  )

◆ value()

const string value ( "\ue\  )

◆ version()

const string version ( "\sion\  )

Variable Documentation

◆ all_options

PSI_memory_info all_options[]
static
Initial value:
= {
{&key_memory_persisted_variables, "persisted_options_root", 0,
#define PSI_FLAG_ONLY_GLOBAL_STAT
Global stat only flag.
Definition: psi_base.h:105
#define PSI_DOCUMENT_ME
Definition: psi_base.h:46
PSI_memory_key key_memory_persisted_variables
Definition: persisted_variable.cc:121

◆ all_persist_files

PSI_file_info all_persist_files[]
static
Initial value:
= {
PSI_file_key key_persist_file_cnf
Definition: persisted_variable.cc:105
#define PSI_DOCUMENT_ME
Definition: psi_base.h:46

◆ 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_variables
Definition: persisted_variable.cc:112
#define PSI_DOCUMENT_ME
Definition: psi_base.h:46
PSI_mutex_key key_persist_file
Definition: persisted_variable.cc:112

◆ 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