MySQL  8.0.18
Source Code Documentation
sql_servers.cc File Reference
#include "sql/sql_servers.h"
#include <stdlib.h>
#include <string.h>
#include <atomic>
#include <memory>
#include <string>
#include <unordered_map>
#include <utility>
#include "m_ctype.h"
#include "m_string.h"
#include "map_helpers.h"
#include "my_alloc.h"
#include "my_base.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_loglevel.h"
#include "my_macros.h"
#include "my_psi_config.h"
#include "my_sys.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/components/services/mysql_rwlock_bits.h"
#include "mysql/components/services/psi_memory_bits.h"
#include "mysql/components/services/psi_rwlock_bits.h"
#include "mysql/psi/mysql_memory.h"
#include "mysql/psi/mysql_mutex.h"
#include "mysql/psi/mysql_rwlock.h"
#include "mysql/psi/psi_base.h"
#include "mysqld_error.h"
#include "sql/auth/auth_acls.h"
#include "sql/auth/auth_common.h"
#include "sql/field.h"
#include "sql/handler.h"
#include "sql/psi_memory_key.h"
#include "sql/records.h"
#include "sql/row_iterator.h"
#include "sql/sql_backup_lock.h"
#include "sql/sql_base.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_error.h"
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/thd_raii.h"
#include "sql/thr_malloc.h"
#include "sql/transaction.h"
#include "thr_lock.h"

Enumerations

enum  enum_servers_table_field {
  SERVERS_FIELD_NAME = 0, SERVERS_FIELD_HOST, SERVERS_FIELD_DB, SERVERS_FIELD_USERNAME,
  SERVERS_FIELD_PASSWORD, SERVERS_FIELD_PORT, SERVERS_FIELD_SOCKET, SERVERS_FIELD_SCHEME,
  SERVERS_FIELD_OWNER
}
 This enum describes the structure of the mysql.servers table. More...
 

Functions

static bool get_server_from_table_to_cache (TABLE *table)
 
static void init_servers_cache_psi_keys (void)
 
bool servers_init (bool dont_read_servers_table)
 
static bool servers_load (THD *thd, TABLE *table)
 
bool servers_reload (THD *thd)
 
static bool close_cached_connection_tables (THD *thd, const char *connection_string, size_t connection_length)
 Close all tables which match specified connection string or if specified string is NULL, then any table with a connection string. More...
 
static void store_new_field (TABLE *table, enum_servers_table_field field, const LEX_STRING *val)
 Helper function for creating a record for inserting a new server into the mysql.servers table. More...
 
static void store_updated_field (TABLE *table, enum_servers_table_field field, const char *existing_val, const LEX_STRING *new_val)
 Helper function for creating a record for updating an existing server in the mysql.servers table. More...
 
void servers_free (bool end)
 
static FOREIGN_SERVERclone_server (MEM_ROOT *mem, const FOREIGN_SERVER *server, FOREIGN_SERVER *buffer)
 
FOREIGN_SERVERget_server_by_name (MEM_ROOT *mem, const char *server_name, FOREIGN_SERVER *buff)
 

Variables

static collation_unordered_map< std::string, FOREIGN_SERVER * > * servers_cache
 
static MEM_ROOT mem
 
static mysql_rwlock_t THR_LOCK_servers
 
static PSI_rwlock_key key_rwlock_THR_LOCK_servers
 
static PSI_rwlock_info all_servers_cache_rwlocks []
 
static PSI_memory_info all_servers_cache_memory []
 

Enumeration Type Documentation

◆ enum_servers_table_field

This enum describes the structure of the mysql.servers table.

Enumerator
SERVERS_FIELD_NAME 
SERVERS_FIELD_HOST 
SERVERS_FIELD_DB 
SERVERS_FIELD_USERNAME 
SERVERS_FIELD_PASSWORD 
SERVERS_FIELD_PORT 
SERVERS_FIELD_SOCKET 
SERVERS_FIELD_SCHEME 
SERVERS_FIELD_OWNER 

Function Documentation

◆ clone_server()

static FOREIGN_SERVER* clone_server ( MEM_ROOT mem,
const FOREIGN_SERVER server,
FOREIGN_SERVER buffer 
)
static

◆ close_cached_connection_tables()

static bool close_cached_connection_tables ( THD thd,
const char *  connection_string,
size_t  connection_length 
)
static

Close all tables which match specified connection string or if specified string is NULL, then any table with a connection string.

◆ get_server_by_name()

FOREIGN_SERVER* get_server_by_name ( MEM_ROOT mem,
const char *  server_name,
FOREIGN_SERVER buff 
)

◆ get_server_from_table_to_cache()

static bool get_server_from_table_to_cache ( TABLE table)
static

◆ init_servers_cache_psi_keys()

static void init_servers_cache_psi_keys ( void  )
static

◆ servers_free()

void servers_free ( bool  end)

◆ servers_init()

bool servers_init ( bool  dont_read_servers_table)

◆ servers_load()

static bool servers_load ( THD thd,
TABLE table 
)
static

◆ servers_reload()

bool servers_reload ( THD thd)

◆ store_new_field()

static void store_new_field ( TABLE table,
enum_servers_table_field  field,
const LEX_STRING val 
)
inlinestatic

Helper function for creating a record for inserting a new server into the mysql.servers table.

Set a field to the given parser string. If the parser string is empty, set the field to "" instead.

◆ store_updated_field()

static void store_updated_field ( TABLE table,
enum_servers_table_field  field,
const char *  existing_val,
const LEX_STRING new_val 
)
inlinestatic

Helper function for creating a record for updating an existing server in the mysql.servers table.

Set a field to the given parser string unless the parser string is empty or equal to the existing value.

Variable Documentation

◆ all_servers_cache_memory

PSI_memory_info all_servers_cache_memory[]
static
Initial value:
= {
PSI_memory_key key_memory_servers
Definition: psi_memory_key.cc:145
#define PSI_FLAG_ONLY_GLOBAL_STAT
Global stat only flag.
Definition: psi_base.h:105
#define PSI_DOCUMENT_ME
Definition: psi_base.h:46

◆ all_servers_cache_rwlocks

PSI_rwlock_info all_servers_cache_rwlocks[]
static
Initial value:
= {
#define PSI_FLAG_SINGLETON
Singleton flag.
Definition: psi_base.h:54
static PSI_rwlock_key key_rwlock_THR_LOCK_servers
Definition: sql_servers.cc:118
#define PSI_DOCUMENT_ME
Definition: psi_base.h:46

◆ key_rwlock_THR_LOCK_servers

PSI_rwlock_key key_rwlock_THR_LOCK_servers
static

◆ mem

MEM_ROOT mem
static

◆ servers_cache

collation_unordered_map<std::string, FOREIGN_SERVER *>* servers_cache
static

◆ THR_LOCK_servers

mysql_rwlock_t THR_LOCK_servers
static