📄 srv0srv.h
字号:
#define SRV_FORCE_NO_IBUF_MERGE 4 /* prevent also ibuf operations: if they would cause a crash, better not do them */#define SRV_FORCE_NO_UNDO_LOG_SCAN 5 /* do not look at undo logs when starting the database: InnoDB will treat even incomplete transactions as committed */#define SRV_FORCE_NO_LOG_REDO 6 /* do not do the log roll-forward in connection with recovery */ /*************************************************************************Boots Innobase server. */ulintsrv_boot(void);/*==========*/ /* out: DB_SUCCESS or error code *//*************************************************************************Initializes the server. */voidsrv_init(void);/*==========*//*************************************************************************Frees the OS fast mutex created in srv_boot(). */voidsrv_free(void);/*==========*//*************************************************************************Initializes the synchronization primitives, memory system, and the threadlocal storage. */voidsrv_general_init(void);/*==================*//*************************************************************************Gets the number of threads in the system. */ulintsrv_get_n_threads(void);/*===================*//*************************************************************************Returns the calling thread type. */ulintsrv_get_thread_type(void);/*=====================*/ /* out: SRV_COM, ... *//*************************************************************************Sets the info describing an i/o thread current state. */voidsrv_set_io_thread_op_info(/*======================*/ ulint i, /* in: the 'segment' of the i/o thread */ const char* str); /* in: constant char string describing the state *//*************************************************************************Releases threads of the type given from suspension in the thread table.NOTE! The server mutex has to be reserved by the caller! */ulintsrv_release_threads(/*================*/ /* out: number of threads released: this may be < n if not enough threads were suspended at the moment */ ulint type, /* in: thread type */ ulint n); /* in: number of threads to release *//*************************************************************************The master thread controlling the server. */#ifndef __WIN__void*#elseulint#endifsrv_master_thread(/*==============*/ /* out: a dummy parameter */ void* arg); /* in: a dummy parameter required by os_thread_create *//***********************************************************************Tells the Innobase server that there has been activity in the databaseand wakes up the master thread if it is suspended (not sleeping). Usedin the MySQL interface. Note that there is a small chance that the masterthread stays suspended (we do not protect our operation with the kernelmutex, for performace reasons). */voidsrv_active_wake_master_thread(void);/*===============================*//***********************************************************************Wakes up the master thread if it is suspended or being suspended. */voidsrv_wake_master_thread(void);/*========================*//*************************************************************************Puts an OS thread to wait if there are too many concurrent threads(>= srv_thread_concurrency) inside InnoDB. The threads wait in a FIFO queue. */voidsrv_conc_enter_innodb(/*==================*/ trx_t* trx); /* in: transaction object associated with the thread *//*************************************************************************This lets a thread enter InnoDB regardless of the number of threads insideInnoDB. This must be called when a thread ends a lock wait. */voidsrv_conc_force_enter_innodb(/*========================*/ trx_t* trx); /* in: transaction object associated with the thread *//*************************************************************************This must be called when a thread exits InnoDB in a lock wait or at theend of an SQL statement. */voidsrv_conc_force_exit_innodb(/*=======================*/ trx_t* trx); /* in: transaction object associated with the thread *//*************************************************************************This must be called when a thread exits InnoDB. */voidsrv_conc_exit_innodb(/*=================*/ trx_t* trx); /* in: transaction object associated with the thread *//*******************************************************************Puts a MySQL OS thread to wait for a lock to be released. If an erroroccurs during the wait trx->error_state associated with thr is!= DB_SUCCESS when we return. DB_LOCK_WAIT_TIMEOUT and DB_DEADLOCKare possible errors. DB_DEADLOCK is returned if selective deadlockresolution chose this transaction as a victim. */voidsrv_suspend_mysql_thread(/*=====================*/ que_thr_t* thr); /* in: query thread associated with the MySQL OS thread *//************************************************************************Releases a MySQL OS thread waiting for a lock to be released, if thethread is already suspended. */voidsrv_release_mysql_thread_if_suspended(/*==================================*/ que_thr_t* thr); /* in: query thread associated with the MySQL OS thread *//*************************************************************************A thread which wakes up threads whose lock wait may have lasted too long.This also prints the info output by various InnoDB monitors. */#ifndef __WIN__void*#elseulint#endifsrv_lock_timeout_and_monitor_thread(/*================================*/ /* out: a dummy parameter */ void* arg); /* in: a dummy parameter required by os_thread_create *//*************************************************************************A thread which prints warnings about semaphore waits which have lastedtoo long. These can be used to track bugs which cause hangs. */#ifndef __WIN__void*#elseulint#endifsrv_error_monitor_thread(/*=====================*/ /* out: a dummy parameter */ void* arg); /* in: a dummy parameter required by os_thread_create *//**********************************************************************Outputs to a file the output of the InnoDB Monitor. */voidsrv_printf_innodb_monitor(/*======================*/ FILE* file, /* in: output stream */ 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 */voidsrv_export_innodb_status(void);/*=====================*//* Types for the threads existing in the system. Threads of types 4 - 9are called utility threads. Note that utility threads are mainly diskbound, except that version threads 6 - 7 may also be CPU bound, ifcleaning versions from the buffer pool. */#define SRV_COM 1 /* threads serving communication and queries */#define SRV_CONSOLE 2 /* thread serving console */#define SRV_WORKER 3 /* threads serving parallelized queries and queries released from lock wait */#define SRV_BUFFER 4 /* thread flushing dirty buffer blocks, not currently in use */#define SRV_RECOVERY 5 /* threads finishing a recovery, not currently in use */#define SRV_INSERT 6 /* thread flushing the insert buffer to disk, not currently in use */#define SRV_MASTER 7 /* the master thread, (whose type number must be biggest) *//* Thread slot in the thread table */typedef struct srv_slot_struct srv_slot_t;/* Thread table is an array of slots */typedef srv_slot_t srv_table_t;/* In this structure we store status variables to be passed to MySQL */struct export_var_struct{ ulint innodb_data_pending_reads; ulint innodb_data_pending_writes; ulint innodb_data_pending_fsyncs; ulint innodb_data_fsyncs; ulint innodb_data_read; ulint innodb_data_writes; ulint innodb_data_written; ulint innodb_data_reads; ulint innodb_buffer_pool_pages_total; ulint innodb_buffer_pool_pages_data; ulint innodb_buffer_pool_pages_dirty; ulint innodb_buffer_pool_pages_misc; ulint innodb_buffer_pool_pages_free; ulint innodb_buffer_pool_pages_latched; ulint innodb_buffer_pool_read_requests; ulint innodb_buffer_pool_reads; ulint innodb_buffer_pool_wait_free; ulint innodb_buffer_pool_pages_flushed; ulint innodb_buffer_pool_write_requests; ulint innodb_buffer_pool_read_ahead_seq; ulint innodb_buffer_pool_read_ahead_rnd; ulint innodb_dblwr_pages_written; ulint innodb_dblwr_writes; ulint innodb_log_waits; ulint innodb_log_write_requests; ulint innodb_log_writes; ulint innodb_os_log_written; ulint innodb_os_log_fsyncs; ulint innodb_os_log_pending_writes; ulint innodb_os_log_pending_fsyncs; ulint innodb_page_size; ulint innodb_pages_created; ulint innodb_pages_read; ulint innodb_pages_written; ulint innodb_row_lock_waits; ulint innodb_row_lock_current_waits; ib_longlong innodb_row_lock_time; ulint innodb_row_lock_time_avg; ulint innodb_row_lock_time_max; ulint innodb_rows_read; ulint innodb_rows_inserted; ulint innodb_rows_updated; ulint innodb_rows_deleted;};/* The server system struct */struct srv_sys_struct{ os_event_t operational; /* created threads must wait for the server to become operational by waiting for this event */ srv_table_t* threads; /* server thread table */ UT_LIST_BASE_NODE_T(que_thr_t) tasks; /* task queue */ dict_index_t* dummy_ind1; /* dummy index for old-style supremum and infimum records */ dict_index_t* dummy_ind2; /* dummy index for new-style supremum and infimum records */};extern ulint srv_n_threads_active[];#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -