MySQL  8.0.19
Source Code Documentation
srv0srv.cc File Reference
#include <mysqld.h>
#include <sys/types.h>
#include <time.h>
#include <chrono>
#include "btr0sea.h"
#include "buf0flu.h"
#include "buf0lru.h"
#include "clone0api.h"
#include "dict0boot.h"
#include "dict0load.h"
#include "dict0stats_bg.h"
#include "fsp0sysspace.h"
#include "ha_prototypes.h"
#include "ibuf0ibuf.h"
#include "lock0lock.h"
#include "log0recv.h"
#include "mem0mem.h"
#include "my_compiler.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_psi_config.h"
#include "os0proc.h"
#include "os0thread-create.h"
#include "pars0pars.h"
#include "que0que.h"
#include "row0mysql.h"
#include "sql_thd_internal_api.h"
#include "srv0mon.h"
#include "srv0srv.h"
#include "srv0start.h"
#include "sync0sync.h"
#include "trx0i_s.h"
#include "trx0purge.h"
#include "usr0sess.h"
#include "ut0crc32.h"
#include "ut0mem.h"

Classes

struct  srv_sys_t
 The server system struct. More...
 

Macros

#define MAX_MUTEX_NOWAIT   20
 Maximum number of times allowed to conditionally acquire mutex before switching to blocking wait on the mutex. More...
 
#define MUTEX_NOWAIT(mutex_skipped)   ((mutex_skipped) < MAX_MUTEX_NOWAIT)
 Check whether the number of failed nonblocking mutex acquisition attempts exceeds maximum allowed value. More...
 
#define SRV_MASTER_DICT_LRU_INTERVAL   (47)
 
#define srv_sys_mutex_enter()
 Acquire the system_mutex. More...
 
#define srv_sys_mutex_own()   (mutex_own(&srv_sys->mutex) && !srv_read_only_mode)
 Test if the system mutex is owned. More...
 
#define srv_sys_mutex_exit()
 Release the system mutex. More...
 

Functions

static void srv_print_master_thread_info (FILE *file)
 Prints counters for work done by srv_master_thread. More...
 
void srv_set_io_thread_op_info (ulint i, const char *str)
 Sets the info describing an i/o thread current state. More...
 
void srv_reset_io_thread_op_info ()
 Resets the info describing an i/o thread current state. More...
 
static ibool srv_thread_type_validate (srv_thread_type type)
 Validates the type of a thread table slot. More...
 
static srv_thread_type srv_slot_get_type (const srv_slot_t *slot)
 Gets the type of a thread table slot. More...
 
static srv_slot_tsrv_reserve_slot (srv_thread_type type)
 Reserves a slot in the thread table for the current thread. More...
 
static int64_t srv_suspend_thread_low (srv_slot_t *slot)
 Suspends the calling thread to wait for the event in its thread slot. More...
 
static int64_t srv_suspend_thread (srv_slot_t *slot)
 Suspends the calling thread to wait for the event in its thread slot. More...
 
ulint srv_release_threads (srv_thread_type type, ulint n)
 Releases threads of the type given from suspension in the thread table. More...
 
static void srv_free_slot (srv_slot_t *slot)
 Release a thread's slot. More...
 
static void srv_init (void)
 Initializes the server. More...
 
void srv_free (void)
 Frees the data structures created in srv_init(). More...
 
static void srv_general_init ()
 Initializes the synchronization primitives, memory system, and the thread local storage. More...
 
void srv_boot (void)
 Boots the InnoDB server. More...
 
static void srv_refresh_innodb_monitor_stats (void)
 Refreshes the values used to calculate per-second averages. More...
 
ibool srv_printf_innodb_monitor (FILE *file, ibool nowait, ulint *trx_start_pos, ulint *trx_end)
 Outputs to a file the output of the InnoDB Monitor. More...
 
void srv_export_innodb_status (void)
 Function to pass InnoDB status variables to MySQL. More...
 
void srv_monitor_thread ()
 A thread which prints the info output by various InnoDB monitors. More...
 
void srv_error_monitor_thread ()
 A thread which prints warnings about semaphore waits which have lasted too long. More...
 
void srv_inc_activity_count (void)
 Increment the server activity count. More...
 
bool srv_master_thread_is_active ()
 Check whether the master thread is active. More...
 
void srv_active_wake_master_thread_low ()
 Tells the InnoDB server that there has been activity in the database and wakes up the master thread if it is suspended (not sleeping). More...
 
void srv_wake_purge_thread_if_not_active (void)
 Tells the purge thread that there has been activity in the database and wakes up the purge thread if it is suspended (not sleeping). More...
 
void srv_wake_master_thread (void)
 Wakes up the master thread if it is suspended or being suspended. More...
 
ulint srv_get_activity_count (void)
 Get current server activity count. More...
 
ibool srv_check_activity (ulint old_activity_count)
 Check if there has been any activity. More...
 
static ulint srv_master_evict_from_table_cache (ulint pct_check)
 Make room in the table cache by evicting an unused table. More...
 
static void srv_shutdown_print_master_pending (ib_time_monotonic_t *last_print_time, ulint n_tables_to_drop, ulint n_bytes_merged)
 This function prints progress message every 60 seconds during server shutdown, for any activities that master thread is pending on. More...
 
static void srv_master_do_disabled_loop (void)
 Waits in loop as long as master thread is disabled (debug) More...
 
void srv_master_thread_disabled_debug_update (THD *thd, SYS_VAR *var, void *var_ptr, const void *save)
 Disables master thread. More...
 
static int64_t timeval_diff_us (timeval a, timeval b)
 Calculates difference between two timeval values. More...
 
static void srv_update_cpu_usage ()
 
static void srv_master_do_active_tasks (void)
 Perform the tasks that the master thread is supposed to do when the server is active. More...
 
static void srv_master_do_idle_tasks (void)
 Perform the tasks that the master thread is supposed to do whenever the server is idle. More...
 
static ibool srv_master_do_shutdown_tasks (ib_time_monotonic_t *last_print_time)
 Perform the tasks during shutdown. More...
 
void undo_rotate_default_master_key ()
 Rotate default master key for UNDO tablespace. More...
 
bool srv_enable_redo_encryption (bool is_boot)
 Enable REDO log encryption. More...
 
bool set_undo_tablespace_encryption (space_id_t space_id, mtr_t *mtr, bool is_boot)
 Set encryption for UNDO tablespace with given space id. More...
 
bool srv_enable_undo_encryption (bool is_boot)
 Enable UNDO tablespaces encryption. More...
 
static void srv_master_sleep (void)
 Puts master thread to sleep. More...
 
static void srv_sys_check_set_encryption ()
 Check redo and undo log encryption and rotate default master key. More...
 
void srv_master_thread ()
 The master thread controlling the server. More...
 
static bool srv_purge_should_exit (ulint n_purged)
 Check if purge should stop. More...
 
static bool srv_task_execute (void)
 Fetch and execute a task from the work queue. More...
 
void srv_worker_thread ()
 Worker thread that reads tasks from the work queue and executes them. More...
 
static ulint srv_do_purge (ulint *n_total_purged)
 Do the actual purge operation. More...
 
static void srv_purge_coordinator_suspend (srv_slot_t *slot, ulint rseg_history_len)
 Suspend the purge coordinator thread. More...
 
void srv_purge_coordinator_thread ()
 Purge coordinator thread that schedules the purge tasks. More...
 
void srv_que_task_enqueue_low (que_thr_t *thr)
 Enqueues a task to server task queue and releases a worker thread, if there is a suspended one. More...
 
ulint srv_get_task_queue_length (void)
 Get count of tasks in the queue. More...
 
void srv_purge_wakeup (void)
 Wakeup the purge threads. More...
 
bool srv_purge_threads_active ()
 Check if the purge threads are active, both coordinator and worker threads. More...
 
bool srv_thread_is_active (const IB_thread &thread)
 Check if given thread is still active. More...
 
const char * srv_get_server_errmsgs (int errcode)
 Get the format string for the logger. More...
 

Variables

Srv_threads srv_threads
 Structure with state of srv background threads. More...
 
Srv_cpu_usage srv_cpu_usage
 Structure with cpu usage information. More...
 
bool srv_downgrade_partition_files = false
 
ulong srv_fatal_semaphore_wait_threshold = 600
 
ulint srv_dml_needed_delay = 0
 
const char * srv_main_thread_op_info = ""
 
char * srv_data_home = NULL
 
char * srv_innodb_directories = NULL
 
char * srv_undo_dir = NULL
 Undo tablespace directories. More...
 
ulong srv_undo_tablespaces = FSP_IMPLICIT_UNDO_TABLESPACES
 The number of implicit undo tablespaces to use for rollback segments. More...
 
ulong srv_rollback_segments = TRX_SYS_N_RSEGS
 The number of rollback segments per tablespace. More...
 
ulong srv_undo_logs = 0
 
const char * deprecated_undo_logs
 
ulong srv_purge_rseg_truncate_frequency = 128
 Rate at which UNDO records should be purged. More...
 
bool srv_undo_log_truncate = FALSE
 Enable or Disable Truncate of UNDO tablespace. More...
 
bool srv_undo_log_encrypt = FALSE
 Enable or disable Encrypt of UNDO tablespace. More...
 
unsigned long long srv_max_undo_tablespace_size
 Maximum size of undo tablespace. More...
 
const page_no_t SRV_UNDO_TABLESPACE_SIZE_IN_PAGES
 Default undo tablespace size in UNIV_PAGEs count (10MB). More...
 
bool srv_read_only_mode
 Set if InnoDB must operate in read-only mode. More...
 
bool srv_file_per_table
 store to its own file each table created by an user; data dictionary tables are in the system tablespace 0 More...
 
ulong srv_sort_buf_size = 1048576
 Sort buffer size in index creation. More...
 
unsigned long long srv_online_max_size
 Maximum modification log file size for online index creation. More...
 
bool high_level_read_only
 Set if InnoDB operates in read-only mode or innodb-force-recovery is greater than SRV_FORCE_NO_TRX_UNDO. More...
 
ulong srv_parallel_read_threads
 Number of threads to use for parallel reads. More...
 
bool srv_use_native_aio
 
bool srv_numa_interleave = FALSE
 
ulong srv_debug_compress
 Force all user tables to use page compression. More...
 
bool innodb_calling_exit
 Set when InnoDB has invoked exit(). More...
 
bool srv_master_thread_disabled_debug
 Used by SET GLOBAL innodb_master_thread_disabled_debug = X. More...
 
static os_event_t srv_master_thread_disabled_event
 Event used to inform that master thread is disabled. More...
 
char * srv_log_group_home_dir = NULL
 
bool srv_redo_log_encrypt = false
 Enable or disable Encrypt of REDO tablespace. More...
 
ulong srv_n_log_files = SRV_N_LOG_FILES_MAX
 
ulonglong srv_log_file_size
 At startup, this is the current redo log file size. More...
 
ulonglong srv_log_file_size_requested
 The value of the startup parameter innodb_log_file_size. More...
 
ulong srv_log_buffer_size
 Space for log buffer, expressed in bytes. More...
 
ulong srv_log_write_ahead_size
 Size of block, used for writing ahead to avoid read-on-write. More...
 
uint srv_log_spin_cpu_abs_lwm
 Minimum absolute value of cpu time for which spin-delay is used. More...
 
uint srv_log_spin_cpu_pct_hwm
 Maximum percentage of cpu time for which spin-delay is used. More...
 
ulong srv_log_wait_for_flush_spin_hwm
 Maximum value of average log flush time for which spin-delay is used. More...
 
ulong srv_log_write_max_size = INNODB_LOG_WRITE_MAX_SIZE_DEFAULT
 When log writer follows links in the log recent written buffer, it stops when it has reached at least that many bytes to write, limiting how many bytes can be written in single call. More...
 
ulong srv_log_write_events = INNODB_LOG_EVENTS_DEFAULT
 Number of events used for notifications about redo write. More...
 
ulong srv_log_flush_events = INNODB_LOG_EVENTS_DEFAULT
 Number of events used for notifications about redo flush. More...
 
ulong srv_log_recent_written_size = INNODB_LOG_RECENT_WRITTEN_SIZE_DEFAULT
 Number of slots in a small buffer, which is used to allow concurrent writes to log buffer. More...
 
ulong srv_log_recent_closed_size = INNODB_LOG_RECENT_CLOSED_SIZE_DEFAULT
 Number of slots in a small buffer, which is used to break requirement for total order of dirty pages, when they are added to flush lists. More...
 
ulong srv_log_wait_for_write_spin_delay
 Number of spin iterations, when spinning and waiting for log buffer written up to given LSN, before we fallback to loop with sleeps. More...
 
ulong srv_log_wait_for_write_timeout
 Timeout used when waiting for redo write (microseconds). More...
 
ulong srv_log_wait_for_flush_spin_delay
 Number of spin iterations, when spinning and waiting for log flushed. More...
 
ulong srv_log_wait_for_flush_timeout
 Timeout used when waiting for redo flush (microseconds). More...
 
ulong srv_log_writer_spin_delay = INNODB_LOG_WRITER_SPIN_DELAY_DEFAULT
 Number of spin iterations, for which log writer thread is waiting for new data to write or flush without sleeping. More...
 
ulong srv_log_writer_timeout = INNODB_LOG_WRITER_TIMEOUT_DEFAULT
 Initial timeout used to wait on writer_event. More...
 
ulong srv_log_checkpoint_every = INNODB_LOG_CHECKPOINT_EVERY_DEFAULT
 Number of milliseconds every which a periodical checkpoint is written by the log checkpointer thread (unless periodical checkpoints are disabled, which is a case during initial phase of startup). More...
 
ulong srv_log_flusher_spin_delay = INNODB_LOG_FLUSHER_SPIN_DELAY_DEFAULT
 Number of spin iterations, for which log flusher thread is waiting for new data to flush, without sleeping. More...
 
ulong srv_log_flusher_timeout = INNODB_LOG_FLUSHER_TIMEOUT_DEFAULT
 Initial timeout used to wait on flusher_event. More...
 
ulong srv_log_write_notifier_spin_delay
 Number of spin iterations, for which log write notifier thread is waiting for advanced flushed_to_disk_lsn without sleeping. More...
 
ulong srv_log_write_notifier_timeout
 Initial timeout used to wait on write_notifier_event. More...
 
ulong srv_log_flush_notifier_spin_delay
 Number of spin iterations, for which log flush notifier thread is waiting for advanced flushed_to_disk_lsn without sleeping. More...
 
ulong srv_log_flush_notifier_timeout
 Initial timeout used to wait on flush_notifier_event. More...
 
ulong srv_log_closer_spin_delay = INNODB_LOG_CLOSER_SPIN_DELAY_DEFAULT
 Number of spin iterations, for which log closerr thread is waiting for a reachable untraversed link in recent_closed. More...
 
ulong srv_log_closer_timeout = INNODB_LOG_CLOSER_TIMEOUT_DEFAULT
 Initial sleep used in log closer after spin delay is finished. More...
 
bool srv_log_checksums
 Whether to generate and require checksums on the redo log pages. More...
 
bool srv_checkpoint_disabled = false
 If true then disable checkpointing. More...
 
bool srv_inject_too_many_concurrent_trxs = false
 
ulong srv_flush_log_at_trx_commit = 1
 
uint srv_flush_log_at_timeout = 1
 
ulong srv_page_size = UNIV_PAGE_SIZE_DEF
 
ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF
 
page_size_t univ_page_size (0, 0, false)
 
bool srv_adaptive_flushing = TRUE
 
bool srv_flush_sync = TRUE
 
bool srv_dedicated_server = true
 Dedicated server setting. More...
 
ulint srv_buf_pool_size = ULINT_MAX
 Requested size in bytes. More...
 
const ulint srv_buf_pool_min_size = 5 * 1024 * 1024
 Minimum pool size in bytes. More...
 
const ulint srv_buf_pool_def_size = 128 * 1024 * 1024
 Default pool size in bytes. More...
 
const longlong srv_buf_pool_max_size = LLONG_MAX
 Maximum pool size in bytes. More...
 
ulonglong srv_buf_pool_chunk_unit
 Requested buffer pool chunk size. More...
 
const ulonglong srv_buf_pool_chunk_unit_min = (1024 * 1024)
 Minimum buffer pool chunk size. More...
 
const ulonglong srv_buf_pool_chunk_unit_blk_sz = (1024 * 1024)
 The buffer pool chunk size must be a multiple of this number. More...
 
const ulonglong srv_buf_pool_chunk_unit_max
 Maximum buffer pool chunk size. More...
 
ulong srv_buf_pool_instances
 Requested number of buffer pool instances. More...
 
const ulong srv_buf_pool_instances_default = 0
 Default number of buffer pool instances. More...
 
ulong srv_n_page_hash_locks = 16
 Number of locks to protect buf_pool->page_hash. More...
 
ulong srv_LRU_scan_depth = 1024
 Scan depth for LRU flush batch i.e. More...
 
ulong srv_flush_neighbors = 1
 Whether or not to flush neighbors of a block. More...
 
ulint srv_buf_pool_old_size = 0
 Previously requested size. More...
 
ulint srv_buf_pool_base_size = 0
 Current size as scaling factor for the other components. More...
 
long long srv_buf_pool_curr_size = 0
 Current size in bytes. More...
 
ulong srv_buf_pool_dump_pct
 Dump this % of each buffer pool during BP dump. More...
 
ulint srv_lock_table_size = ULINT_MAX
 Lock table size in bytes. More...
 
const ulong srv_idle_flush_pct_default = 100
 Default value of srv_idle_flush_pct. More...
 
ulong srv_idle_flush_pct = srv_idle_flush_pct_default
 How much flush to be done in case of server is idle. More...
 
ulong srv_n_read_io_threads
 
ulong srv_n_write_io_threads
 
bool srv_random_read_ahead = FALSE
 
ulong srv_read_ahead_threshold = 56
 
uint srv_change_buffer_max_size = CHANGE_BUFFER_DEFAULT_SIZE
 Maximum on-disk size of change buffer in terms of percentage of the buffer pool. More...
 
enum srv_unix_flush_t srv_unix_file_flush_method = SRV_UNIX_FSYNC
 
ulint srv_max_n_open_files = 300
 
ulong srv_io_capacity = 200
 
ulong srv_max_io_capacity = 400
 
ulong srv_n_page_cleaners = 4
 
double srv_max_buf_pool_modified_pct = 75.0
 
double srv_max_dirty_pages_pct_lwm = 0.0
 
ulong srv_adaptive_flushing_lwm = 10
 
ulong srv_flushing_avg_loops = 30
 
ulong srv_n_purge_threads = 4
 
ulong srv_purge_batch_size = 20
 
ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL
 
srv_stats_t srv_stats
 Global counters. More...
 
export_var_t export_vars
 Status variables to be passed to MySQL. More...
 
ulong srv_force_recovery
 Normally 0. More...
 
ulong srv_force_recovery_crash
 Inject a crash at different steps of the recovery process. More...
 
bool srv_print_all_deadlocks = FALSE
 Print all user-level transactions deadlocks to mysqld stderr. More...
 
bool srv_print_ddl_logs = false
 Print all DDL logs to mysqld stderr. More...
 
bool srv_cmp_per_index_enabled = FALSE
 Enable INFORMATION_SCHEMA.innodb_cmp_per_index. More...
 
ulong srv_fast_shutdown
 The value of the configuration parameter innodb_fast_shutdown, controlling the InnoDB shutdown. More...
 
ibool srv_innodb_status = FALSE
 
unsigned long long srv_stats_transient_sample_pages = 8
 
bool srv_stats_persistent = TRUE
 
bool srv_stats_include_delete_marked = FALSE
 
unsigned long long srv_stats_persistent_sample_pages = 20
 
bool srv_stats_auto_recalc = TRUE
 
ibool srv_use_doublewrite_buf = TRUE
 
ulong srv_doublewrite_batch_size = 120
 doublewrite buffer is 1MB is size i.e. More...
 
ulong srv_replication_delay = 0
 
ulong srv_n_spin_wait_rounds = 30
 
ulong srv_spin_wait_delay = 6
 
ibool srv_priority_boost = TRUE
 
static ulint srv_n_rows_inserted_old = 0
 
static ulint srv_n_rows_updated_old = 0
 
static ulint srv_n_rows_deleted_old = 0
 
static ulint srv_n_rows_read_old = 0
 
static ulint srv_n_system_rows_inserted_old = 0
 
static ulint srv_n_system_rows_updated_old = 0
 
static ulint srv_n_system_rows_deleted_old = 0
 
static ulint srv_n_system_rows_read_old = 0
 
ulint srv_truncated_status_writes = 0
 
bool srv_print_innodb_monitor = FALSE
 
bool srv_print_innodb_lock_monitor = FALSE
 
const char * srv_io_thread_op_info [SRV_MAX_N_IO_THREADS]
 
const char * srv_io_thread_function [SRV_MAX_N_IO_THREADS]
 
static ib_time_monotonic_t srv_last_monitor_time
 
static ib_mutex_t srv_innodb_monitor_mutex
 
ib_mutex_t page_zip_stat_per_index_mutex
 Mutex protecting page_zip_stat_per_index. More...
 
ib_mutex_t srv_monitor_file_mutex
 
FILE * srv_monitor_file
 Temporary file for innodb monitor output. More...
 
ib_mutex_t srv_misc_tmpfile_mutex
 Mutex for locking srv_misc_tmpfile. More...
 
FILE * srv_misc_tmpfile
 Temporary file for miscellanous diagnostic output. More...
 
static ulint srv_main_thread_process_no = 0
 
static os_thread_id_t srv_main_thread_id = 0
 
static ulint srv_main_active_loops = 0
 Iterations of the loop bounded by 'srv_active' label. More...
 
static ulint srv_main_idle_loops = 0
 Iterations of the loop bounded by the 'srv_idle' label. More...
 
static ulint srv_main_shutdown_loops = 0
 Iterations of the loop bounded by the 'srv_shutdown' label. More...
 
static ulint srv_log_writes_and_flush = 0
 Log writes involving flush. More...
 
static srv_sys_tsrv_sys = NULL
 
os_event_t srv_monitor_event
 Event to signal the monitor thread. More...
 
os_event_t srv_error_event
 Event to signal the error thread. More...
 
os_event_t srv_buf_dump_event
 Event to signal the buffer pool dump/load thread. More...
 
os_event_t srv_buf_resize_event
 Event to signal the buffer pool resize thread. More...
 
char * srv_buf_dump_filename
 The buffer pool dump/load file name. More...
 
bool srv_buffer_pool_dump_at_shutdown = true
 Boolean config knobs that tell InnoDB to dump the buffer pool at shutdown and/or load it during startup. More...
 
bool srv_buffer_pool_load_at_startup = true
 
static const ulint SRV_PURGE_SLOT = 1
 Slot index in the srv_sys->sys_threads array for the purge thread. More...
 
static const ulint SRV_MASTER_SLOT = 0
 Slot index in the srv_sys->sys_threads array for the master thread. More...
 
PSI_stage_info srv_stage_alter_table_end
 Performance schema stage event for monitoring ALTER TABLE progress everything after flush log_make_latest_checkpoint(). More...
 
PSI_stage_info srv_stage_alter_table_flush
 Performance schema stage event for monitoring ALTER TABLE progress log_make_latest_checkpoint(). More...
 
PSI_stage_info srv_stage_alter_table_insert
 Performance schema stage event for monitoring ALTER TABLE progress row_merge_insert_index_tuples(). More...
 
PSI_stage_info srv_stage_alter_table_log_index
 Performance schema stage event for monitoring ALTER TABLE progress row_log_apply(). More...
 
PSI_stage_info srv_stage_alter_table_log_table
 Performance schema stage event for monitoring ALTER TABLE progress row_log_table_apply(). More...
 
PSI_stage_info srv_stage_alter_table_merge_sort
 Performance schema stage event for monitoring ALTER TABLE progress row_merge_sort(). More...
 
PSI_stage_info srv_stage_alter_table_read_pk_internal_sort
 Performance schema stage event for monitoring ALTER TABLE progress row_merge_read_clustered_index(). More...
 
PSI_stage_info srv_stage_alter_tablespace_encryption
 Performance schema stage event for monitoring ALTER TABLESPACE ENCRYPTION progress. More...
 
PSI_stage_info srv_stage_buffer_pool_load
 Performance schema stage event for monitoring buffer pool load progress. More...
 
PSI_stage_info srv_stage_clone_file_copy
 Performance schema stage event for monitoring clone file copy progress. More...
 
PSI_stage_info srv_stage_clone_redo_copy
 Performance schema stage event for monitoring clone redo copy progress. More...
 
PSI_stage_info srv_stage_clone_page_copy
 Performance schema stage event for monitoring clone page copy progress. More...
 

Detailed Description

The database server main program

Created 10/8/1995 Heikki Tuuri

Macro Definition Documentation

◆ MAX_MUTEX_NOWAIT

#define MAX_MUTEX_NOWAIT   20

Maximum number of times allowed to conditionally acquire mutex before switching to blocking wait on the mutex.

◆ MUTEX_NOWAIT

#define MUTEX_NOWAIT (   mutex_skipped)    ((mutex_skipped) < MAX_MUTEX_NOWAIT)

Check whether the number of failed nonblocking mutex acquisition attempts exceeds maximum allowed value.

If so, srv_printf_innodb_monitor() will request mutex acquisition with mutex_enter(), which will wait until it gets the mutex.

◆ SRV_MASTER_DICT_LRU_INTERVAL

#define SRV_MASTER_DICT_LRU_INTERVAL   (47)

◆ srv_sys_mutex_enter

#define srv_sys_mutex_enter ( )
Value:
do { \
mutex_enter(&srv_sys->mutex); \
} while (0)

Acquire the system_mutex.

◆ srv_sys_mutex_exit

#define srv_sys_mutex_exit ( )
Value:
do { \
mutex_exit(&srv_sys->mutex); \
} while (0)

Release the system mutex.

◆ srv_sys_mutex_own

#define srv_sys_mutex_own ( )    (mutex_own(&srv_sys->mutex) && !srv_read_only_mode)

Test if the system mutex is owned.

Function Documentation

◆ set_undo_tablespace_encryption()

bool set_undo_tablespace_encryption ( space_id_t  space_id,
mtr_t mtr,
bool  is_boot 
)

Set encryption for UNDO tablespace with given space id.

Parameters
[in]space_idundo tablespace id
[in]mtrmini-transaction
[in]is_boottrue if it is called during server start up.
Returns
false for success, true otherwise

◆ srv_active_wake_master_thread_low()

void srv_active_wake_master_thread_low ( )

Tells the InnoDB server that there has been activity in the database and wakes up the master thread if it is suspended (not sleeping).

Tells the Innobase server that there has been activity in the database and wakes up the master thread if it is suspended (not sleeping).

Used in the MySQL interface. Note that there is a small chance that the master thread stays suspended (we do not protect our operation with the srv_sys_t->mutex, for performance reasons).

◆ srv_boot()

void srv_boot ( void  )

Boots the InnoDB server.

Boots Innobase server.

◆ srv_check_activity()

ibool srv_check_activity ( ulint  old_activity_count)

Check if there has been any activity.

Returns
false if no change in activity counter.
Parameters
old_activity_countin: old activity count

◆ srv_do_purge()

static ulint srv_do_purge ( ulint *  n_total_purged)
static

Do the actual purge operation.

Returns
length of history list before the last purge batch.
Parameters
n_total_purgedin/out: total pages purged

◆ srv_enable_redo_encryption()

bool srv_enable_redo_encryption ( bool  is_boot)

Enable REDO log encryption.

Parameters
[in]is_boottrue if it is called during server start up. In this case, default master key will be used which will be rotated later with actual master key from kyering.
Returns
false for success, true otherwise.

◆ srv_enable_undo_encryption()

bool srv_enable_undo_encryption ( bool  is_boot)

Enable UNDO tablespaces encryption.

Parameters
[in]is_boottrue if it is called during server start up. In this case, default master key will be used which will be rotated later with actual master key from kyering.
Returns
false for success, true otherwise.

◆ srv_error_monitor_thread()

void srv_error_monitor_thread ( )

A thread which prints warnings about semaphore waits which have lasted too long.

These can be used to track bugs which cause hangs.

◆ srv_export_innodb_status()

void srv_export_innodb_status ( void  )

Function to pass InnoDB status variables to MySQL.

◆ srv_free()

void srv_free ( void  )

Frees the data structures created in srv_init().

◆ srv_free_slot()

static void srv_free_slot ( srv_slot_t slot)
static

Release a thread's slot.

Parameters
slotin/out: thread slot

◆ srv_general_init()

static void srv_general_init ( )
static

Initializes the synchronization primitives, memory system, and the thread local storage.

◆ srv_get_activity_count()

ulint srv_get_activity_count ( void  )

Get current server activity count.

We don't hold srv_sys::mutex while reading this value as it is only used in heuristics.

Returns
activity count.

◆ srv_get_server_errmsgs()

const char* srv_get_server_errmsgs ( int  errcode)

Get the format string for the logger.

Parameters
[in]errcodeThe error code from share/errmsg-*.txt
Returns
the message string or nullptr

◆ srv_get_task_queue_length()

ulint srv_get_task_queue_length ( void  )

Get count of tasks in the queue.

Returns
number of tasks in queue

◆ srv_inc_activity_count()

void srv_inc_activity_count ( void  )

Increment the server activity count.

Increment the server activity counter.

◆ srv_init()

static void srv_init ( void  )
static

Initializes the server.

◆ srv_master_do_active_tasks()

static void srv_master_do_active_tasks ( void  )
static

Perform the tasks that the master thread is supposed to do when the server is active.

There are two types of tasks. The first category is of such tasks which are performed at each inovcation of this function. We assume that this function is called roughly every second when the server is active. The second category is of such tasks which are performed at some interval e.g.: purge, dict_LRU cleanup etc.

◆ srv_master_do_disabled_loop()

static void srv_master_do_disabled_loop ( void  )
static

Waits in loop as long as master thread is disabled (debug)

◆ srv_master_do_idle_tasks()

static void srv_master_do_idle_tasks ( void  )
static

Perform the tasks that the master thread is supposed to do whenever the server is idle.

We do check for the server state during this function and if the server has entered the shutdown phase we may return from the function without completing the required tasks. Note that the server can move to active state when we are executing this function but we don't check for that as we are suppose to perform more or less same tasks when server is active.

◆ srv_master_do_shutdown_tasks()

static ibool srv_master_do_shutdown_tasks ( ib_time_monotonic_t last_print_time)
static

Perform the tasks during shutdown.

The tasks that we do at shutdown depend on srv_fast_shutdown: 2 => very fast shutdown => do no book keeping 1 => normal shutdown => clear drop table queue and make checkpoint 0 => slow shutdown => in addition to above do complete purge and ibuf merge

Returns
true if some work was done. false otherwise
Parameters
last_print_timelast time the function print the message

◆ srv_master_evict_from_table_cache()

static ulint srv_master_evict_from_table_cache ( ulint  pct_check)
static

Make room in the table cache by evicting an unused table.

Returns
number of tables evicted.
Parameters
pct_checkin: max percent to check

◆ srv_master_sleep()

static void srv_master_sleep ( void  )
static

Puts master thread to sleep.

At this point we are using polling to service various activities. Master thread sleeps for one second before checking the state of the server again

◆ srv_master_thread()

void srv_master_thread ( )

The master thread controlling the server.

◆ srv_master_thread_disabled_debug_update()

void srv_master_thread_disabled_debug_update ( THD thd,
SYS_VAR var,
void *  var_ptr,
const void *  save 
)

Disables master thread.

It's used by: SET GLOBAL innodb_master_thread_disabled_debug = 1 (0).

Parameters
[in]thdthread handle
[in]varpointer to system variable
[out]var_ptrwhere the formal string goes
[in]saveimmediate result from check function

◆ srv_master_thread_is_active()

bool srv_master_thread_is_active ( )

Check whether the master thread is active.

This is polled during the final phase of shutdown. The first phase of server shutdown must have already been executed (or the server must not have been fully started up).

See also
srv_pre_dd_shutdown()
Return values
trueif any thread is active
falseif no thread is active

◆ srv_monitor_thread()

void srv_monitor_thread ( )

A thread which prints the info output by various InnoDB monitors.

◆ srv_print_master_thread_info()

static void srv_print_master_thread_info ( FILE *  file)
static

Prints counters for work done by srv_master_thread.

◆ srv_printf_innodb_monitor()

ibool srv_printf_innodb_monitor ( FILE *  file,
ibool  nowait,
ulint *  trx_start_pos,
ulint *  trx_end 
)

Outputs to a file the output of the InnoDB Monitor.

Returns
false if not all information printed due to failure to obtain necessary mutex
Parameters
filein: output stream
nowaitin: whether to wait for the lock_sys_t:: mutex
trx_start_posout: file position of the start of the list of active transactions
trx_endout: file position of the end of the list of active transactions

◆ srv_purge_coordinator_suspend()

static void srv_purge_coordinator_suspend ( srv_slot_t slot,
ulint  rseg_history_len 
)
static

Suspend the purge coordinator thread.

Maximum wait time on the purge event, in micro-seconds.

Parameters
slotin/out: Purge coordinator thread slot
rseg_history_lenin: history list length before last purge

◆ srv_purge_coordinator_thread()

void srv_purge_coordinator_thread ( )

Purge coordinator thread that schedules the purge tasks.

◆ srv_purge_should_exit()

static bool srv_purge_should_exit ( ulint  n_purged)
static

Check if purge should stop.

Returns
true if it should shutdown.
Parameters
n_purgedin: pages purged in last batch

◆ srv_purge_threads_active()

bool srv_purge_threads_active ( )

Check if the purge threads are active, both coordinator and worker threads.

Returns
true if any thread is active, false if no thread is active

◆ srv_purge_wakeup()

void srv_purge_wakeup ( void  )

Wakeup the purge threads.

◆ srv_que_task_enqueue_low()

void srv_que_task_enqueue_low ( que_thr_t thr)

Enqueues a task to server task queue and releases a worker thread, if there is a suspended one.

in: query thread

Parameters
thrin: query thread

◆ srv_refresh_innodb_monitor_stats()

static void srv_refresh_innodb_monitor_stats ( void  )
static

Refreshes the values used to calculate per-second averages.

◆ srv_release_threads()

ulint srv_release_threads ( srv_thread_type  type,
ulint  n 
)

Releases threads of the type given from suspension in the thread table.

NOTE! The server mutex has to be reserved by the caller!

Returns
number of threads released: this may be less than n if not enough threads were suspended at the moment.
Parameters
typein: thread type
nin: number of threads to release

◆ srv_reserve_slot()

static srv_slot_t* srv_reserve_slot ( srv_thread_type  type)
static

Reserves a slot in the thread table for the current thread.

Returns
reserved slot
Parameters
typein: type of the thread

◆ srv_reset_io_thread_op_info()

void srv_reset_io_thread_op_info ( )

Resets the info describing an i/o thread current state.

◆ srv_set_io_thread_op_info()

void srv_set_io_thread_op_info ( ulint  i,
const char *  str 
)

Sets the info describing an i/o thread current state.

in: constant char string describing the state

Parameters
iin: the 'segment' of the i/o thread
strin: constant char string describing the state

◆ srv_shutdown_print_master_pending()

static void srv_shutdown_print_master_pending ( ib_time_monotonic_t last_print_time,
ulint  n_tables_to_drop,
ulint  n_bytes_merged 
)
static

This function prints progress message every 60 seconds during server shutdown, for any activities that master thread is pending on.

Parameters
last_print_timelast time the function print the message
n_tables_to_dropnumber of tables to be dropped
n_bytes_mergednumber of change buffer just merged

◆ srv_slot_get_type()

static srv_thread_type srv_slot_get_type ( const srv_slot_t slot)
static

Gets the type of a thread table slot.

Returns
thread type
Parameters
slotin: thread slot

◆ srv_suspend_thread()

static int64_t srv_suspend_thread ( srv_slot_t slot)
static

Suspends the calling thread to wait for the event in its thread slot.

Returns
the current signal count of the event.
Parameters
slotin/out: thread slot

◆ srv_suspend_thread_low()

static int64_t srv_suspend_thread_low ( srv_slot_t slot)
static

Suspends the calling thread to wait for the event in its thread slot.

Returns
the current signal count of the event.
Parameters
slotin/out: thread slot

◆ srv_sys_check_set_encryption()

static void srv_sys_check_set_encryption ( )
static

Check redo and undo log encryption and rotate default master key.

◆ srv_task_execute()

static bool srv_task_execute ( void  )
static

Fetch and execute a task from the work queue.

Returns
true if a task was executed

◆ srv_thread_is_active()

bool srv_thread_is_active ( const IB_thread thread)

Check if given thread is still active.

◆ srv_thread_type_validate()

static ibool srv_thread_type_validate ( srv_thread_type  type)
static

Validates the type of a thread table slot.

Returns
true if ok
Parameters
typein: thread type

◆ srv_update_cpu_usage()

static void srv_update_cpu_usage ( )
static

◆ srv_wake_master_thread()

void srv_wake_master_thread ( void  )

Wakes up the master thread if it is suspended or being suspended.

◆ srv_wake_purge_thread_if_not_active()

void srv_wake_purge_thread_if_not_active ( void  )

Tells the purge thread that there has been activity in the database and wakes up the purge thread if it is suspended (not sleeping).

Note that there is a small chance that the purge thread stays suspended (we do not protect our check with the srv_sys_t:mutex and the purge_sys->latch, for performance reasons).

◆ srv_worker_thread()

void srv_worker_thread ( )

Worker thread that reads tasks from the work queue and executes them.

◆ timeval_diff_us()

static int64_t timeval_diff_us ( timeval  a,
timeval  b 
)
static

Calculates difference between two timeval values.

Parameters
[in]alater timeval
[in]bearlier timeval
Returns
a - b; number of microseconds between b and a

◆ undo_rotate_default_master_key()

void undo_rotate_default_master_key ( )

Rotate default master key for UNDO tablespace.

Variable Documentation

◆ deprecated_undo_logs

const char* deprecated_undo_logs
Initial value:
=
"The parameter innodb_undo_logs is deprecated"
" and may be removed in future releases."
" Please use innodb_rollback_segments instead."
" See " REFMAN "innodb-undo-logs.html"

◆ export_vars

export_var_t export_vars

Status variables to be passed to MySQL.

◆ high_level_read_only

bool high_level_read_only

Set if InnoDB operates in read-only mode or innodb-force-recovery is greater than SRV_FORCE_NO_TRX_UNDO.

◆ innodb_calling_exit

bool innodb_calling_exit

Set when InnoDB has invoked exit().

◆ page_zip_stat_per_index_mutex

ib_mutex_t page_zip_stat_per_index_mutex

Mutex protecting page_zip_stat_per_index.

◆ srv_adaptive_flushing

bool srv_adaptive_flushing = TRUE

◆ srv_adaptive_flushing_lwm

ulong srv_adaptive_flushing_lwm = 10

◆ srv_buf_dump_event

os_event_t srv_buf_dump_event

Event to signal the buffer pool dump/load thread.

The buffer pool dump/load thread waits on this event.

◆ srv_buf_dump_filename

char* srv_buf_dump_filename

The buffer pool dump/load file name.

◆ srv_buf_pool_base_size

ulint srv_buf_pool_base_size = 0

Current size as scaling factor for the other components.

◆ srv_buf_pool_chunk_unit

ulonglong srv_buf_pool_chunk_unit

Requested buffer pool chunk size.

Each buffer pool instance consists of one or more chunks.

◆ srv_buf_pool_chunk_unit_blk_sz

const ulonglong srv_buf_pool_chunk_unit_blk_sz = (1024 * 1024)

The buffer pool chunk size must be a multiple of this number.

◆ srv_buf_pool_chunk_unit_max

const ulonglong srv_buf_pool_chunk_unit_max
Initial value:

Maximum buffer pool chunk size.

◆ srv_buf_pool_chunk_unit_min

const ulonglong srv_buf_pool_chunk_unit_min = (1024 * 1024)

Minimum buffer pool chunk size.

◆ srv_buf_pool_curr_size

long long srv_buf_pool_curr_size = 0

Current size in bytes.

◆ srv_buf_pool_def_size

const ulint srv_buf_pool_def_size = 128 * 1024 * 1024

Default pool size in bytes.

◆ srv_buf_pool_dump_pct

ulong srv_buf_pool_dump_pct

Dump this % of each buffer pool during BP dump.

◆ srv_buf_pool_instances

ulong srv_buf_pool_instances

Requested number of buffer pool instances.

◆ srv_buf_pool_instances_default

const ulong srv_buf_pool_instances_default = 0

Default number of buffer pool instances.

◆ srv_buf_pool_max_size

const longlong srv_buf_pool_max_size = LLONG_MAX

Maximum pool size in bytes.

◆ srv_buf_pool_min_size

const ulint srv_buf_pool_min_size = 5 * 1024 * 1024

Minimum pool size in bytes.

◆ srv_buf_pool_old_size

ulint srv_buf_pool_old_size = 0

Previously requested size.

Accesses protected by memory barriers.

◆ srv_buf_pool_size

ulint srv_buf_pool_size = ULINT_MAX

Requested size in bytes.

◆ srv_buf_resize_event

os_event_t srv_buf_resize_event

Event to signal the buffer pool resize thread.

The buffer pool resize thread waits on this event.

◆ srv_buffer_pool_dump_at_shutdown

bool srv_buffer_pool_dump_at_shutdown = true

Boolean config knobs that tell InnoDB to dump the buffer pool at shutdown and/or load it during startup.

◆ srv_buffer_pool_load_at_startup

bool srv_buffer_pool_load_at_startup = true

◆ srv_change_buffer_max_size

uint srv_change_buffer_max_size = CHANGE_BUFFER_DEFAULT_SIZE

Maximum on-disk size of change buffer in terms of percentage of the buffer pool.

◆ srv_checkpoint_disabled

bool srv_checkpoint_disabled = false

If true then disable checkpointing.

◆ srv_cmp_per_index_enabled

bool srv_cmp_per_index_enabled = FALSE

Enable INFORMATION_SCHEMA.innodb_cmp_per_index.

◆ srv_cpu_usage

Srv_cpu_usage srv_cpu_usage

Structure with cpu usage information.

◆ srv_data_home

char* srv_data_home = NULL

◆ srv_debug_compress

ulong srv_debug_compress

Force all user tables to use page compression.

◆ srv_dedicated_server

bool srv_dedicated_server = true

Dedicated server setting.

◆ srv_dml_needed_delay

ulint srv_dml_needed_delay = 0

◆ srv_doublewrite_batch_size

ulong srv_doublewrite_batch_size = 120

doublewrite buffer is 1MB is size i.e.

: it can hold 128 16K pages. The following parameter is the size of the buffer that is used for batch flushing i.e.: LRU flushing and flush_list flushing. The rest of the pages are used for single page flushing.

◆ srv_downgrade_partition_files

bool srv_downgrade_partition_files = false

◆ srv_error_event

os_event_t srv_error_event

Event to signal the error thread.

◆ srv_fast_shutdown

ulong srv_fast_shutdown

The value of the configuration parameter innodb_fast_shutdown, controlling the InnoDB shutdown.

If innodb_fast_shutdown=0, InnoDB shutdown will purge all undo log records (except XA PREPARE transactions) and complete the merge of the entire change buffer, and then shut down the redo log.

If innodb_fast_shutdown=1, InnoDB shutdown will only flush the buffer pool to data files, cleanly shutting down the redo log.

If innodb_fast_shutdown=2, shutdown will effectively 'crash' InnoDB (but lose no committed transactions).

◆ srv_fatal_semaphore_wait_threshold

ulong srv_fatal_semaphore_wait_threshold = 600

◆ srv_file_per_table

bool srv_file_per_table

store to its own file each table created by an user; data dictionary tables are in the system tablespace 0

◆ srv_flush_log_at_timeout

uint srv_flush_log_at_timeout = 1

◆ srv_flush_log_at_trx_commit

ulong srv_flush_log_at_trx_commit = 1

◆ srv_flush_neighbors

ulong srv_flush_neighbors = 1

Whether or not to flush neighbors of a block.

◆ srv_flush_sync

bool srv_flush_sync = TRUE

◆ srv_flushing_avg_loops

ulong srv_flushing_avg_loops = 30

◆ srv_force_recovery

ulong srv_force_recovery

Normally 0.

When nonzero, skip some phases of crash recovery, starting from SRV_FORCE_IGNORE_CORRUPT, so that data can be recovered by SELECT or mysqldump. When this is nonzero, we do not allow any user modifications to the data.

◆ srv_force_recovery_crash

ulong srv_force_recovery_crash

Inject a crash at different steps of the recovery process.

This is for testing and debugging only.

◆ srv_idle_flush_pct

ulong srv_idle_flush_pct = srv_idle_flush_pct_default

How much flush to be done in case of server is idle.

◆ srv_idle_flush_pct_default

const ulong srv_idle_flush_pct_default = 100

Default value of srv_idle_flush_pct.

◆ srv_inject_too_many_concurrent_trxs

bool srv_inject_too_many_concurrent_trxs = false

◆ srv_innodb_directories

char* srv_innodb_directories = NULL

◆ srv_innodb_monitor_mutex

ib_mutex_t srv_innodb_monitor_mutex
static

◆ srv_innodb_stats_method

ulong srv_innodb_stats_method = SRV_STATS_NULLS_EQUAL

◆ srv_innodb_status

ibool srv_innodb_status = FALSE

◆ srv_io_capacity

ulong srv_io_capacity = 200

◆ srv_io_thread_function

const char* srv_io_thread_function[SRV_MAX_N_IO_THREADS]

◆ srv_io_thread_op_info

const char* srv_io_thread_op_info[SRV_MAX_N_IO_THREADS]

◆ srv_last_monitor_time

ib_time_monotonic_t srv_last_monitor_time
static

◆ srv_lock_table_size

ulint srv_lock_table_size = ULINT_MAX

Lock table size in bytes.

◆ srv_log_buffer_size

ulong srv_log_buffer_size

Space for log buffer, expressed in bytes.

Note, that log buffer will use only the largest power of two, which is not greater than the assigned space.

◆ srv_log_checkpoint_every

ulong srv_log_checkpoint_every = INNODB_LOG_CHECKPOINT_EVERY_DEFAULT

Number of milliseconds every which a periodical checkpoint is written by the log checkpointer thread (unless periodical checkpoints are disabled, which is a case during initial phase of startup).

◆ srv_log_checksums

bool srv_log_checksums

Whether to generate and require checksums on the redo log pages.

◆ srv_log_closer_spin_delay

ulong srv_log_closer_spin_delay = INNODB_LOG_CLOSER_SPIN_DELAY_DEFAULT

Number of spin iterations, for which log closerr thread is waiting for a reachable untraversed link in recent_closed.

◆ srv_log_closer_timeout

ulong srv_log_closer_timeout = INNODB_LOG_CLOSER_TIMEOUT_DEFAULT

Initial sleep used in log closer after spin delay is finished.

◆ srv_log_file_size

ulonglong srv_log_file_size

At startup, this is the current redo log file size.

During startup, if this is different from srv_log_file_size_requested (innodb_log_file_size), the redo log will be rebuilt and this size will be initialized to srv_log_file_size_requested. When upgrading from a previous redo log format, this will be set to 0, and writing to the redo log is not allowed. Expressed in bytes.

◆ srv_log_file_size_requested

ulonglong srv_log_file_size_requested

The value of the startup parameter innodb_log_file_size.

◆ srv_log_flush_events

ulong srv_log_flush_events = INNODB_LOG_EVENTS_DEFAULT

Number of events used for notifications about redo flush.

◆ srv_log_flush_notifier_spin_delay

ulong srv_log_flush_notifier_spin_delay
Initial value:

Number of spin iterations, for which log flush notifier thread is waiting for advanced flushed_to_disk_lsn without sleeping.

◆ srv_log_flush_notifier_timeout

ulong srv_log_flush_notifier_timeout
Initial value:

Initial timeout used to wait on flush_notifier_event.

◆ srv_log_flusher_spin_delay

ulong srv_log_flusher_spin_delay = INNODB_LOG_FLUSHER_SPIN_DELAY_DEFAULT

Number of spin iterations, for which log flusher thread is waiting for new data to flush, without sleeping.

◆ srv_log_flusher_timeout

ulong srv_log_flusher_timeout = INNODB_LOG_FLUSHER_TIMEOUT_DEFAULT

Initial timeout used to wait on flusher_event.

◆ srv_log_group_home_dir

char* srv_log_group_home_dir = NULL

◆ srv_log_recent_closed_size

ulong srv_log_recent_closed_size = INNODB_LOG_RECENT_CLOSED_SIZE_DEFAULT

Number of slots in a small buffer, which is used to break requirement for total order of dirty pages, when they are added to flush lists.

The slots are addressed by LSN values modulo number of the slots.

◆ srv_log_recent_written_size

ulong srv_log_recent_written_size = INNODB_LOG_RECENT_WRITTEN_SIZE_DEFAULT

Number of slots in a small buffer, which is used to allow concurrent writes to log buffer.

The slots are addressed by LSN values modulo number of the slots.

◆ srv_log_spin_cpu_abs_lwm

uint srv_log_spin_cpu_abs_lwm

Minimum absolute value of cpu time for which spin-delay is used.

◆ srv_log_spin_cpu_pct_hwm

uint srv_log_spin_cpu_pct_hwm

Maximum percentage of cpu time for which spin-delay is used.

◆ srv_log_wait_for_flush_spin_delay

ulong srv_log_wait_for_flush_spin_delay
Initial value:

Number of spin iterations, when spinning and waiting for log flushed.

◆ srv_log_wait_for_flush_spin_hwm

ulong srv_log_wait_for_flush_spin_hwm

Maximum value of average log flush time for which spin-delay is used.

When flushing takes longer, user threads no longer spin when waiting for flushed redo. Expressed in microseconds.

◆ srv_log_wait_for_flush_timeout

ulong srv_log_wait_for_flush_timeout
Initial value:

Timeout used when waiting for redo flush (microseconds).

◆ srv_log_wait_for_write_spin_delay

ulong srv_log_wait_for_write_spin_delay
Initial value:

Number of spin iterations, when spinning and waiting for log buffer written up to given LSN, before we fallback to loop with sleeps.

This is not used when user thread has to wait for log flushed to disk.

◆ srv_log_wait_for_write_timeout

ulong srv_log_wait_for_write_timeout
Initial value:

Timeout used when waiting for redo write (microseconds).

◆ srv_log_write_ahead_size

ulong srv_log_write_ahead_size

Size of block, used for writing ahead to avoid read-on-write.

◆ srv_log_write_events

ulong srv_log_write_events = INNODB_LOG_EVENTS_DEFAULT

Number of events used for notifications about redo write.

◆ srv_log_write_max_size

ulong srv_log_write_max_size = INNODB_LOG_WRITE_MAX_SIZE_DEFAULT

When log writer follows links in the log recent written buffer, it stops when it has reached at least that many bytes to write, limiting how many bytes can be written in single call.

◆ srv_log_write_notifier_spin_delay

ulong srv_log_write_notifier_spin_delay
Initial value:

Number of spin iterations, for which log write notifier thread is waiting for advanced flushed_to_disk_lsn without sleeping.

Number of spin iterations, for which log write notifier thread is waiting for advanced writeed_to_disk_lsn without sleeping.

◆ srv_log_write_notifier_timeout

ulong srv_log_write_notifier_timeout
Initial value:

Initial timeout used to wait on write_notifier_event.

◆ srv_log_writer_spin_delay

ulong srv_log_writer_spin_delay = INNODB_LOG_WRITER_SPIN_DELAY_DEFAULT

Number of spin iterations, for which log writer thread is waiting for new data to write or flush without sleeping.

◆ srv_log_writer_timeout

ulong srv_log_writer_timeout = INNODB_LOG_WRITER_TIMEOUT_DEFAULT

Initial timeout used to wait on writer_event.

◆ srv_log_writes_and_flush

ulint srv_log_writes_and_flush = 0
static

Log writes involving flush.

◆ srv_LRU_scan_depth

ulong srv_LRU_scan_depth = 1024

Scan depth for LRU flush batch i.e.

: number of blocks scanned

◆ srv_main_active_loops

ulint srv_main_active_loops = 0
static

Iterations of the loop bounded by 'srv_active' label.

◆ srv_main_idle_loops

ulint srv_main_idle_loops = 0
static

Iterations of the loop bounded by the 'srv_idle' label.

◆ srv_main_shutdown_loops

ulint srv_main_shutdown_loops = 0
static

Iterations of the loop bounded by the 'srv_shutdown' label.

◆ srv_main_thread_id

os_thread_id_t srv_main_thread_id = 0
static

◆ srv_main_thread_op_info

const char* srv_main_thread_op_info = ""

◆ srv_main_thread_process_no

ulint srv_main_thread_process_no = 0
static

◆ SRV_MASTER_SLOT

const ulint SRV_MASTER_SLOT = 0
static

Slot index in the srv_sys->sys_threads array for the master thread.

◆ srv_master_thread_disabled_debug

bool srv_master_thread_disabled_debug

Used by SET GLOBAL innodb_master_thread_disabled_debug = X.

Value of MySQL global used to disable master thread.

◆ srv_master_thread_disabled_event

os_event_t srv_master_thread_disabled_event
static

Event used to inform that master thread is disabled.

◆ srv_max_buf_pool_modified_pct

double srv_max_buf_pool_modified_pct = 75.0

◆ srv_max_dirty_pages_pct_lwm

double srv_max_dirty_pages_pct_lwm = 0.0

◆ srv_max_io_capacity

ulong srv_max_io_capacity = 400

◆ srv_max_n_open_files

ulint srv_max_n_open_files = 300

◆ srv_max_undo_tablespace_size

unsigned long long srv_max_undo_tablespace_size

Maximum size of undo tablespace.

◆ srv_misc_tmpfile

FILE* srv_misc_tmpfile

Temporary file for miscellanous diagnostic output.

◆ srv_misc_tmpfile_mutex

ib_mutex_t srv_misc_tmpfile_mutex

Mutex for locking srv_misc_tmpfile.

Not created if srv_read_only_mode. This mutex has a very low rank; threads reserving it should not acquire any further latches or sleep before releasing this one.

◆ srv_monitor_event

os_event_t srv_monitor_event

Event to signal the monitor thread.

◆ srv_monitor_file

FILE* srv_monitor_file

Temporary file for innodb monitor output.

◆ srv_monitor_file_mutex

ib_mutex_t srv_monitor_file_mutex

◆ srv_n_log_files

ulong srv_n_log_files = SRV_N_LOG_FILES_MAX

◆ srv_n_page_cleaners

ulong srv_n_page_cleaners = 4

◆ srv_n_page_hash_locks

ulong srv_n_page_hash_locks = 16

Number of locks to protect buf_pool->page_hash.

◆ srv_n_purge_threads

ulong srv_n_purge_threads = 4

◆ srv_n_read_io_threads

ulong srv_n_read_io_threads

◆ srv_n_rows_deleted_old

ulint srv_n_rows_deleted_old = 0
static

◆ srv_n_rows_inserted_old

ulint srv_n_rows_inserted_old = 0
static

◆ srv_n_rows_read_old

ulint srv_n_rows_read_old = 0
static

◆ srv_n_rows_updated_old

ulint srv_n_rows_updated_old = 0
static

◆ srv_n_spin_wait_rounds

ulong srv_n_spin_wait_rounds = 30

◆ srv_n_system_rows_deleted_old

ulint srv_n_system_rows_deleted_old = 0
static

◆ srv_n_system_rows_inserted_old

ulint srv_n_system_rows_inserted_old = 0
static

◆ srv_n_system_rows_read_old

ulint srv_n_system_rows_read_old = 0
static

◆ srv_n_system_rows_updated_old

ulint srv_n_system_rows_updated_old = 0
static

◆ srv_n_write_io_threads

ulong srv_n_write_io_threads

◆ srv_numa_interleave

bool srv_numa_interleave = FALSE

◆ srv_online_max_size

unsigned long long srv_online_max_size

Maximum modification log file size for online index creation.

◆ srv_page_size

ulong srv_page_size = UNIV_PAGE_SIZE_DEF

◆ srv_page_size_shift

ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF

◆ srv_parallel_read_threads

ulong srv_parallel_read_threads

Number of threads to use for parallel reads.

◆ srv_print_all_deadlocks

bool srv_print_all_deadlocks = FALSE

Print all user-level transactions deadlocks to mysqld stderr.

◆ srv_print_ddl_logs

bool srv_print_ddl_logs = false

Print all DDL logs to mysqld stderr.

◆ srv_print_innodb_lock_monitor

bool srv_print_innodb_lock_monitor = FALSE

◆ srv_print_innodb_monitor

bool srv_print_innodb_monitor = FALSE

◆ srv_priority_boost

ibool srv_priority_boost = TRUE

◆ srv_purge_batch_size

ulong srv_purge_batch_size = 20

◆ srv_purge_rseg_truncate_frequency

ulong srv_purge_rseg_truncate_frequency = 128

Rate at which UNDO records should be purged.

◆ SRV_PURGE_SLOT

const ulint SRV_PURGE_SLOT = 1
static

Slot index in the srv_sys->sys_threads array for the purge thread.

◆ srv_random_read_ahead

bool srv_random_read_ahead = FALSE

◆ srv_read_ahead_threshold

ulong srv_read_ahead_threshold = 56

◆ srv_read_only_mode

bool srv_read_only_mode

Set if InnoDB must operate in read-only mode.

We don't do any recovery and open all tables in RO mode instead of RW mode. We don't sync the max trx id to disk either.

◆ srv_redo_log_encrypt

bool srv_redo_log_encrypt = false

Enable or disable Encrypt of REDO tablespace.

Enable or Disable Encrypt of REDO tablespace.

◆ srv_replication_delay

ulong srv_replication_delay = 0

◆ srv_rollback_segments

ulong srv_rollback_segments = TRX_SYS_N_RSEGS

The number of rollback segments per tablespace.

◆ srv_sort_buf_size

ulong srv_sort_buf_size = 1048576

Sort buffer size in index creation.

◆ srv_spin_wait_delay

ulong srv_spin_wait_delay = 6

◆ srv_stage_alter_table_end

PSI_stage_info srv_stage_alter_table_end
Initial value:
= {
0, "alter table (end)", PSI_FLAG_STAGE_PROGRESS, PSI_DOCUMENT_ME}

Performance schema stage event for monitoring ALTER TABLE progress everything after flush log_make_latest_checkpoint().

◆ srv_stage_alter_table_flush

PSI_stage_info srv_stage_alter_table_flush
Initial value:
= {
0, "alter table (flush)", PSI_FLAG_STAGE_PROGRESS, PSI_DOCUMENT_ME}

Performance schema stage event for monitoring ALTER TABLE progress log_make_latest_checkpoint().

◆ srv_stage_alter_table_insert

PSI_stage_info srv_stage_alter_table_insert
Initial value:
= {
0, "alter table (insert)", PSI_FLAG_STAGE_PROGRESS, PSI_DOCUMENT_ME}

Performance schema stage event for monitoring ALTER TABLE progress row_merge_insert_index_tuples().

◆ srv_stage_alter_table_log_index

PSI_stage_info srv_stage_alter_table_log_index
Initial value:
= {
0, "alter table (log apply index)", PSI_FLAG_STAGE_PROGRESS,

Performance schema stage event for monitoring ALTER TABLE progress row_log_apply().

◆ srv_stage_alter_table_log_table

PSI_stage_info srv_stage_alter_table_log_table
Initial value:
= {
0, "alter table (log apply table)", PSI_FLAG_STAGE_PROGRESS,

Performance schema stage event for monitoring ALTER TABLE progress row_log_table_apply().

◆ srv_stage_alter_table_merge_sort

PSI_stage_info srv_stage_alter_table_merge_sort
Initial value:
= {
0, "alter table (merge sort)", PSI_FLAG_STAGE_PROGRESS, PSI_DOCUMENT_ME}

Performance schema stage event for monitoring ALTER TABLE progress row_merge_sort().

◆ srv_stage_alter_table_read_pk_internal_sort

PSI_stage_info srv_stage_alter_table_read_pk_internal_sort
Initial value:
= {
0, "alter table (read PK and internal sort)", PSI_FLAG_STAGE_PROGRESS,

Performance schema stage event for monitoring ALTER TABLE progress row_merge_read_clustered_index().

◆ srv_stage_alter_tablespace_encryption

PSI_stage_info srv_stage_alter_tablespace_encryption
Initial value:
= {
0, "alter tablespace (encryption)", PSI_FLAG_STAGE_PROGRESS,

Performance schema stage event for monitoring ALTER TABLESPACE ENCRYPTION progress.

◆ srv_stage_buffer_pool_load

PSI_stage_info srv_stage_buffer_pool_load
Initial value:
= {
0, "buffer pool load", PSI_FLAG_STAGE_PROGRESS, PSI_DOCUMENT_ME}

Performance schema stage event for monitoring buffer pool load progress.

◆ srv_stage_clone_file_copy

PSI_stage_info srv_stage_clone_file_copy
Initial value:
= {
0, "clone (file copy)", PSI_FLAG_STAGE_PROGRESS, PSI_DOCUMENT_ME}

Performance schema stage event for monitoring clone file copy progress.

◆ srv_stage_clone_page_copy

PSI_stage_info srv_stage_clone_page_copy
Initial value:
= {
0, "clone (page copy)", PSI_FLAG_STAGE_PROGRESS, PSI_DOCUMENT_ME}

Performance schema stage event for monitoring clone page copy progress.

◆ srv_stage_clone_redo_copy

PSI_stage_info srv_stage_clone_redo_copy
Initial value:
= {
0, "clone (redo copy)", PSI_FLAG_STAGE_PROGRESS, PSI_DOCUMENT_ME}

Performance schema stage event for monitoring clone redo copy progress.

◆ srv_stats

srv_stats_t srv_stats

Global counters.

◆ srv_stats_auto_recalc

bool srv_stats_auto_recalc = TRUE

◆ srv_stats_include_delete_marked

bool srv_stats_include_delete_marked = FALSE

◆ srv_stats_persistent

bool srv_stats_persistent = TRUE

◆ srv_stats_persistent_sample_pages

unsigned long long srv_stats_persistent_sample_pages = 20

◆ srv_stats_transient_sample_pages

unsigned long long srv_stats_transient_sample_pages = 8

◆ srv_sys

srv_sys_t* srv_sys = NULL
static

◆ srv_threads

Srv_threads srv_threads

Structure with state of srv background threads.

◆ srv_truncated_status_writes

ulint srv_truncated_status_writes = 0

◆ srv_undo_dir

char* srv_undo_dir = NULL

Undo tablespace directories.

Server undo tablespaces directory, can be absolute path.

This can be multiple paths separated by ';' and can also be absolute paths.

◆ srv_undo_log_encrypt

bool srv_undo_log_encrypt = FALSE

Enable or disable Encrypt of UNDO tablespace.

◆ srv_undo_log_truncate

bool srv_undo_log_truncate = FALSE

Enable or Disable Truncate of UNDO tablespace.

Note: If enabled then UNDO tablespace will be selected for truncate. While Server waits for undo-tablespace to truncate if user disables it, truncate action is completed but no new tablespace is marked for truncate (action is never aborted).

◆ srv_undo_logs

ulong srv_undo_logs = 0

◆ SRV_UNDO_TABLESPACE_SIZE_IN_PAGES

const page_no_t SRV_UNDO_TABLESPACE_SIZE_IN_PAGES
Initial value:
=
((1024 * 1024) * 10) / UNIV_PAGE_SIZE_DEF

Default undo tablespace size in UNIV_PAGEs count (10MB).

Default size of UNDO tablespace while it is created new.

◆ srv_undo_tablespaces

ulong srv_undo_tablespaces = FSP_IMPLICIT_UNDO_TABLESPACES

The number of implicit undo tablespaces to use for rollback segments.

Number of undo tablespaces to use.

◆ srv_unix_file_flush_method

enum srv_unix_flush_t srv_unix_file_flush_method = SRV_UNIX_FSYNC

◆ srv_use_doublewrite_buf

ibool srv_use_doublewrite_buf = TRUE

◆ srv_use_native_aio

bool srv_use_native_aio

◆ univ_page_size

page_size_t univ_page_size(0, 0, false)
srv_sys_t::mutex
ib_mutex_t mutex
variable protecting the fields below.
Definition: srv0srv.cc:721
srv_buf_pool_max_size
const longlong srv_buf_pool_max_size
Maximum pool size in bytes.
Definition: srv0srv.cc:392
srv_sys
static srv_sys_t * srv_sys
Definition: srv0srv.cc:736
INNODB_LOG_FLUSH_NOTIFIER_SPIN_DELAY_DEFAULT
constexpr ulong INNODB_LOG_FLUSH_NOTIFIER_SPIN_DELAY_DEFAULT
Default value of innodb_log_flush_notifier_spin_delay (in spin rounds).
Definition: log0log.h:296
INNODB_LOG_WRITE_NOTIFIER_TIMEOUT_DEFAULT
constexpr ulong INNODB_LOG_WRITE_NOTIFIER_TIMEOUT_DEFAULT
Default value of innodb_log_write_notifier_timeout (in microseconds).
Definition: log0log.h:293
INNODB_LOG_FLUSH_NOTIFIER_TIMEOUT_DEFAULT
constexpr ulong INNODB_LOG_FLUSH_NOTIFIER_TIMEOUT_DEFAULT
Default value of innodb_log_flush_notifier_timeout (in microseconds).
Definition: log0log.h:299
INNODB_LOG_WAIT_FOR_FLUSH_SPIN_DELAY_DEFAULT
constexpr ulong INNODB_LOG_WAIT_FOR_FLUSH_SPIN_DELAY_DEFAULT
Default value of innodb_log_wait_for_flush_spin_delay (in spin rounds).
Definition: log0log.h:273
INNODB_LOG_WRITE_NOTIFIER_SPIN_DELAY_DEFAULT
constexpr ulong INNODB_LOG_WRITE_NOTIFIER_SPIN_DELAY_DEFAULT
Default value of innodb_log_write_notifier_spin_delay (in spin rounds).
Definition: log0log.h:290
INNODB_LOG_WAIT_FOR_WRITE_SPIN_DELAY_DEFAULT
constexpr ulong INNODB_LOG_WAIT_FOR_WRITE_SPIN_DELAY_DEFAULT
Default value of innodb_log_wait_for_write_spin_delay (in spin rounds).
Definition: log0log.h:265
MAX_BUFFER_POOLS
constexpr ulint MAX_BUFFER_POOLS
The maximum number of buffer pools that can be defined.
Definition: buf0buf.h:105
PSI_DOCUMENT_ME
#define PSI_DOCUMENT_ME
Definition: psi_base.h:46
INNODB_LOG_WAIT_FOR_FLUSH_TIMEOUT_DEFAULT
constexpr ulong INNODB_LOG_WAIT_FOR_FLUSH_TIMEOUT_DEFAULT
Default value of innodb_log_wait_for_flush_timeout (in microseconds).
Definition: log0log.h:279
PSI_FLAG_STAGE_PROGRESS
#define PSI_FLAG_STAGE_PROGRESS
Stage progress flag.
Definition: psi_base.h:75
INNODB_LOG_WAIT_FOR_WRITE_TIMEOUT_DEFAULT
constexpr ulong INNODB_LOG_WAIT_FOR_WRITE_TIMEOUT_DEFAULT
Default value of innodb_log_wait_for_write_timeout (in microseconds).
Definition: log0log.h:268