Drizzled Public API Documentation

srv0srv.h File Reference
#include "univ.i"
#include "sync0sync.h"
#include "os0sync.h"
#include "que0types.h"
#include "trx0types.h"
#include <string>

Go to the source code of this file.

Classes

struct  export_var_struct
 
struct  srv_sys_struct
 

Macros

#define srv0srv_h
 
#define SRV_AUTO_EXTEND_INCREMENT   (srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE))
 
#define PCT_IO(p)   ((ulong) (srv_io_capacity * ((double) p / 100.0)))
 
#define srv_print_thread_releases   FALSE
 
#define srv_print_lock_waits   FALSE
 
#define srv_print_buf_io   FALSE
 
#define srv_print_log_io   FALSE
 
#define srv_print_latch_waits   FALSE
 
#define kernel_mutex   (*kernel_mutex_temp)
 
#define commit_id_mutex   (*commit_id_mutex_temp)
 
#define SRV_MAX_N_IO_THREADS   130
 

Typedefs

typedef struct export_var_struct export_struc
 
typedef struct srv_sys_struct srv_sys_t
 
typedef enum
srv_stats_method_name_enum 
srv_stats_method_name_t
 
typedef struct srv_slot_struct srv_slot_t
 
typedef srv_slot_t srv_table_t
 

Enumerations

enum  { SRV_NOT_RAW = 0, SRV_NEW_RAW, SRV_OLD_RAW }
 
enum  {
  SRV_UNIX_FSYNC = 1, SRV_UNIX_O_DSYNC, SRV_UNIX_LITTLESYNC, SRV_UNIX_NOSYNC,
  SRV_UNIX_O_DIRECT, SRV_UNIX_ALL_O_DIRECT
}
 
enum  { SRV_WIN_IO_NORMAL = 1, SRV_WIN_IO_UNBUFFERED }
 
enum  {
  SRV_FORCE_IGNORE_CORRUPT = 1, SRV_FORCE_NO_BACKGROUND = 2, SRV_FORCE_NO_TRX_UNDO = 3, SRV_FORCE_NO_IBUF_MERGE = 4,
  SRV_FORCE_NO_UNDO_LOG_SCAN = 5, SRV_FORCE_NO_LOG_REDO = 6
}
 
enum  srv_stats_method_name_enum { SRV_STATS_NULLS_EQUAL, SRV_STATS_NULLS_UNEQUAL, SRV_STATS_NULLS_IGNORED }
 
enum  srv_thread_type { SRV_WORKER = 0, SRV_MASTER }
 

Functions

static const std::string srv_mysql50_table_name_prefix ("#mysql50#")
 
UNIV_INTERN ulint srv_boot (void)
 
UNIV_INTERN void srv_init (void)
 
UNIV_INTERN void srv_free (void)
 
UNIV_INTERN void srv_general_init (void)
 
UNIV_INTERN ulint srv_get_n_threads (void)
 
UNIV_INTERN ulint srv_thread_has_reserved_slot (enum srv_thread_type type)
 
UNIV_INTERN void srv_set_io_thread_op_info (ulint i, const char *str)
 
UNIV_INTERN ulint srv_release_threads (enum srv_thread_type type, ulint n)
 
UNIV_INTERN os_thread_ret_t srv_master_thread (void *arg)
 
UNIV_INTERN void srv_wake_purge_thread (void)
 
UNIV_INTERN void srv_active_wake_master_thread (void)
 
UNIV_INTERN void srv_wake_master_thread (void)
 
UNIV_INTERN void srv_wake_purge_thread_if_not_active (void)
 
UNIV_INTERN void srv_conc_enter_innodb (trx_t *trx)
 
UNIV_INTERN void srv_conc_force_enter_innodb (trx_t *trx)
 
UNIV_INTERN void srv_conc_force_exit_innodb (trx_t *trx)
 
UNIV_INTERN void srv_conc_exit_innodb (trx_t *trx)
 
UNIV_INTERN void srv_suspend_mysql_thread (que_thr_t *thr)
 
UNIV_INTERN void srv_release_mysql_thread_if_suspended (que_thr_t *thr)
 
UNIV_INTERN os_thread_ret_t srv_lock_timeout_thread (void *arg)
 
UNIV_INTERN os_thread_ret_t srv_monitor_thread (void *arg)
 
UNIV_INTERN os_thread_ret_t srv_error_monitor_thread (void *arg)
 
UNIV_INTERN os_thread_ret_t srv_LRU_dump_restore_thread (void *arg)
 
UNIV_INTERN ibool srv_printf_innodb_monitor (FILE *file, ibool nowait, ulint *trx_start, ulint *trx_end)
 
UNIV_INTERN void srv_export_innodb_status (void)
 
UNIV_INTERN void srv_inc_activity_count (void)
 
UNIV_INTERN os_thread_ret_t srv_purge_thread (void *)
 
UNIV_INTERN void srv_que_task_enqueue_low (que_thr_t *thr)
 
UNIV_INTERN ibool srv_is_any_background_thread_active (void)
 

Variables

const char * srv_main_thread_op_info
 
os_event_t srv_lock_timeout_thread_event
 
os_event_t srv_monitor_event
 
os_event_t srv_timeout_event
 
os_event_t srv_error_event
 
uint srv_lower_case_table_names
 
mutex_t srv_monitor_file_mutex
 
FILE * srv_monitor_file
 
mutex_t srv_dict_tmpfile_mutex
 
FILE * srv_dict_tmpfile
 
mutex_t srv_misc_tmpfile_mutex
 
FILE * srv_misc_tmpfile
 
char * srv_data_home
 
my_bool srv_file_per_table
 
ulint srv_file_format
 
ulint srv_max_file_format_at_startup
 
ibool srv_locks_unsafe_for_binlog
 
my_bool srv_use_native_aio
 
ulint srv_n_data_files
 
char ** srv_data_file_names
 
ulint * srv_data_file_sizes
 
ulint * srv_data_file_is_raw_partition
 
ibool srv_auto_extend_last_data_file
 
ulint srv_last_file_size_max
 
char ** srv_log_group_home_dirs
 
unsigned int srv_auto_extend_increment
 
ibool srv_created_new_raw
 
ulint srv_n_log_groups
 
ulint srv_n_log_files
 
ulint srv_log_file_size
 
ulint srv_log_buffer_size
 
ulong srv_flush_log_at_trx_commit
 
bool srv_adaptive_flushing
 
const byte * srv_latin1_ordering
 
my_bool srv_use_sys_malloc
 
ulint srv_buf_pool_size
 
ulint srv_buf_pool_instances
 
ulint srv_buf_pool_old_size
 
ulint srv_buf_pool_curr_size
 
ulint srv_mem_pool_size
 
ulint srv_lock_table_size
 
ulint srv_n_file_io_threads
 
ulong srv_read_ahead_threshold
 
ulint srv_n_read_io_threads
 
ulint srv_n_write_io_threads
 
ulong srv_io_capacity
 
ulong srv_innodb_stats_method
 
char * srv_file_flush_method_str
 
ulint srv_unix_file_flush_method
 
ulint srv_win_file_flush_method
 
ulint srv_max_n_open_files
 
ulint srv_max_dirty_pages_pct
 
ulint srv_force_recovery
 
ulong srv_thread_concurrency
 
ulint srv_max_n_threads
 
lint srv_conc_n_threads
 
ulint srv_fast_shutdown
 
ibool srv_innodb_status
 
ib_uint64_t srv_stats_sample_pages
 
ibool srv_use_doublewrite_buf
 
ibool srv_use_checksums
 
ulong srv_max_buf_pool_modified_pct
 
ulong srv_max_purge_lag
 
ulong srv_replication_delay
 
uint64_t srv_ibuf_max_size
 
uint32_t srv_ibuf_active_contract
 
uint32_t srv_ibuf_accel_rate
 
uint32_t srv_checkpoint_age_target
 
uint32_t srv_flush_neighbor_pages
 
uint32_t srv_read_ahead
 
uint32_t srv_adaptive_flushing_method
 
ibool srv_read_only
 
ibool srv_fake_write
 
ibool srv_apply_log_only
 
ulint srv_n_rows_inserted
 
ulint srv_n_rows_updated
 
ulint srv_n_rows_deleted
 
ulint srv_n_rows_read
 
ibool srv_print_innodb_monitor
 
ibool srv_print_innodb_lock_monitor
 
ibool srv_print_innodb_tablespace_monitor
 
ibool srv_print_verbose_log
 
ibool srv_print_innodb_table_monitor
 
ibool srv_lock_timeout_active
 
ibool srv_monitor_active
 
ibool srv_error_monitor_active
 
ulong srv_n_spin_wait_rounds
 
ulong srv_n_free_tickets_to_enter
 
ulong srv_thread_sleep_delay
 
ulong srv_spin_wait_delay
 
ibool srv_priority_boost
 
ulint srv_truncated_status_writes
 
ulint srv_activity_count
 
ulint srv_fatal_semaphore_wait_threshold
 
ulint srv_dml_needed_delay
 
mutex_tkernel_mutex_temp
 
mutex_tcommit_id_mutex_temp
 
const char * srv_io_thread_op_info []
 
const char * srv_io_thread_function []
 
ulint srv_log_write_requests
 
ulint srv_log_writes
 
ulint srv_os_log_written
 
ulint srv_os_log_pending_writes
 
ulint srv_log_waits
 
ulong srv_n_purge_threads
 
ulong srv_purge_batch_size
 
ulong srv_rollback_segments
 
ulint srv_data_read
 
ulint srv_data_written
 
ulint srv_dblwr_writes
 
ulint srv_dblwr_pages_written
 
ulint srv_buf_pool_write_requests
 
ulint srv_buf_pool_wait_free
 
ulint srv_buf_pool_flushed
 
ulint srv_buf_pool_reads
 
uint32_t srv_auto_lru_dump
 
export_struc export_vars
 
srv_sys_tsrv_sys
 
ulint srv_n_threads_active []
 

Detailed Description

The server main program

Created 10/10/1995 Heikki Tuuri

Definition in file srv0srv.h.

Typedef Documentation

Status variables to be passed to MySQL

Definition at line 361 of file srv0srv.h.

typedef struct srv_slot_struct srv_slot_t

Thread slot in the thread table

Definition at line 786 of file srv0srv.h.

typedef struct srv_sys_struct srv_sys_t

The server system

Definition at line 367 of file srv0srv.h.

Thread table is an array of slots

Definition at line 789 of file srv0srv.h.

Enumeration Type Documentation

anonymous enum

Types of raw partitions in innodb_data_file_path

Enumerator
SRV_NOT_RAW 

Not a raw partition

SRV_NEW_RAW 

A 'newraw' partition, only to be initialized

SRV_OLD_RAW 

An initialized raw partition

Definition at line 405 of file srv0srv.h.

anonymous enum
Alternatives for the file flush option in Unix; see the InnoDB manual

about what these mean

Enumerator
SRV_UNIX_FSYNC 

fsync, the default

SRV_UNIX_O_DSYNC 

open log files in O_SYNC mode

SRV_UNIX_LITTLESYNC 

do not call os_file_flush() when writing data files, but do flush after writing to log files

SRV_UNIX_NOSYNC 

do not flush after writing

SRV_UNIX_O_DIRECT 

invoke os_file_set_nocache() on data files

SRV_UNIX_ALL_O_DIRECT 

Open log file also with O_DIRECT

Definition at line 414 of file srv0srv.h.

anonymous enum

Alternatives for file i/o in Windows

Enumerator
SRV_WIN_IO_NORMAL 

buffered I/O

SRV_WIN_IO_UNBUFFERED 

unbuffered I/O; this is the default

Definition at line 427 of file srv0srv.h.

anonymous enum
Alternatives for srv_force_recovery. Non-zero values are intended

to help the user get a damaged database up so that he can dump intact tables and rows with SELECT INTO OUTFILE. The database must not otherwise be used with these options! A bigger number below means that all precautions of lower numbers are included.

Enumerator
SRV_FORCE_IGNORE_CORRUPT 

let the server run even if it detects a corrupt page

SRV_FORCE_NO_BACKGROUND 

prevent the main thread from running: if a crash would occur in purge, this prevents it

SRV_FORCE_NO_TRX_UNDO 

do not run trx rollback after recovery

SRV_FORCE_NO_IBUF_MERGE 

prevent also ibuf operations: if they would cause a crash, better not do them

SRV_FORCE_NO_UNDO_LOG_SCAN 

do not look at undo logs when starting the database: InnoDB will treat even incomplete transactions as committed

SRV_FORCE_NO_LOG_REDO 

do not do the log roll-forward in connection with recovery

Definition at line 437 of file srv0srv.h.

Types of threads existing in the system.

Enumerator
SRV_WORKER 

threads serving parallelized queries and queries released from lock wait

SRV_MASTER 

the master thread, (whose type number must be biggest)

Definition at line 471 of file srv0srv.h.

Function Documentation

UNIV_INTERN void srv_active_wake_master_thread ( void  )

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 kernel mutex, for performace reasons).

Tells the InnoDB 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).

Definition at line 2617 of file srv0srv.cc.

References srv_active_wake_master_thread(), SRV_MASTER, and srv_release_threads().

Referenced by ha_innobase::close(), InnobaseEngine::doCommit(), InnobaseEngine::doCreateTable(), InnobaseEngine::doDropSchema(), InnobaseEngine::doDropTable(), InnobaseEngine::doRenameTable(), InnobaseEngine::doXaPrepare(), innobase_active_small(), srv_active_wake_master_thread(), and trx_general_rollback_for_mysql().

UNIV_INTERN ulint srv_boot ( void  )

Boots Innobase server.

Returns
DB_SUCCESS or error code

Boots the InnoDB server.

Returns
DB_SUCCESS or error code

Definition at line 1511 of file srv0srv.cc.

References srv_boot(), srv_general_init(), and srv_init().

Referenced by innobase_start_or_create_for_mysql(), and srv_boot().

UNIV_INTERN void srv_conc_enter_innodb ( trx_t trx)

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. in: transaction object associated with the thread

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.

Parameters
trxin: transaction object associated with the thread

Definition at line 1213 of file srv0srv.cc.

References srv_conc_slot_struct::event, trx_struct::mysql_thd, trx_struct::op_info, os_event_reset(), os_fast_mutex_lock(), os_fast_mutex_unlock(), os_thread_sleep(), srv_conc_slot_struct::reserved, srv_conc_enter_innodb(), thd_is_replication_slave_thread(), trx_struct::trx_locks, trx_print(), trx_search_latch_release_if_reserved(), ut_ad, UT_LIST_ADD_LAST, UT_LIST_GET_FIRST, UT_LIST_REMOVE, ut_print_timestamp(), UT_WAIT_FOR, and srv_conc_slot_struct::wait_ended.

Referenced by innodb_srv_conc_enter_innodb(), and srv_conc_enter_innodb().

UNIV_INTERN void srv_conc_exit_innodb ( trx_t trx)

This must be called when a thread exits InnoDB. in: transaction object associated with the thread

This must be called when a thread exits InnoDB.

Parameters
trxin: transaction object associated with the thread

Definition at line 1455 of file srv0srv.cc.

References srv_conc_exit_innodb(), and srv_conc_force_exit_innodb().

Referenced by innodb_srv_conc_exit_innodb(), and srv_conc_exit_innodb().

UNIV_INTERN void srv_conc_force_enter_innodb ( trx_t trx)

This lets a thread enter InnoDB regardless of the number of threads inside InnoDB. This must be called when a thread ends a lock wait. in: transaction object associated with the thread

This lets a thread enter InnoDB regardless of the number of threads inside InnoDB. This must be called when a thread ends a lock wait.

Parameters
trxin: transaction object associated with the thread

Definition at line 1373 of file srv0srv.cc.

References os_fast_mutex_lock(), os_fast_mutex_unlock(), srv_conc_force_enter_innodb(), and ut_ad.

Referenced by srv_conc_force_enter_innodb(), and srv_suspend_mysql_thread().

UNIV_INTERN void srv_conc_force_exit_innodb ( trx_t trx)

This must be called when a thread exits InnoDB in a lock wait or at the end of an SQL statement. in: transaction object associated with the thread

This must be called when a thread exits InnoDB in a lock wait or at the end of an SQL statement.

Parameters
trxin: transaction object associated with the thread

Definition at line 1399 of file srv0srv.cc.

References srv_conc_slot_struct::event, trx_struct::mysql_thd, os_event_set(), os_fast_mutex_lock(), os_fast_mutex_unlock(), srv_conc_force_exit_innodb(), thd_is_replication_slave_thread(), ut_ad, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and srv_conc_slot_struct::wait_ended.

Referenced by InnobaseEngine::doCommit(), innobase_release_stat_resources(), srv_conc_exit_innodb(), srv_conc_force_exit_innodb(), srv_suspend_mysql_thread(), and trx_free().

UNIV_INTERN os_thread_ret_t srv_error_monitor_thread ( void *  )
 in: a dummy parameter required by

os_thread_create

A thread which prints warnings about semaphore waits which have lasted too long. These can be used to track bugs which cause hangs.

Returns
a dummy parameter

Definition at line 2424 of file srv0srv.cc.

References log_get_lsn(), os_event_reset(), os_event_wait_time_low(), os_thread_eq(), os_thread_exit(), os_thread_get_curr_id(), os_thread_pf(), srv_error_monitor_thread(), SRV_SHUTDOWN_CLEANUP, srv_start_lsn, sync_arr_wake_threads_if_sema_free(), sync_array_print_long_waits(), and ut_error.

Referenced by innobase_start_or_create_for_mysql(), and srv_error_monitor_thread().

UNIV_INTERN void srv_export_innodb_status ( void  )

Function to pass InnoDB status variables to MySQL

Definition at line 2061 of file srv0srv.cc.

References buf_pool_get_n_pages(), export_vars, export_var_struct::innodb_buffer_pool_pages_data, export_var_struct::innodb_buffer_pool_pages_dirty, export_var_struct::innodb_buffer_pool_pages_flushed, export_var_struct::innodb_buffer_pool_pages_free, export_var_struct::innodb_buffer_pool_pages_misc, export_var_struct::innodb_buffer_pool_pages_total, export_var_struct::innodb_buffer_pool_read_ahead, export_var_struct::innodb_buffer_pool_read_ahead_evicted, export_var_struct::innodb_buffer_pool_read_requests, export_var_struct::innodb_buffer_pool_reads, export_var_struct::innodb_buffer_pool_wait_free, export_var_struct::innodb_buffer_pool_write_requests, export_var_struct::innodb_data_fsyncs, export_var_struct::innodb_data_pending_fsyncs, export_var_struct::innodb_data_pending_reads, export_var_struct::innodb_data_pending_writes, export_var_struct::innodb_data_read, export_var_struct::innodb_data_reads, export_var_struct::innodb_data_writes, export_var_struct::innodb_data_written, export_var_struct::innodb_dblwr_pages_written, export_var_struct::innodb_dblwr_writes, export_var_struct::innodb_have_atomic_builtins, export_var_struct::innodb_log_waits, export_var_struct::innodb_log_write_requests, export_var_struct::innodb_log_writes, export_var_struct::innodb_os_log_fsyncs, export_var_struct::innodb_os_log_pending_fsyncs, export_var_struct::innodb_os_log_pending_writes, export_var_struct::innodb_os_log_written, export_var_struct::innodb_page_size, export_var_struct::innodb_pages_created, export_var_struct::innodb_pages_read, export_var_struct::innodb_pages_written, export_var_struct::innodb_row_lock_current_waits, export_var_struct::innodb_row_lock_time, export_var_struct::innodb_row_lock_time_avg, export_var_struct::innodb_row_lock_time_max, export_var_struct::innodb_row_lock_waits, export_var_struct::innodb_rows_deleted, export_var_struct::innodb_rows_inserted, export_var_struct::innodb_rows_read, export_var_struct::innodb_rows_updated, export_var_struct::innodb_truncated_status_writes, buf_pool_stat_struct::n_page_gets, buf_pool_stat_struct::n_pages_created, buf_pool_stat_struct::n_pages_read, buf_pool_stat_struct::n_pages_written, buf_pool_stat_struct::n_ra_pages_evicted, buf_pool_stat_struct::n_ra_pages_read, os_n_pending_reads, os_n_pending_writes, srv_buf_pool_reads, and srv_export_innodb_status().

Referenced by srv_export_innodb_status().

UNIV_INTERN void srv_free ( void  )

Frees the data structures created in srv_init().

Definition at line 1165 of file srv0srv.cc.

References mem_free, os_fast_mutex_free(), srv_free(), srv_sys, srv_sys_struct::threads, trx_i_s_cache, and trx_i_s_cache_free().

Referenced by innobase_shutdown_for_mysql(), and srv_free().

UNIV_INTERN void srv_general_init ( void  )

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

Definition at line 1192 of file srv0srv.cc.

References mem_init(), os_sync_init(), recv_sys_var_init(), srv_general_init(), sync_init(), and ut_mem_init().

Referenced by srv_boot(), and srv_general_init().

UNIV_INTERN ulint srv_get_n_threads ( void  )

Gets the number of threads in the system.

Returns
sum of srv_n_threads[]

Definition at line 873 of file srv0srv.cc.

References srv_get_n_threads(), and SRV_MASTER.

Referenced by srv_get_n_threads().

UNIV_INTERN void srv_inc_activity_count ( void  )

Increment the server activity counter.

UNIV_INTERN ibool srv_is_any_background_thread_active ( void  )

Check whether any background thread is active.

Returns
FALSE if all are are suspended or have exited.

Definition at line 2589 of file srv0srv.cc.

References srv_is_any_background_thread_active(), and SRV_MASTER.

Referenced by logs_empty_and_mark_files_at_shutdown(), and srv_is_any_background_thread_active().

UNIV_INTERN os_thread_ret_t srv_lock_timeout_thread ( void *  )

A thread which wakes up threads whose lock wait may have lasted too long.

Returns
a dummy parameter in: a dummy parameter required by os_thread_create

A thread which wakes up threads whose lock wait may have lasted too long.

Returns
a dummy parameter

Definition at line 2316 of file srv0srv.cc.

References srv_slot_struct::in_use, lock_cancel_waiting_and_release(), trx_struct::mysql_thd, os_event_reset(), os_event_wait_time_low(), os_thread_exit(), srv_lock_timeout_thread(), SRV_SHUTDOWN_CLEANUP, srv_slot_struct::suspend_time, thd_lock_wait_timeout(), srv_slot_struct::thr, thr_get_trx(), trx_is_interrupted(), ut_difftime(), ut_time(), and trx_struct::wait_lock.

Referenced by innobase_start_or_create_for_mysql(), and srv_lock_timeout_thread().

UNIV_INTERN os_thread_ret_t srv_LRU_dump_restore_thread ( void *  )

A thread which restores the buffer pool from a dump file on startup and does periodic buffer pool dumps.

Returns
a dummy parameter in: a dummy parameter required by os_thread_create

A thread which restores the buffer pool from a dump file on startup and does periodic buffer pool dumps.

Returns
a dummy parameter

Definition at line 2540 of file srv0srv.cc.

References os_thread_exit(), os_thread_get_curr_id(), os_thread_pf(), os_thread_sleep(), srv_auto_lru_dump, srv_LRU_dump_restore_thread(), and SRV_SHUTDOWN_CLEANUP.

Referenced by innobase_start_or_create_for_mysql(), and srv_LRU_dump_restore_thread().

UNIV_INTERN os_thread_ret_t srv_monitor_thread ( void *  )

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

Returns
a dummy parameter in: a dummy parameter required by os_thread_create

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

Returns
a dummy parameter

Definition at line 2151 of file srv0srv.cc.

References os_event_reset(), os_event_wait_time_low(), os_file_set_eof(), os_thread_exit(), os_thread_get_curr_id(), os_thread_pf(), srv_monitor_thread(), srv_printf_innodb_monitor(), SRV_SHUTDOWN_CLEANUP, ut_print_timestamp(), and ut_time().

Referenced by innobase_start_or_create_for_mysql(), and srv_monitor_thread().

static const std::string srv_mysql50_table_name_prefix ( "#mysql50#"  )
static

Prefix used by MySQL to indicate pre-5.1 table name encoding LOOKIE HERE!!!! This used to be srv_mysql50_table_name_prefix[10] which was a buffer overrun, because it didn't allow for the trailing '\0'. Thanks C++!

Referenced by innobase_convert_identifier(), and innobase_init().

UNIV_INTERN ibool srv_printf_innodb_monitor ( FILE *  file,
ibool  nowait,
ulint *  trx_start,
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 out: file position of the end of the list of active transactions

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 kernel mutex
trx_startout: file position of the start of the list of active transactions
trx_endout: file position of the end of the list of active transactions

Definition at line 1869 of file srv0srv.cc.

References btr_search_sys_struct::hash_index, lock_print_info_all_transactions(), lock_print_info_summary(), log_print(), mem_comm_pool, mem_pool_get_reserved(), os_aio_print(), dict_sys_struct::size, srv_printf_innodb_monitor(), sync_print(), trx_sys, ut_copy_file(), UT_LIST_GET_LEN, ut_print_timestamp(), and ut_total_allocated_memory.

Referenced by innodb_show_status(), srv_monitor_thread(), and srv_printf_innodb_monitor().

UNIV_INTERN os_thread_ret_t srv_purge_thread ( void *  )

Asynchronous purge thread.

Returns
a dummy parameter in: a dummy parameter required by os_thread_create

Asynchronous purge thread.

Returns
a dummy parameter

Definition at line 3464 of file srv0srv.cc.

References srv_slot_struct::event, srv_slot_struct::in_use, os_thread_exit(), os_thread_get_curr_id(), os_thread_pf(), os_thread_sleep(), trx_sys_struct::rseg_history_len, SRV_FORCE_NO_BACKGROUND, srv_purge_thread(), SRV_SHUTDOWN_EXIT_THREADS, SRV_WORKER, trx_purge(), trx_sys, ut_a, ut_min(), and ut_time_ms().

Referenced by innobase_start_or_create_for_mysql(), and srv_purge_thread().

UNIV_INTERN 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

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

Parameters
thrin: query thread

Definition at line 3579 of file srv0srv.cc.

References srv_que_task_enqueue_low(), srv_release_threads(), srv_sys, SRV_WORKER, srv_sys_struct::tasks, ut_ad, and UT_LIST_ADD_LAST.

Referenced by que_fork_error_handle(), que_thr_end_wait(), srv_que_task_enqueue_low(), and trx_rollback().

UNIV_INTERN void srv_release_mysql_thread_if_suspended ( que_thr_t thr)

Releases a MySQL OS thread waiting for a lock to be released, if the thread is already suspended. in: query thread associated with the MySQL OS thread

Releases a MySQL OS thread waiting for a lock to be released, if the thread is already suspended.

Parameters
thrin: query thread associated with the MySQL OS thread

Definition at line 1809 of file srv0srv.cc.

References srv_slot_struct::event, srv_slot_struct::in_use, os_event_set(), srv_release_mysql_thread_if_suspended(), srv_slot_struct::thr, and ut_ad.

Referenced by que_thr_end_wait_no_next_thr(), and srv_release_mysql_thread_if_suspended().

UNIV_INTERN ulint srv_release_threads ( enum 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 in: number of threads to release

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

Definition at line 1001 of file srv0srv.cc.

References srv_slot_struct::event, srv_slot_struct::id, srv_slot_struct::in_use, os_event_set(), srv_release_threads(), srv_slot_struct::suspended, and ut_ad.

Referenced by srv_active_wake_master_thread(), srv_que_task_enqueue_low(), srv_release_threads(), srv_wake_master_thread(), srv_wake_purge_thread(), and srv_wake_purge_thread_if_not_active().

UNIV_INTERN 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

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

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

Definition at line 841 of file srv0srv.cc.

References srv_set_io_thread_op_info(), and ut_a.

Referenced by fil_aio_wait(), os_aio_simulated_handle(), and srv_set_io_thread_op_info().

UNIV_INTERN void srv_suspend_mysql_thread ( que_thr_t thr)

Puts a MySQL OS thread to wait for a lock to be released. If an error occurs during the wait trx->error_state associated with thr is != DB_SUCCESS when we return. DB_LOCK_WAIT_TIMEOUT and DB_DEADLOCK are possible errors. DB_DEADLOCK is returned if selective deadlock resolution chose this transaction as a victim. in: query thread associated with the MySQL OS thread

Puts a MySQL OS thread to wait for a lock to be released. If an error occurs during the wait trx->error_state associated with thr is != DB_SUCCESS when we return. DB_LOCK_WAIT_TIMEOUT and DB_DEADLOCK are possible errors. DB_DEADLOCK is returned if selective deadlock resolution chose this transaction as a victim.

Parameters
thrin: query thread associated with the MySQL OS thread

Definition at line 1610 of file srv0srv.cc.

References trx_struct::dict_operation_lock_mode, trx_struct::error_state, srv_conc_slot_struct::event, srv_slot_struct::event, srv_slot_struct::in_use, que_thr_struct::is_active, que_thr_struct::lock_state, trx_struct::mysql_thd, os_event_reset(), os_event_set(), row_mysql_unfreeze_data_dictionary(), row_mysql_unlock_data_dictionary(), srv_conc_force_enter_innodb(), srv_conc_force_exit_innodb(), srv_suspend_mysql_thread(), que_thr_struct::state, srv_slot_struct::suspend_time, thd_lock_wait_timeout(), thd_set_lock_wait_time(), srv_slot_struct::thr, thr_get_trx(), trx_is_interrupted(), ut_a, ut_ad, ut_difftime(), ut_print_timestamp(), ut_time(), and ut_usectime().

Referenced by que_run_threads(), row_ins_check_foreign_constraint(), row_mysql_handle_errors(), row_update_cascade_for_mysql(), and srv_suspend_mysql_thread().

UNIV_INTERN ulint srv_thread_has_reserved_slot ( enum srv_thread_type  type)

Check whether thread type has reserved a slot.

Returns
slot number or UNDEFINED if not found in: thread type to check

Check whether thread type has reserved a slot. Return the first slot that is found. This works because we currently have only 1 thread of each type.

Returns
slot number or ULINT_UNDEFINED if not found
Parameters
typein: thread type to check

Definition at line 1052 of file srv0srv.cc.

References srv_slot_struct::in_use, srv_thread_has_reserved_slot(), srv_slot_struct::type, and ut_ad.

Referenced by innobase_start_or_create_for_mysql(), and srv_thread_has_reserved_slot().

UNIV_INTERN void srv_wake_master_thread ( void  )

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

Definition at line 2660 of file srv0srv.cc.

References SRV_MASTER, srv_release_threads(), and srv_wake_master_thread().

Referenced by innobase_shutdown_for_mysql(), row_drop_table_for_mysql(), row_truncate_table_for_mysql(), and srv_wake_master_thread().

UNIV_INTERN void srv_wake_purge_thread ( void  )

Wakes up the purge thread if it's not already awake.

Definition at line 2676 of file srv0srv.cc.

References srv_release_threads(), srv_wake_purge_thread(), SRV_WORKER, and ut_ad.

Referenced by innobase_shutdown_for_mysql(), and srv_wake_purge_thread().

UNIV_INTERN 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 operation with the kernel mutex, for performace reasons).

Definition at line 2640 of file srv0srv.cc.

References srv_release_threads(), srv_wake_purge_thread_if_not_active(), SRV_WORKER, and ut_ad.

Referenced by srv_wake_purge_thread_if_not_active(), and trx_purge_add_update_undo_to_history().

Variable Documentation

export_struc export_vars

Status variables to be passed to MySQL

Definition at line 378 of file srv0srv.cc.

Referenced by srv_export_innodb_status().

uint32_t srv_auto_lru_dump

Time in seconds between automatic buffer pool dumps

Definition at line 375 of file srv0srv.cc.

Referenced by innobase_init(), and srv_LRU_dump_restore_thread().

ulint srv_buf_pool_curr_size

current size in bytes

Definition at line 259 of file srv0srv.cc.

Referenced by buf_pool_resize().

ulint srv_buf_pool_old_size

previously requested size

Definition at line 257 of file srv0srv.cc.

Referenced by buf_pool_resize().

ulint srv_buf_pool_reads
Number of buffer pool reads that led to the

reading of a disk page

Definition at line 372 of file srv0srv.cc.

Referenced by buf_read_page(), and srv_export_innodb_status().

ulint srv_buf_pool_size

requested size in bytes

Definition at line 253 of file srv0srv.cc.

Referenced by buf_pool_resize(), innobase_init(), and innobase_start_or_create_for_mysql().

ulint srv_file_format

The file format to use on new *.ibd files.

Definition at line 127 of file srv0srv.cc.

Referenced by InnobaseEngine::doCreateTable(), and innobase_init().

my_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

Definition at line 125 of file srv0srv.cc.

Referenced by InnobaseEngine::doCreateTable(), innobase_init(), innobase_start_or_create_for_mysql(), and os_file_create_func().

const byte* srv_latin1_ordering
The sort order table of the MySQL latin1_swedish_ci character set

collation

Definition at line 246 of file srv0srv.cc.

ibool srv_locks_unsafe_for_binlog
Place locks to records only i.e. do not use next-key locking except

on duplicate key checking and foreign key checking

Definition at line 138 of file srv0srv.cc.

Referenced by innobase_init(), row_search_for_mysql(), row_unlock_for_mysql(), ha_innobase::store_lock(), ha_innobase::try_semi_consistent_read(), and ha_innobase::unlock_row().

ulint srv_max_file_format_at_startup
Whether to check file format during startup.  A value of

DICT_TF_FORMAT_MAX + 1 means no checking ie. FALSE. The default is to set it to the highest format we support.

Definition at line 131 of file srv0srv.cc.

Referenced by innobase_file_format_validate_and_set(), innobase_init(), and innobase_start_or_create_for_mysql().

srv_sys_t* srv_sys

The server system

Definition at line 785 of file srv0srv.cc.

Referenced by srv_free(), srv_init(), and srv_que_task_enqueue_low().