Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 52c63a6cbe
Fetching contributors…

Cannot retrieve contributors at this time

891 lines (776 sloc) 33.526 kb
/*****************************************************************************
Copyright (c) 1995, 2011, Innobase Oy. All Rights Reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
briefly in the InnoDB documentation. The contributions by Google are
incorporated with their permission, and subject to the conditions contained in
the file COPYING.Google.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
gratefully acknowledged and are described briefly in the InnoDB
documentation. The contributions by Percona Inc. are incorporated with
their permission, and subject to the conditions contained in the file
COPYING.Percona.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
/**************************************************//**
@file include/srv0srv.h
The server main program
Created 10/10/1995 Heikki Tuuri
*******************************************************/
#ifndef srv0srv_h
#define srv0srv_h
#include "univ.i"
#ifndef UNIV_HOTBACKUP
#include "sync0sync.h"
#include "os0sync.h"
#include "que0types.h"
#include "trx0types.h"
extern const char* srv_main_thread_op_info;
/** Prefix used by MySQL to indicate pre-5.1 table name encoding */
extern const char srv_mysql50_table_name_prefix[9];
/* When this event is set the lock timeout and InnoDB monitor
thread starts running */
extern os_event_t srv_lock_timeout_thread_event;
/* The monitor thread waits on this event. */
extern os_event_t srv_monitor_event;
/* The lock timeout thread waits on this event. */
extern os_event_t srv_timeout_event;
/* The error monitor thread waits on this event. */
extern os_event_t srv_error_event;
/* If the last data file is auto-extended, we add this many pages to it
at a time */
#define SRV_AUTO_EXTEND_INCREMENT \
(srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE))
/* Mutex for locking srv_monitor_file */
extern mutex_t srv_monitor_file_mutex;
/* Temporary file for innodb monitor output */
extern FILE* srv_monitor_file;
/* Mutex for locking srv_dict_tmpfile.
This mutex has a very high rank; threads reserving it should not
be holding any InnoDB latches. */
extern mutex_t srv_dict_tmpfile_mutex;
/* Temporary file for output from the data dictionary */
extern FILE* srv_dict_tmpfile;
/* Mutex for locking srv_misc_tmpfile.
This mutex has a very low rank; threads reserving it should not
acquire any further latches or sleep before releasing this one. */
extern mutex_t srv_misc_tmpfile_mutex;
/* Temporary file for miscellanous diagnostic output */
extern FILE* srv_misc_tmpfile;
/* Server parameters which are read from the initfile */
extern char* srv_data_home;
#ifdef UNIV_LOG_ARCHIVE
extern char* srv_arch_dir;
#endif /* UNIV_LOG_ARCHIVE */
/** store to its own file each table created by an user; data
dictionary tables are in the system tablespace 0 */
#ifndef UNIV_HOTBACKUP
extern my_bool srv_file_per_table;
#else
extern ibool srv_file_per_table;
#endif /* UNIV_HOTBACKUP */
/** The file format to use on new *.ibd files. */
extern ulint srv_file_format;
/** 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. */
extern ulint srv_max_file_format_at_startup;
/** Place locks to records only i.e. do not use next-key locking except
on duplicate key checking and foreign key checking */
extern ibool srv_locks_unsafe_for_binlog;
/* If this flag is TRUE, then we will use the native aio of the
OS (provided we compiled Innobase with it in), otherwise we will
use simulated aio we build below with threads.
Currently we support native aio on windows and linux */
extern my_bool srv_use_native_aio;
#endif /* !UNIV_HOTBACKUP */
#ifdef __WIN__
extern ibool srv_use_native_conditions;
#endif
extern ulint srv_n_data_files;
extern char** srv_data_file_names;
extern ulint* srv_data_file_sizes;
extern ulint* srv_data_file_is_raw_partition;
extern ibool srv_auto_extend_last_data_file;
extern ulint srv_last_file_size_max;
extern char** srv_log_group_home_dirs;
#ifndef UNIV_HOTBACKUP
extern ulong srv_auto_extend_increment;
extern double srv_segment_fill_factor;
extern double srv_index_fill_factor;
extern my_bool srv_lease_fragment_extents;
extern my_bool srv_reserve_free_extents;
extern double srv_free_extents_rsvn_factor;
extern ibool srv_created_new_raw;
extern ulint srv_n_log_groups;
extern ulint srv_n_log_files;
extern ulint srv_log_file_size;
extern ulint srv_log_buffer_size;
extern ulong srv_flush_log_at_trx_commit;
extern char srv_adaptive_flushing;
/* If this flag is TRUE, then we will load the indexes' (and tables') metadata
even if they are marked as "corrupted". Mostly it is for DBA to process
corrupted index and table */
extern my_bool srv_load_corrupted;
extern ulint srv_n_corrupted_page_reads;
extern ulint srv_n_corrupted_table_opens;
/* The sort order table of the MySQL latin1_swedish_ci character set
collation */
extern const byte* srv_latin1_ordering;
#ifndef UNIV_HOTBACKUP
extern my_bool srv_use_sys_malloc;
#else
extern ibool srv_use_sys_malloc;
#endif /* UNIV_HOTBACKUP */
extern ulint srv_buf_pool_size; /*!< requested size in bytes */
extern my_bool srv_buf_pool_populate; /*!< virtual page preallocation */
extern ulint srv_buf_pool_instances; /*!< requested number of buffer pool instances */
extern my_bool srv_flush_neighbors; /*!< whether or not to flush
neighbors of a block */
extern ulint srv_buf_pool_old_size; /*!< previously requested size */
extern ulint srv_buf_pool_curr_size; /*!< current size in bytes */
extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size;
extern uint srv_buf_flush_dirty_pages_age;
extern my_bool srv_anticipatory_flushing;
extern ulint srv_n_file_io_threads;
extern my_bool srv_random_read_ahead;
extern ulong srv_read_ahead_threshold;
extern ulint srv_n_read_io_threads;
extern ulint srv_n_write_io_threads;
/* Number of IO operations per second the server can do */
extern ulong srv_io_capacity;
/* Returns the number of IO operations that is X percent of the
capacity. PCT_IO(5) -> returns the number of IO operations that
is 5% of the max where max is srv_io_capacity. */
#define PCT_IO(p) ((ulong) (srv_io_capacity * ((double) p / 100.0)))
/* The "innodb_stats_method" setting, decides how InnoDB is going
to treat NULL value when collecting statistics. It is not defined
as enum type because the configure option takes unsigned integer type. */
extern ulong srv_innodb_stats_method;
#ifdef UNIV_LOG_ARCHIVE
extern ibool srv_log_archive_on;
extern ibool srv_archive_recovery;
extern ib_uint64_t srv_archive_recovery_limit_lsn;
#endif /* UNIV_LOG_ARCHIVE */
extern char* srv_file_flush_method_str;
extern ulint srv_unix_file_flush_method;
extern ulint srv_win_file_flush_method;
extern ulint srv_max_n_open_files;
extern ulint srv_max_dirty_pages_pct;
extern ulint srv_force_recovery;
extern ulong srv_thread_concurrency;
extern ulint srv_max_n_threads;
extern lint srv_conc_n_threads;
extern ulint srv_fast_shutdown; /* If this is 1, do not do a
purge and index buffer merge.
If this 2, do not even flush the
buffer pool to data files at the
shutdown: we effectively 'crash'
InnoDB (but lose no committed
transactions). */
extern ibool srv_innodb_status;
extern unsigned long long srv_stats_sample_pages;
extern ibool srv_use_doublewrite_buf;
extern ibool srv_use_checksums;
extern ulong srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
extern ulong srv_replication_delay;
/*-------------------------------------------*/
extern ulint srv_n_lock_deadlock_count;
extern ulint srv_n_rows_inserted;
extern ulint srv_n_rows_updated;
extern ulint srv_n_rows_deleted;
extern ulint srv_n_rows_read;
extern ibool srv_print_innodb_monitor;
extern ibool srv_print_innodb_lock_monitor;
extern ibool srv_print_innodb_tablespace_monitor;
extern ibool srv_print_verbose_log;
extern ibool srv_print_innodb_table_monitor;
extern ibool srv_lock_timeout_active;
extern ibool srv_monitor_active;
extern ibool srv_error_monitor_active;
extern ulong srv_n_spin_wait_rounds;
extern ulong srv_n_free_tickets_to_enter;
extern ulong srv_thread_sleep_delay;
extern ulong srv_spin_wait_delay;
extern ibool srv_priority_boost;
extern ulint srv_truncated_status_writes;
extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size;
#ifdef UNIV_DEBUG
extern ibool srv_print_thread_releases;
extern ibool srv_print_lock_waits;
extern ibool srv_print_buf_io;
extern ibool srv_print_log_io;
extern ibool srv_print_latch_waits;
#else /* UNIV_DEBUG */
# 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
#endif /* UNIV_DEBUG */
extern ulint srv_activity_count;
extern ulint srv_fatal_semaphore_wait_threshold;
#define SRV_SEMAPHORE_WAIT_EXTENSION 7200
extern ulint srv_dml_needed_delay;
extern mutex_t* kernel_mutex_temp;/* mutex protecting the server, trx structs,
query threads, and lock table: we allocate
it from dynamic memory to get it to the
same DRAM page as other hotspot semaphores */
#define kernel_mutex (*kernel_mutex_temp)
#define SRV_MAX_N_IO_THREADS 130
/* Array of English strings describing the current state of an
i/o handler thread */
extern const char* srv_io_thread_op_info[];
extern const char* srv_io_thread_function[];
/* the number of the log write requests done */
extern ulint srv_log_write_requests;
/* the number of physical writes to the log performed */
extern ulint srv_log_writes;
/* amount of data written to the log files in bytes */
extern ulint srv_os_log_written;
/* amount of writes being done to the log files */
extern ulint srv_os_log_pending_writes;
/* we increase this counter, when there we don't have enough space in the
log buffer and have to flush it */
extern ulint srv_log_waits;
/* the number of purge threads to use from the worker pool (currently 0 or 1) */
extern ulong srv_n_purge_threads;
/* the number of pages to purge in one batch */
extern ulong srv_purge_batch_size;
/* the number of rollback segments to use */
extern ulong srv_rollback_segments;
/* variable that counts amount of data read in total (in bytes) */
extern ulint srv_data_read;
/* here we count the amount of data written in total (in bytes) */
extern ulint srv_data_written;
/* this variable counts the amount of times, when the doublewrite buffer
was flushed */
extern ulint srv_dblwr_writes;
/* here we store the number of pages that have been flushed to the
doublewrite buffer */
extern ulint srv_dblwr_pages_written;
/* in this variable we store the number of write requests issued */
extern ulint srv_buf_pool_write_requests;
/* here we store the number of times when we had to wait for a free page
in the buffer pool. It happens when the buffer pool is full and we need
to make a flush, in order to be able to read or create a page. */
extern ulint srv_buf_pool_wait_free;
/* variable to count the number of pages that were written from the
buffer pool to disk */
extern ulint srv_buf_pool_flushed;
/** Number of buffer pool reads that led to the
reading of a disk page */
extern ulint srv_buf_pool_reads;
/** Number of pages scanned as part of a flush batch. */
extern ulint srv_buf_pool_flush_batch_scanned;
/** Number of pages flushed as part of sync batches. */
extern ulint srv_buf_pool_flush_sync_page;
/** Number of pages flushed as part of async batches. */
extern ulint srv_buf_pool_flush_async_page;
/** Number of pages flushed as part of adaptive batches. */
extern ulint srv_buf_pool_flush_adaptive_pages;
/** Number of pages flushed as part of anticipatory batches. */
extern ulint srv_buf_pool_flush_anticipatory_pages;
/** Number of pages flushed as part of background (async) batches. */
extern ulint srv_buf_pool_flush_background_pages;
/** Number of pages flushed as part of max_dirty batches. */
extern ulint srv_buf_pool_flush_max_dirty_pages;
/** Number of pages flushed as part of neighbor flush. */
extern ulint srv_buf_pool_flush_neighbor_pages;
/** Number of pages scanned as part of LRU batches. */
extern ulint srv_buf_pool_flush_LRU_batch_scanned;
/** Number of pages flushed as part of LRU batches. */
extern ulint srv_buf_pool_flush_LRU_page_count;
/** Number of pages scanned as part of LRU search. */
extern ulint srv_buf_pool_LRU_search_scanned;
/** Number of pages scanned as part of LRU unzip search. */
extern ulint srv_buf_pool_LRU_unzip_search_scanned;
/** Number of searches performed for a clean page. */
extern ulint srv_buf_pool_LRU_get_free_search;
/** Status variables to be passed to MySQL */
typedef struct export_var_struct export_struc;
/** Status variables to be passed to MySQL */
extern export_struc export_vars;
/** The server system */
typedef struct srv_sys_struct srv_sys_t;
/** The server system */
extern srv_sys_t* srv_sys;
# ifdef UNIV_PFS_THREAD
/* Keys to register InnoDB threads with performance schema */
extern mysql_pfs_key_t trx_rollback_clean_thread_key;
extern mysql_pfs_key_t io_handler_thread_key;
extern mysql_pfs_key_t srv_lock_timeout_thread_key;
extern mysql_pfs_key_t srv_error_monitor_thread_key;
extern mysql_pfs_key_t srv_monitor_thread_key;
extern mysql_pfs_key_t srv_master_thread_key;
extern mysql_pfs_key_t srv_purge_thread_key;
/* This macro register the current thread and its key with performance
schema */
# define pfs_register_thread(key) \
do { \
if (PSI_server) { \
struct PSI_thread* psi = PSI_server->new_thread(key, NULL, 0);\
if (psi) { \
PSI_server->set_thread(psi); \
} \
} \
} while (0)
/* This macro delist the current thread from performance schema */
# define pfs_delete_thread() \
do { \
if (PSI_server) { \
PSI_server->delete_current_thread(); \
} \
} while (0)
# endif /* UNIV_PFS_THREAD */
#endif /* !UNIV_HOTBACKUP */
/** Types of raw partitions in innodb_data_file_path */
enum {
SRV_NOT_RAW = 0, /*!< Not a raw partition */
SRV_NEW_RAW, /*!< A 'newraw' partition, only to be
initialized */
SRV_OLD_RAW /*!< An initialized raw partition */
};
/** Alternatives for the file flush option in Unix; see the InnoDB manual
about what these mean */
enum {
SRV_UNIX_FSYNC = 1, /*!< 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 */
};
/** Alternatives for file i/o in Windows */
enum {
SRV_WIN_IO_NORMAL = 1, /*!< buffered I/O */
SRV_WIN_IO_UNBUFFERED /*!< unbuffered I/O; this is the default */
};
/** 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. */
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: if a crash would occur
in purge, this prevents it */
SRV_FORCE_NO_TRX_UNDO = 3, /*!< do not run trx rollback after
recovery */
SRV_FORCE_NO_IBUF_MERGE = 4, /*!< prevent also ibuf operations:
if they would cause a crash, better
not do them */
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 */
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. This is the default setting
for innodb_stats_method */
SRV_STATS_NULLS_UNEQUAL, /* All NULL values are treated as
NOT equal. */
SRV_STATS_NULLS_IGNORED /* NULL values are ignored */
};
typedef enum srv_stats_method_name_enum srv_stats_method_name_t;
#ifndef UNIV_HOTBACKUP
/** Types of threads existing in the system. */
enum srv_thread_type {
SRV_WORKER = 0, /**< threads serving parallelized queries and
queries released from lock wait */
SRV_MASTER /**< the master thread, (whose type number must
be biggest) */
};
/*********************************************************************//**
Boots Innobase server.
@return DB_SUCCESS or error code */
UNIV_INTERN
ulint
srv_boot(void);
/*==========*/
/*********************************************************************//**
Initializes the server. */
UNIV_INTERN
void
srv_init(void);
/*==========*/
/*********************************************************************//**
Frees the data structures created in srv_init(). */
UNIV_INTERN
void
srv_free(void);
/*==========*/
/*********************************************************************//**
Initializes the synchronization primitives, memory system, and the thread
local storage. */
UNIV_INTERN
void
srv_general_init(void);
/*==================*/
/*********************************************************************//**
Gets the number of threads in the system.
@return sum of srv_n_threads[] */
UNIV_INTERN
ulint
srv_get_n_threads(void);
/*===================*/
/*********************************************************************//**
Check whether thread type has reserved a slot.
@return slot number or UNDEFINED if not found*/
UNIV_INTERN
ulint
srv_thread_has_reserved_slot(
/*=========================*/
enum srv_thread_type type); /*!< in: thread type to check */
/*********************************************************************//**
Sets the info describing an i/o thread current state. */
UNIV_INTERN
void
srv_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!
@return number of threads released: this may be less than n if not
enough threads were suspended at the moment */
UNIV_INTERN
ulint
srv_release_threads(
/*================*/
enum srv_thread_type type, /*!< in: thread type */
ulint n); /*!< in: number of threads to release */
/*********************************************************************//**
The master thread controlling the server.
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
srv_master_thread(
/*==============*/
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
/*******************************************************************//**
Wakes up the purge thread if it's not already awake. */
UNIV_INTERN
void
srv_wake_purge_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). */
UNIV_INTERN
void
srv_active_wake_master_thread(void);
/*===============================*/
/*******************************************************************//**
Wakes up the master thread if it is suspended or being suspended. */
UNIV_INTERN
void
srv_wake_master_thread(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). */
UNIV_INTERN
void
srv_wake_purge_thread_if_not_active(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. */
UNIV_INTERN
void
srv_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 inside
InnoDB. This must be called when a thread ends a lock wait. */
UNIV_INTERN
void
srv_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 the
end of an SQL statement. */
UNIV_INTERN
void
srv_conc_force_exit_innodb(
/*=======================*/
trx_t* trx); /*!< in: transaction object associated with the
thread */
/*********************************************************************//**
This must be called when a thread exits InnoDB. */
UNIV_INTERN
void
srv_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 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. */
UNIV_INTERN
void
srv_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 the
thread is already suspended. */
UNIV_INTERN
void
srv_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.
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
srv_lock_timeout_thread(
/*====================*/
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
/*********************************************************************//**
A thread which prints the info output by various InnoDB monitors.
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
srv_monitor_thread(
/*===============*/
void* arg); /*!< 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.
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
srv_error_monitor_thread(
/*=====================*/
void* arg); /*!< in: a dummy parameter required by
os_thread_create */
/******************************************************************//**
Outputs to a file the output of the InnoDB Monitor.
@return FALSE if not all information printed
due to failure to obtain necessary mutex */
UNIV_INTERN
ibool
srv_printf_innodb_monitor(
/*======================*/
FILE* file, /*!< in: output stream */
ibool nowait, /*!< in: whether to wait for kernel mutex */
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 */
UNIV_INTERN
void
srv_export_innodb_status(void);
/*==========================*/
/*********************************************************************//**
Asynchronous purge thread.
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
srv_purge_thread(
/*=============*/
void* arg __attribute__((unused))); /*!< in: a dummy parameter
required by os_thread_create */
/**********************************************************************//**
Enqueues a task to server task queue and releases a worker thread, if there
is a suspended one. */
UNIV_INTERN
void
srv_que_task_enqueue_low(
/*=====================*/
que_thr_t* thr); /*!< in: query thread */
/**********************************************************************//**
Check whether any background thread is active. If so, return the thread
type.
@return ULINT_UNDEFINED if all are are suspended or have exited, thread
type if any are still active. */
UNIV_INTERN
ulint
srv_get_active_thread_type(void);
/*============================*/
/** Status variables to be passed to MySQL */
struct export_var_struct{
ulint innodb_data_pending_reads; /*!< Pending reads */
ulint innodb_data_pending_writes; /*!< Pending writes */
ulint innodb_data_pending_fsyncs; /*!< Pending fsyncs */
ulint innodb_data_fsyncs; /*!< Number of fsyncs so far */
ulint innodb_data_read; /*!< Data bytes read */
ulint innodb_data_writes; /*!< I/O write requests */
ulint innodb_data_written; /*!< Data bytes written */
ulint innodb_data_reads; /*!< I/O read requests */
ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */
ulint innodb_buffer_pool_pages_data; /*!< Data pages */
ulint innodb_buffer_pool_pages_dirty; /*!< Dirty data pages */
ulint innodb_buffer_pool_pages_misc; /*!< Miscellanous pages */
ulint innodb_buffer_pool_pages_free; /*!< Free pages */
#ifdef UNIV_DEBUG
ulint innodb_buffer_pool_pages_latched; /*!< Latched pages */
#endif /* UNIV_DEBUG */
ulint innodb_buffer_pool_read_requests; /*!< buf_pool->stat.n_page_gets */
ulint innodb_buffer_pool_reads; /*!< srv_buf_pool_reads */
ulint innodb_buffer_pool_wait_free; /*!< srv_buf_pool_wait_free */
ulint innodb_buffer_pool_pages_flushed; /*!< srv_buf_pool_flushed */
ulint innodb_buffer_pool_write_requests;/*!< srv_buf_pool_write_requests */
ulint innodb_buffer_pool_read_ahead_rnd;/*!< srv_read_ahead_rnd */
ulint innodb_buffer_pool_read_ahead; /*!< srv_read_ahead */
ulint innodb_buffer_pool_read_ahead_evicted;/*!< srv_read_ahead evicted*/
ulint innodb_dblwr_pages_written; /*!< srv_dblwr_pages_written */
ulint innodb_dblwr_writes; /*!< srv_dblwr_writes */
ulint innodb_files_open; /*!< os_file_acct.n_open_files */
ulint innodb_files_opened; /*!< os_file_acct.n_open */
ulint innodb_files_closed; /*!< os_file_acct.n_close */
ulint innodb_files_flushed; /*!< os_file_acct.n_flush */
ibool innodb_have_atomic_builtins; /*!< HAVE_ATOMIC_BUILTINS */
ulint innodb_ibuf_discarded_delete_marks;/*!< stat->n_discarded_ops[IBUF_OP_DELETE_MARK] */
ulint innodb_ibuf_discarded_deletes; /*!< stat->n_discarded_ops[IBUF_OP_DELETE] */
ulint innodb_ibuf_discarded_inserts; /*!< stat->n_discarded_ops[IBUF_OP_INSERT] */
ulint innodb_ibuf_merged_delete_marks; /*!< stat->n_merged_ops[IBUF_OP_DELETE_MARK] */
ulint innodb_ibuf_merged_deletes; /*!< stat->n_merged_ops[IBUF_OP_DELETE] */
ulint innodb_ibuf_merged_inserts; /*!< stat->n_merged_ops[IBUF_OP_INSERT] */
ulint innodb_ibuf_merged_pages; /*!< stat->n_merges */
ulint innodb_ibuf_pages; /*!< ibuf->size */
ulint innodb_lock_deadlocks; /*!< srv_n_lock_deadlock_count */
ulint innodb_log_waits; /*!< srv_log_waits */
ulint innodb_log_write_requests; /*!< srv_log_write_requests */
ulint innodb_log_writes; /*!< srv_log_writes */
ib_uint64_t innodb_lsn_current; /*!< log_sys->lsn */
ib_uint64_t innodb_lsn_flushed; /*!< log_sys->flushed_to_disk_lsn */
ib_uint64_t innodb_lsn_checkpoint; /*!< log_sys->last_checkpoint_lsn */
ulint innodb_os_log_written; /*!< srv_os_log_written */
ulint innodb_os_log_fsyncs; /*!< fil_n_log_flushes */
ulint innodb_os_log_pending_writes; /*!< srv_os_log_pending_writes */
ulint innodb_os_log_pending_fsyncs; /*!< fil_n_pending_log_flushes */
ulint innodb_page_size; /*!< UNIV_PAGE_SIZE */
ulint innodb_pages_created; /*!< buf_pool->stat.n_pages_created */
ulint innodb_pages_read; /*!< buf_pool->stat.n_pages_read */
ulint innodb_pages_written; /*!< buf_pool->stat.n_pages_written */
ulint innodb_corrupted_page_reads; /*!< srv_n_corrupted_page_reads */
ulint innodb_corrupted_table_opens; /*!< srv_n_corrupted_table_opens */
ulint innodb_row_lock_waits; /*!< srv_n_lock_wait_count */
ulint innodb_row_lock_current_waits; /*!< srv_n_lock_wait_current_count */
ib_int64_t innodb_row_lock_time; /*!< srv_n_lock_wait_time
/ 1000 */
ulint innodb_row_lock_time_avg; /*!< srv_n_lock_wait_time
/ 1000
/ srv_n_lock_wait_count */
ulint innodb_row_lock_time_max; /*!< srv_n_lock_max_wait_time
/ 1000 */
ulint innodb_rows_read; /*!< srv_n_rows_read */
ulint innodb_rows_inserted; /*!< srv_n_rows_inserted */
ulint innodb_rows_updated; /*!< srv_n_rows_updated */
ulint innodb_rows_deleted; /*!< srv_n_rows_deleted */
ulint innodb_tablespace_files_open; /*!< fil_n_tablespace_opened
- fil_n_tablespace_closed */
ulint innodb_tablespace_files_opened; /*!< fil_n_tablespace_opened */
ulint innodb_tablespace_files_closed; /*!< fil_n_tablespace_closed */
ulint innodb_truncated_status_writes; /*!< srv_truncated_status_writes */
ulint innodb_buffer_pool_flush_batch_scanned;
/*!< srv_buf_pool_flush_batch_scanned */
ulint innodb_buffer_pool_flush_sync_page;
/*!< srv_buf_pool_flush_sync_page */
ulint innodb_buffer_pool_flush_async_page;
/*!< srv_buf_pool_flush_async_page */
ulint innodb_buffer_pool_flush_adaptive_pages;
/*!< srv_buf_pool_flush_adaptive_pages */
ulint innodb_buffer_pool_flush_anticipatory_pages;
/*!< srv_buf_pool_flush_anticipatory_pages */
ulint innodb_buffer_pool_flush_background_pages;
/*!< srv_buf_pool_flush_background_pages */
ulint innodb_buffer_pool_flush_max_dirty_pages;
/*!< srv_buf_pool_flush_max_dirty_pages */
ulint innodb_buffer_pool_flush_neighbor_pages;
/*!< srv_buf_pool_flush_neighbor_pages */
ulint innodb_buffer_pool_flush_LRU_batch_scanned;
/*!< srv_buf_pool_flush_LRU_batch_scanned */
ulint innodb_buffer_pool_flush_LRU_page_count;
/*!< srv_buf_pool_flush_LRU_page_count */
ulint innodb_buffer_pool_LRU_search_scanned;
/*!< srv_buf_pool_LRU_search_scanned */
ulint innodb_buffer_pool_LRU_unzip_search_scanned;
/*!< srv_buf_pool_LRU_unzip_search_scanned */
ulint innodb_buffer_pool_LRU_get_free_search;
/*!< srv_buf_pool_LRU_get_free_search */
ulint innodb_btree_page_reorganize; /*!< btr_n_page_reorganize */
ulint innodb_btree_page_split; /*!< btr_n_page_split */
ulint innodb_btree_page_merge; /*!< btr_n_page_merge */
ulint innodb_btree_page_merge_succ; /*!< btr_n_page_merge_succ */
ulint innodb_btree_page_discard; /*!< btr_n_page_discard */
ib_uint64_t innodb_trx_max_id; /*!< trx_sys->max_trx_id */
ib_uint64_t innodb_purge_trx_no; /*!< purge_sys->purge_trx_no */
ib_uint64_t innodb_purge_undo_no; /*!< purge_sys->purge_undo_no */
ib_int64_t innodb_mysql_master_log_pos; /*!< Master binlog file position. */
char innodb_mysql_master_log_name[TRX_SYS_MYSQL_LOG_NAME_LEN + 1];
/*!< Master binlog file name. */
};
/** 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;
/** The server system struct */
struct srv_sys_struct{
srv_table_t* threads; /*!< server thread table */
UT_LIST_BASE_NODE_T(que_thr_t)
tasks; /*!< task queue */
};
extern ulint srv_n_threads_active[];
#else /* !UNIV_HOTBACKUP */
# define srv_use_adaptive_hash_indexes FALSE
# define srv_use_checksums TRUE
# define srv_use_native_aio FALSE
# define srv_force_recovery 0UL
# define srv_set_io_thread_op_info(t,info) ((void) 0)
# define srv_is_being_started 0
# define srv_win_file_flush_method SRV_WIN_IO_UNBUFFERED
# define srv_unix_file_flush_method SRV_UNIX_O_DSYNC
# define srv_start_raw_disk_in_use 0
# define srv_file_per_table 1
#endif /* !UNIV_HOTBACKUP */
#endif
Jump to Line
Something went wrong with that request. Please try again.