/** Simple non-atomic counter
@tparam Type the integer type of the counter */ template <typename Type> struct alignas(CPU_LEVEL1_DCACHE_LINESIZE) simple_counter
{ /** Increment the counter */
Type inc() { return add(1); } /** Decrement the counter */
Type dec() { return add(Type(~0)); }
/** Add to the counter @paramiamounttobeadded
@return the value of the counter after adding */
Type add(Type i) { return m_counter += i; }
/** @return the value of the counter */ operator Type() const { return m_counter; }
/** Count the amount of data written in total (in bytes) */
ulint_ctr_1_t data_written; /** Number of bytes saved by page compression */
ulint_ctr_n_t page_compression_saved; /* Number of pages compressed with page compression */
ulint_ctr_n_t pages_page_compressed; /* Number of TRIM operations induced by page compression */
ulint_ctr_n_t page_compressed_trim_op; /* Number of pages decompressed with page compression */
ulint_ctr_n_t pages_page_decompressed; /* Number of page compression errors */
ulint_ctr_n_t pages_page_compression_error; /* Number of pages encrypted */
ulint_ctr_n_t pages_encrypted; /* Number of pages decrypted */
ulint_ctr_n_t pages_decrypted; /* Number of merge blocks encrypted */
ulint_ctr_n_t n_merge_blocks_encrypted; /* Number of merge blocks decrypted */
ulint_ctr_n_t n_merge_blocks_decrypted; /* Number of row log blocks encrypted */
ulint_ctr_n_t n_rowlog_blocks_encrypted; /* Number of row log blocks decrypted */
ulint_ctr_n_t n_rowlog_blocks_decrypted;
/** Number of data read in total (in bytes) */
ulint_ctr_1_t data_read;
/** Number of encryption_get_latest_key_version calls */
ulint_ctr_n_t n_key_requests;
/** Number of temporary tablespace blocks encrypted */
ulint_ctr_n_t n_temp_blocks_encrypted;
/** Number of temporary tablespace blocks decrypted */
ulint_ctr_n_t n_temp_blocks_decrypted;
};
externconstchar* srv_main_thread_op_info;
/** Prefix used by MySQL to indicate pre-5.1 table name encoding */ externconstchar srv_mysql50_table_name_prefix[10];
/** The buffer pool dump/load file name */ #define SRV_BUF_DUMP_FILENAME_DEFAULT "ib_buffer_pool" externchar* srv_buf_dump_filename;
/** Boolean config knobs that tell InnoDB to dump the buffer pool at shutdown
and/or load it during startup. */ externchar srv_buffer_pool_dump_at_shutdown; externchar srv_buffer_pool_load_at_startup;
/* Whether to disable file system cache if it is defined */ externchar srv_disable_sort_file_cache;
/* If the last data file is auto-extended, we add this many pages to it
at a time */ #define SRV_AUTO_EXTEND_INCREMENT (srv_sys_space.get_autoextend_increment())
/* Server parameters which are read from the initfile */
externchar* srv_data_home;
/** Set if InnoDB must operate in read-only mode. We don't do any recoveryandopenalltablesinROmodeinsteadofRWmode.Wedon't
sync the max trx id to disk either. */ extern my_bool srv_read_only_mode; /** Set if innodb_read_only is set or innodb_force_recovery
is SRV_FORCE_NO_UNDO_LOG_SCAN or greater. */ externbool high_level_read_only; /** store to its own file each table created by an user; data
dictionary tables are in the system tablespace 0 */ extern my_bool srv_file_per_table;
/** Sort buffer size in index creation */ extern ulong srv_sort_buf_size; /** Maximum modification log file size for online index creation */ externunsignedlonglong srv_online_max_size;
/* If this flag is TRUE, then we will use the native aio of the OS(providedwecompiledInnobasewithitin),otherwisewewill usesimulatedaio.
Currently we support native aio on windows and linux */ extern my_bool srv_use_native_aio;
#ifdef __linux__ /* This enum is defined which linux native io method to use */ extern ulong srv_linux_aio_method; #endif
/** TRUE if the server was successfully started */ externbool srv_was_started;
/** Server undo tablespaces directory, can be absolute path. */ externchar* srv_undo_dir;
/** Number of undo tablespaces to use. */ extern uint srv_undo_tablespaces;
/** The number of UNDO tablespaces that are active (hosting some rollback segment).Itisquitepossiblethatsomeofthetablespacesdoesn'thost
any of the rollback-segment based on configuration used. */ extern uint32_t srv_undo_tablespaces_active;
/** Maximum size of undo tablespace. */ externunsignedlonglong srv_max_undo_log_size;
/** Enable or Disable Truncate of UNDO tablespace. */ extern my_bool srv_undo_log_truncate;
/** Default size of UNDO tablespace (10MiB for innodb_page_size=16k) */
constexpr uint32_t SRV_UNDO_TABLESPACE_SIZE_IN_PAGES= (10U << 20) /
UNIV_PAGE_SIZE_DEF;
externchar* srv_log_group_home_dir;
/** The InnoDB redo log file size, or 0 when changing the redo log format
at startup (while disallowing writes to the redo log). */ extern ulonglong srv_log_file_size; extern ulong srv_flush_log_at_trx_commit; extern uint srv_flush_log_at_timeout; extern my_bool srv_adaptive_flushing; extern my_bool srv_flush_sync;
/** Dump this % of each buffer pool during BP dump */ extern ulong srv_buf_pool_dump_pct; #ifdef UNIV_DEBUG /** Abort load after this amount of pages */ extern ulong srv_buf_pool_load_pages_abort; #endif /** Lock table size in bytes */ extern ulint srv_lock_table_size;
/** the value of innodb_checksum_algorithm */ extern ulong srv_checksum_algorithm; extern my_bool srv_random_read_ahead; extern ulong srv_read_ahead_threshold; extern uint srv_n_read_io_threads; extern uint srv_n_write_io_threads;
/* Number of IO operations per second the server can do */ extern ulong srv_io_capacity;
/* We use this dummy default value at startup for max_io_capacity.
The real value is set based on the value of io_capacity. */ #define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT (UINT32_MAX) #define SRV_MAX_IO_CAPACITY_LIMIT (UINT32_MAX) extern ulong srv_max_io_capacity;
/* The "innodb_stats_method" setting, decides how InnoDB is going totreatNULLvaluewhencollectingstatistics.Itisnotdefined
as enum type because the configure option takes unsigned integer type. */ extern ulong srv_innodb_stats_method;
/** innodb_fast_shutdown=1 skips purge. innodb_fast_shutdown=2effectivelycrashestheserver(nologcheckpoint). innodb_fast_shutdown=3isacleanshutdownthatskipstherollback
of active transaction (to be done on restart). */ extern uint srv_fast_shutdown;
/** Modes of operation */ enum srv_operation_mode { /** Normal mode (MariaDB Server) */
SRV_OPERATION_NORMAL, /** Mariabackup is executing server to export already restored
tablespaces */
SRV_OPERATION_EXPORT_RESTORED, /** Mariabackup taking a backup */
SRV_OPERATION_BACKUP, /** Mariabackup restoring a backup for subsequent --copy-back */
SRV_OPERATION_RESTORE, /** Mariabackup restoring the incremental part of a backup */
SRV_OPERATION_RESTORE_DELTA, /** Mariabackup restoring a backup for subsequent --export */
SRV_OPERATION_RESTORE_EXPORT, /** Mariabackup taking a backup and avoid deferring
any tablespace */
SRV_OPERATION_BACKUP_NO_DEFER
};
/** Current mode of operation */ externenum srv_operation_mode srv_operation;
/** whether this is the server's first start after mariabackup --prepare */ externbool srv_start_after_restore;
/** Number of initialized rollback segments for persistent undo log */ extern ulong srv_available_undo_logs; /** Iterations of the loop bounded by 'srv_active' label. */ extern ulint srv_main_active_loops; /** Iterations of the loop bounded by the 'srv_idle' label. */ extern ulint srv_main_idle_loops; /** Log writes involving flush. */ extern ulint srv_log_writes_and_flush;
/** InnoDB system tablespace to set during recovery */ extern uint srv_sys_space_size_debug; /** whether redo log file has been created at startup */ externbool srv_log_file_created; #endif/* UNIV_DEBUG */
extern ulint srv_dml_needed_delay;
/** innodb_purge_threads; the number of purge tasks to use */ extern uint srv_n_purge_threads;
/* the number of pages to purge in one batch */ extern ulong srv_purge_batch_size;
/* print all user-level transactions deadlocks to mysqld stderr */ extern my_bool srv_print_all_deadlocks;
/* is encryption enabled */ extern ulong srv_encrypt_tables;
/** Status variables to be passed to MySQL */ externstruct export_var_t export_vars;
/** Global counters */ extern srv_stats_t srv_stats;
/** Fatal semaphore wait threshold = maximum number of seconds
that semaphore times out in InnoDB */ #define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600 extern ulong srv_fatal_semaphore_wait_threshold;
/** Buffer pool dump status frequence in percentages */ extern ulong srv_buf_dump_status_frequency;
/* This macro register the current thread and its key with performance
schema */ # define pfs_register_thread(key) \ do { \ struct PSI_thread* psi __attribute__((unused)) \
= PSI_CALL_new_thread(key, NULL, 0); \
PSI_CALL_set_thread_os_id(psi); \
PSI_CALL_set_thread(psi); \
} while (0)
/* This macro delist the current thread from performance schema */ # define pfs_delete_thread() \ do { \
PSI_CALL_delete_current_thread(); \
} while (0) # else # define pfs_register_thread(key) # define pfs_delete_thread() # endif /* UNIV_PFS_THREAD */
#ifdef HAVE_PSI_STAGE_INTERFACE /** Performance schema stage event for monitoring ALTER TABLE progress
in ha_innobase::commit_inplace_alter_table(). */ extern PSI_stage_info srv_stage_alter_table_end;
/** Performance schema stage event for monitoring ALTER TABLE progress
row_merge_insert_index_tuples(). */ extern PSI_stage_info srv_stage_alter_table_insert;
/** Performance schema stage event for monitoring ALTER TABLE progress
row_log_apply(). */ extern PSI_stage_info srv_stage_alter_table_log_index;
/** Performance schema stage event for monitoring ALTER TABLE progress
row_log_table_apply(). */ extern PSI_stage_info srv_stage_alter_table_log_table;
/** Performance schema stage event for monitoring ALTER TABLE progress
row_merge_sort(). */ extern PSI_stage_info srv_stage_alter_table_merge_sort;
/** Performance schema stage event for monitoring ALTER TABLE progress
row_merge_read_clustered_index(). */ extern PSI_stage_info srv_stage_alter_table_read_pk_internal_sort;
/** Performance schema stage event for monitoring buffer pool load progress. */ extern PSI_stage_info srv_stage_buffer_pool_load; #endif/* HAVE_PSI_STAGE_INTERFACE */
/** Alternatives for srv_force_recovery. Non-zero values are intended tohelptheusergetadamageddatabaseupsothathecandumpintact tablesandrowswithSELECTINTOOUTFILE.Thedatabasemustnototherwise beusedwiththeseoptions!Abiggernumberbelowmeansthatallprecautions
of lower numbers are included. */ enum {
SRV_FORCE_IGNORE_CORRUPT = 1, /*!< let the server run even if it
detects a corrupt page */
SRV_FORCE_NO_BACKGROUND = 2, /*!< prevent the main thread from running:ifacrashwouldoccur
in purge, this prevents it */
SRV_FORCE_NO_TRX_UNDO = 3, /*!< do not run DML rollback after
recovery */
SRV_FORCE_NO_DDL_UNDO = 4, /*!< prevent also DDL rollback */
SRV_FORCE_NO_UNDO_LOG_SCAN = 5, /*!< do not look at undo logs when startingthedatabase:InnoDBwill treatevenincompletetransactions
as committed */
SRV_FORCE_NO_LOG_REDO = 6/*!< do not do the log roll-forward
in connection with recovery */
};
/* Alternatives for srv_innodb_stats_method, which could be changed by
setting innodb_stats_method */ enum srv_stats_method_name_enum {
SRV_STATS_NULLS_EQUAL, /* All NULL values are treated as equal.Thisisthedefaultsetting
for innodb_stats_method */
SRV_STATS_NULLS_UNEQUAL, /* All NULL values are treated as
NOT equal. */
SRV_STATS_NULLS_IGNORED /* NULL values are ignored */
};
/*********************************************************************//**
Boots Innobase server. */ void
srv_boot(void); /*==========*/ /*********************************************************************//**
Frees the data structures created in srv_init(). */ void
srv_free(void);
/******************************************************************//**
Outputs to a file the output of the InnoDB Monitor.
@returnFALSEifnot all information printed
due to failure to obtain necessary mutex */
ibool
srv_printf_innodb_monitor( /*======================*/
FILE* file, /*!< in: output stream */
ibool nowait, /*!< in: whether to wait for lock_sys.latch */
ulint* trx_start, /*!< out: file position of the start of
the list of active transactions */
ulint* trx_end); /*!< out: file position of the end of
the list of active transactions */
/******************************************************************//**
Function to pass InnoDB status variables to MySQL */ void
srv_export_innodb_status(void); /*==========================*/ /*******************************************************************//**
Get current server activity count.
@return activity count. */
ulint
srv_get_activity_count(void); /*========================*/
/******************************************************************//**
Increment the server activity counter. */ void
srv_inc_activity_count(void); /*=========================*/
/**********************************************************************//**
Enqueues a task to server task queue and releases a worker thread, if there
is a suspended one. */ void
srv_que_task_enqueue_low( /*=====================*/
que_thr_t* thr); /*!< in: query thread */
#ifdef UNIV_DEBUG /** @return whether purge or master task is active */ bool srv_any_background_activity(); #endif
extern"C" {
/** Periodic task which prints the info output by various InnoDB monitors.*/ void srv_monitor_task(void*);
/** The periodic master task controlling the server. */ void srv_master_callback(void*);
/** Number of undo tablespace truncation operations */
ulong innodb_undo_truncations;
/** Number of instant ALTER TABLE operations that affect columns */
Atomic_counter<ulint> innodb_instant_alter_column;
/* Number of InnoDB bulk operations */
Atomic_counter<ulint> innodb_bulk_operations;
ulint innodb_onlineddl_rowlog_rows; /*!< Online alter rows */
ulint innodb_onlineddl_rowlog_pct_used; /*!< Online alter percentage
of used row log buffer */
ulint innodb_onlineddl_pct_progress; /*!< Online alter progress */
int64_t innodb_page_compression_saved;/*!< Number of bytes saved
by page compression */
int64_t innodb_pages_page_compressed;/*!< Number of pages
compressed by page compression */
int64_t innodb_page_compressed_trim_op;/*!< Number of TRIM operations
induced by page compression */
int64_t innodb_pages_page_decompressed;/*!< Number of pages decompressedbypage
compression */
int64_t innodb_pages_page_compression_error;/*!< Number of page
compression errors */
int64_t innodb_pages_encrypted; /*!< Number of pages
encrypted */
int64_t innodb_pages_decrypted; /*!< Number of pages
decrypted */
/*!< Number of merge blocks encrypted */
ib_int64_t innodb_n_merge_blocks_encrypted; /*!< Number of merge blocks decrypted */
ib_int64_t innodb_n_merge_blocks_decrypted; /*!< Number of row log blocks encrypted */
ib_int64_t innodb_n_rowlog_blocks_encrypted; /*!< Number of row log blocks decrypted */
ib_int64_t innodb_n_rowlog_blocks_decrypted;
/* Number of temporary tablespace pages encrypted */
ib_int64_t innodb_n_temp_blocks_encrypted;
/* Number of temporary tablespace pages decrypted */
ib_int64_t innodb_n_temp_blocks_decrypted;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.