mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 20:11:42 +01:00
034b44cb9f
BitKeeper/etc/logging_ok: auto-union scripts/make_win_src_distribution.old: Merge rename: scripts/make_win_src_distribution.sh -> scripts/make_win_src_distribution.old BUILD/compile-pentium-debug-max: Auto merged BitKeeper/deleted/.del-sel000001.result~383913ae4505ec86: Auto merged BitKeeper/deleted/.del-sel000001.test~9567c1646058cc: Auto merged Build-tools/Bootstrap: Auto merged Build-tools/Do-compile: Auto merged Docs/Makefile.am: Auto merged client/get_password.c: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged extra/perror.c: Auto merged include/config-win.h: Auto merged include/my_sys.h: Auto merged innobase/btr/btr0cur.c: Auto merged innobase/btr/btr0pcur.c: Auto merged innobase/buf/buf0buf.c: Auto merged innobase/buf/buf0flu.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/dict/dict0load.c: Auto merged innobase/include/buf0buf.h: Auto merged innobase/include/log0recv.h: Auto merged innobase/include/row0sel.h: Auto merged innobase/include/srv0srv.h: Auto merged innobase/include/ut0mem.h: Auto merged innobase/lock/lock0lock.c: Auto merged innobase/log/log0log.c: Auto merged innobase/mem/mem0pool.c: Auto merged innobase/os/os0file.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/srv/srv0start.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/ut/ut0mem.c: Auto merged innobase/ut/ut0ut.c: Auto merged myisam/ft_boolean_search.c: Auto merged myisam/mi_check.c: Auto merged myisam/mi_extra.c: Auto merged myisam/mi_key.c: Auto merged myisam/myisamdef.h: Auto merged myisammrg/myrg_queue.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/ctype_latin1_de.result: Auto merged mysql-test/r/flush.result: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/grant_cache.result: Auto merged mysql-test/r/join.result: Auto merged mysql-test/r/join_outer.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/rpl000018.result: Auto merged mysql-test/r/rpl_insert_id.result: Auto merged mysql-test/r/rpl_master_pos_wait.result: Auto merged mysql-test/r/rpl_relayspace.result: Auto merged mysql-test/r/select_safe.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/r/type_datetime.result: Auto merged mysql-test/t/alias.test: Auto merged mysql-test/t/ctype_latin1_de.test: Auto merged mysql-test/t/fulltext_left_join.test: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/handler.test: Auto merged mysql-test/t/heap.test: Auto merged mysql-test/t/join.test: Auto merged mysql-test/t/join_outer.test: Auto merged mysql-test/t/order_by.test: Auto merged mysql-test/t/range.test: Auto merged mysql-test/t/rpl000001.test: Auto merged mysql-test/t/rpl000018.test: Auto merged mysql-test/t/rpl_insert_id.test: Auto merged mysql-test/t/sel000100.test: Auto merged mysql-test/t/select_safe.test: Auto merged mysql-test/t/type_date.test: Auto merged mysql-test/t/type_datetime.test: Auto merged mysql-test/t/user_var.test: Auto merged mysys/default.c: Auto merged mysys/mf_format.c: Auto merged mysys/my_getopt.c: Auto merged mysys/thr_lock.c: Auto merged mysys/tree.c: Auto merged scripts/Makefile.am: Auto merged scripts/mysql_install_db.sh: Auto merged scripts/mysqld_safe.sh: Auto merged sql/Makefile.am: Auto merged sql/field_conv.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisammrg.h: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/net_serv.cc: Auto merged sql/nt_servc.cc: Auto merged sql/opt_range.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_update.cc: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged sql/uniques.cc: Auto merged support-files/mysql.spec.sh: Auto merged vio/viosocket.c: Auto merged BitKeeper/deleted/.del-ctype-latin1_de.c~c5d8f9208bceb98e: merge BitKeeper/deleted/.del-mini_client.cc~8677895ec8169183: merge acinclude.m4: Merge with 4.0 (openssl patch) client/mysqlbinlog.cc: Merge with 4.0 in which we had added code from 4.1 (We are basicly only using the 4.1 code here) configure.in: Keep 4.1 file heap/hp_open.c: merge with 4.0 include/my_base.h: merge with 4.0 include/my_global.h: merge with 4.0 include/mysqld_error.h: merge with 4.0 innobase/ha/ha0ha.c: merge with 4.0 (Code should be same but we use indentaion from 4.0) innobase/log/log0recv.c: merge with 4.0 libmysql/libmysql.c: Remove with 4.0 code that was ported from 4.1 libmysqld/lib_sql.cc: merge with 4.0 myisam/mi_open.c: Remove 4.0 specific code myisam/myisamchk.c: merge with 4.0 myisammrg/myrg_rkey.c: merge with 4.0 mysql-test/r/alter_table.result: May need to be fixed after merge mysql-test/r/create.result: May need to be fixed after merge mysql-test/r/distinct.result: May need to be fixed after merge mysql-test/r/drop.result: May need to be fixed after merge mysql-test/r/fulltext.result: May need to be fixed after merge mysql-test/r/func_set.result: May need to be fixed after merge mysql-test/r/func_str.result: May need to be fixed after merge mysql-test/r/func_test.result: May need to be fixed after merge mysql-test/r/grant.result: May need to be fixed after merge mysql-test/r/group_by.result: May need to be fixed after merge mysql-test/r/handler.result: May need to be fixed after merge mysql-test/r/heap.result: May need to be fixed after merge mysql-test/r/innodb.result: May need to be fixed after merge mysql-test/r/insert.result: May need to be fixed after merge mysql-test/r/insert_select.result: May need to be fixed after merge mysql-test/r/key_diff.result: May need to be fixed after merge mysql-test/r/merge.result: May need to be fixed after merge mysql-test/r/myisam.result: May need to be fixed after merge mysql-test/r/order_by.result: May need to be fixed after merge mysql-test/r/query_cache.result: May need to be fixed after merge mysql-test/r/rpl_flush_log_loop.result: May need to be fixed after merge mysql-test/r/rpl_loaddata.result: May need to be fixed after merge mysql-test/r/rpl_log.result: May need to be fixed after merge mysql-test/r/rpl_log_pos.result: May need to be fixed after merge mysql-test/r/rpl_rotate_logs.result: May need to be fixed after merge mysql-test/r/select.result: May need to be fixed after merge mysql-test/r/union.result: May need to be fixed after merge mysql-test/r/user_var.result: May need to be fixed after merge mysql-test/t/alter_table.test: merge with 4.0 mysql-test/t/create.test: merge with 4.0 mysql-test/t/distinct.test: merge with 4.0 mysql-test/t/drop.test: merge with 4.0 mysql-test/t/flush.test: merge with 4.0 mysql-test/t/fulltext.test: merge with 4.0 mysql-test/t/func_set.test: merge with 4.0 mysql-test/t/func_str.test: merge with 4.0 mysql-test/t/func_test.test: merge with 4.0 mysql-test/t/grant.test: merge with 4.0 mysql-test/t/grant_cache.test: merge with 4.0 mysql-test/t/innodb.test: Add back EXPLAIN and SHOW KEYS statements, but make them independent of number of rows returned by InnoDB mysql-test/t/insert.test: merge with 4.0 mysql-test/t/insert_select.test: merge with 4.0 mysql-test/t/merge.test: merge with 4.0 mysql-test/t/query_cache.test: merge with 4.0 mysql-test/t/rpl_flush_log_loop.test: merge with 4.0 mysql-test/t/rpl_loaddata.test: merge with 4.0 mysql-test/t/rpl_rotate_logs.test: merge with 4.0 mysql-test/t/select.test: merge with 4.0 mysql-test/t/symlink.test: merge with 4.0 mysql-test/t/union.test: merge with 4.0 mysys/charset.c: merge with 4.0 scripts/mysql_fix_privilege_tables.sh: merge with 4.0 (Add quoting for some variables) sql/field.h: merge with 4.0 sql/ha_innodb.cc: merge with 4.0 sql/item_cmpfunc.cc: merge with 4.0 sql/item_cmpfunc.h: merge with 4.0 sql/item_func.h: merge with 4.0 sql/item_strfunc.cc: merge with 4.0 Fixed null handling with ELT() sql/item_timefunc.h: merge with 4.0 sql/lex.h: merge with 4.0 sql/log.cc: merge with 4.0 sql/log_event.cc: Merge with 4.0 Cleanups: - Indentation - #endif comments - Replace strmov() with *pos++= for two byte strings - Moved variable declarations to start of functions - Merged identical code (LOAD_EVENT) - Added casts when subtracting pointers Did a full diff between this and 4.0 to ensure that the file is correct after merge. sql/log_event.h: merge with 4.0 sql/mysql_priv.h: merge with 4.0 sql/mysqld.cc: merge with 4.0 sql/repl_failsafe.cc: merge with 4.0 sql/set_var.cc: merge with 4.0 sql/set_var.h: merge with 4.0 sql/share/czech/errmsg.txt: merge with 4.0 sql/share/danish/errmsg.txt: merge with 4.0 sql/share/dutch/errmsg.txt: merge with 4.0 sql/share/english/errmsg.txt: merge with 4.0 sql/share/estonian/errmsg.txt: merge with 4.0 sql/share/french/errmsg.txt: merge with 4.0 sql/share/german/errmsg.txt: merge with 4.0 sql/share/greek/errmsg.txt: merge with 4.0 sql/share/hungarian/errmsg.txt: merge with 4.0 sql/share/italian/errmsg.txt: merge with 4.0 sql/share/japanese/errmsg.txt: merge with 4.0 sql/share/korean/errmsg.txt: merge with 4.0 sql/share/norwegian-ny/errmsg.txt: merge with 4.0 sql/share/norwegian/errmsg.txt: merge with 4.0 sql/share/polish/errmsg.txt: merge with 4.0 sql/share/portuguese/errmsg.txt: merge with 4.0 sql/share/romanian/errmsg.txt: merge with 4.0 sql/share/russian/errmsg.txt: merge with 4.0 sql/share/slovak/errmsg.txt: merge with 4.0 sql/share/spanish/errmsg.txt: merge with 4.0 sql/share/swedish/errmsg.txt: merge with 4.0 sql/share/ukrainian/errmsg.txt: merge with 4.0 sql/slave.cc: Merge + some indentation fixes sql/slave.h: merge with 4.0 sql/sql_acl.cc: merge with 4.0 Some end space removal to make it easier to do future merges sql/sql_acl.h: merge with 4.0 sql/sql_cache.cc: merge with 4.0 sql/sql_class.h: merge with 4.0 sql/sql_handler.cc: merge with 4.0 sql/sql_lex.cc: merge with 4.0 sql/sql_lex.h: merge with 4.0 sql/sql_parse.cc: merge with 4.0 sql/sql_repl.cc: merge with 4.0 sql/sql_select.cc: merge with 4.0 sql/sql_table.cc: merge with 4.0 sql/sql_union.cc: Merge with 4.0 Note that I couldn't find out how to merge OPTION_FOUND_ROWS handling so this has to be fixed later sql/sql_yacc.yy: merge with 4.0 Removed end space to make merge easier vio/Makefile.am: merge with 4.0
434 lines
14 KiB
C
434 lines
14 KiB
C
/******************************************************
|
|
The server main program
|
|
|
|
(c) 1995 Innobase Oy
|
|
|
|
Created 10/10/1995 Heikki Tuuri
|
|
*******************************************************/
|
|
|
|
|
|
#ifndef srv0srv_h
|
|
#define srv0srv_h
|
|
|
|
#include "univ.i"
|
|
#include "sync0sync.h"
|
|
#include "os0sync.h"
|
|
#include "com0com.h"
|
|
#include "que0types.h"
|
|
#include "trx0types.h"
|
|
|
|
/* Buffer which can be used in printing fatal error messages */
|
|
extern char srv_fatal_errbuf[];
|
|
|
|
/* When this event is set the lock timeout and InnoDB monitor
|
|
thread starts running */
|
|
extern os_event_t srv_lock_timeout_thread_event;
|
|
|
|
/* If the last data file is auto-extended, we add this many pages to it
|
|
at a time */
|
|
#define SRV_AUTO_EXTEND_INCREMENT (8 * ((1024 * 1024) / UNIV_PAGE_SIZE))
|
|
|
|
/* This is set to TRUE if the MySQL user has set it in MySQL */
|
|
extern ibool srv_lower_case_table_names;
|
|
|
|
/* Server parameters which are read from the initfile */
|
|
|
|
extern char* srv_data_home;
|
|
extern char* srv_arch_dir;
|
|
|
|
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 ibool srv_created_new_raw;
|
|
|
|
#define SRV_NEW_RAW 1
|
|
#define SRV_OLD_RAW 2
|
|
|
|
extern char** srv_log_group_home_dirs;
|
|
|
|
extern ulint srv_n_log_groups;
|
|
extern ulint srv_n_log_files;
|
|
extern ulint srv_log_file_size;
|
|
extern ibool srv_log_archive_on;
|
|
extern ulint srv_log_buffer_size;
|
|
extern ulint srv_flush_log_at_trx_commit;
|
|
|
|
extern byte srv_latin1_ordering[256];/* The sort order table of the latin1
|
|
character set */
|
|
extern ulint srv_pool_size;
|
|
extern ulint srv_awe_window_size;
|
|
extern ulint srv_mem_pool_size;
|
|
extern ulint srv_lock_table_size;
|
|
|
|
extern ulint srv_n_file_io_threads;
|
|
|
|
extern ibool srv_archive_recovery;
|
|
extern dulint srv_archive_recovery_limit_lsn;
|
|
|
|
extern ulint srv_lock_wait_timeout;
|
|
|
|
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_dirty_pages_pct;
|
|
|
|
extern ulint srv_force_recovery;
|
|
extern ulint srv_thread_concurrency;
|
|
|
|
extern lint srv_conc_n_threads;
|
|
|
|
extern ibool srv_fast_shutdown;
|
|
|
|
extern ibool srv_use_doublewrite_buf;
|
|
|
|
extern ibool srv_set_thread_priorities;
|
|
extern int srv_query_thread_priority;
|
|
|
|
extern ibool srv_use_awe;
|
|
extern ibool srv_use_adaptive_hash_indexes;
|
|
/*-------------------------------------------*/
|
|
|
|
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_and_monitor_active;
|
|
extern ibool srv_error_monitor_active;
|
|
|
|
extern ulint srv_n_spin_wait_rounds;
|
|
extern ulint srv_spin_wait_delay;
|
|
extern ibool srv_priority_boost;
|
|
|
|
extern ulint srv_pool_size;
|
|
extern ulint srv_mem_pool_size;
|
|
extern ulint srv_lock_table_size;
|
|
|
|
extern ulint srv_sim_disk_wait_pct;
|
|
extern ulint srv_sim_disk_wait_len;
|
|
extern ibool srv_sim_disk_wait_by_yield;
|
|
extern ibool srv_sim_disk_wait_by_wait;
|
|
|
|
extern ibool srv_measure_contention;
|
|
extern ibool srv_measure_by_spin;
|
|
|
|
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_parsed_sql;
|
|
extern ibool srv_print_latch_waits;
|
|
|
|
extern ibool srv_test_nocache;
|
|
extern ibool srv_test_cache_evict;
|
|
|
|
extern ibool srv_test_extra_mutexes;
|
|
extern ibool srv_test_sync;
|
|
extern ulint srv_test_n_threads;
|
|
extern ulint srv_test_n_loops;
|
|
extern ulint srv_test_n_free_rnds;
|
|
extern ulint srv_test_n_reserved_rnds;
|
|
extern ulint srv_test_n_mutexes;
|
|
extern ulint srv_test_array_size;
|
|
|
|
extern ulint srv_activity_count;
|
|
|
|
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 100
|
|
|
|
/* Array of English strings describing the current state of an
|
|
i/o handler thread */
|
|
extern char* srv_io_thread_op_info[];
|
|
extern char* srv_io_thread_function[];
|
|
|
|
typedef struct srv_sys_struct srv_sys_t;
|
|
|
|
/* The server system */
|
|
extern srv_sys_t* srv_sys;
|
|
|
|
/* Alternatives for the file flush option in Unix; see the InnoDB manual about
|
|
what these mean */
|
|
#define SRV_UNIX_FDATASYNC 1 /* This is the default; it is currently mapped
|
|
to a call of fsync() because fdatasync()
|
|
seemed to corrupt files in Linux and Solaris */
|
|
#define SRV_UNIX_O_DSYNC 2
|
|
#define SRV_UNIX_LITTLESYNC 3
|
|
#define SRV_UNIX_NOSYNC 4
|
|
#define SRV_UNIX_O_DIRECT 5
|
|
|
|
/* Alternatives for file i/o in Windows */
|
|
#define SRV_WIN_IO_NORMAL 1
|
|
#define SRV_WIN_IO_UNBUFFERED 2 /* 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. */
|
|
|
|
#define SRV_FORCE_IGNORE_CORRUPT 1 /* let the server run even if it
|
|
detects a corrupt page */
|
|
#define SRV_FORCE_NO_BACKGROUND 2 /* prevent the main thread from
|
|
running: if a crash would occur
|
|
in purge, this prevents it */
|
|
#define SRV_FORCE_NO_TRX_UNDO 3 /* do not run trx rollback after
|
|
recovery */
|
|
#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. */
|
|
|
|
ulint
|
|
srv_boot(void);
|
|
/*==========*/
|
|
/* out: DB_SUCCESS or error code */
|
|
/*************************************************************************
|
|
Initializes the server. */
|
|
|
|
void
|
|
srv_init(void);
|
|
/*==========*/
|
|
/*************************************************************************
|
|
Frees the OS fast mutex created in srv_init(). */
|
|
|
|
void
|
|
srv_free(void);
|
|
/*==========*/
|
|
/*************************************************************************
|
|
Initializes the synchronization primitives, memory system, and the thread
|
|
local storage. */
|
|
|
|
void
|
|
srv_general_init(void);
|
|
/*==================*/
|
|
/*************************************************************************
|
|
Gets the number of threads in the system. */
|
|
|
|
ulint
|
|
srv_get_n_threads(void);
|
|
/*===================*/
|
|
/*************************************************************************
|
|
Returns the calling thread type. */
|
|
|
|
ulint
|
|
srv_get_thread_type(void);
|
|
/*=====================*/
|
|
/* out: SRV_COM, ... */
|
|
/*************************************************************************
|
|
Releases threads of the type given from suspension in the thread table.
|
|
NOTE! The server mutex has to be reserved by the caller! */
|
|
|
|
ulint
|
|
srv_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*
|
|
#else
|
|
ulint
|
|
#endif
|
|
srv_master_thread(
|
|
/*==============*/
|
|
/* out: a dummy parameter */
|
|
void* arg); /* in: a dummy parameter required by
|
|
os_thread_create */
|
|
/*************************************************************************
|
|
Reads a keyword and a value from a file. */
|
|
|
|
ulint
|
|
srv_read_init_val(
|
|
/*==============*/
|
|
/* out: DB_SUCCESS or error code */
|
|
FILE* initfile, /* in: file pointer */
|
|
char* keyword, /* in: keyword before value(s), or NULL if
|
|
no keyword read */
|
|
char* str_buf, /* in/out: buffer for a string value to read,
|
|
buffer size must be 10000 bytes, if NULL
|
|
then not read */
|
|
ulint* num_val, /* out: numerical value to read, if NULL
|
|
then not read */
|
|
ibool print_not_err); /* in: if TRUE, then we will not print
|
|
error messages to console */
|
|
/***********************************************************************
|
|
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). */
|
|
|
|
void
|
|
srv_active_wake_master_thread(void);
|
|
/*===============================*/
|
|
/***********************************************************************
|
|
Wakes up the master thread if it is suspended or being suspended. */
|
|
|
|
void
|
|
srv_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. */
|
|
|
|
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. */
|
|
|
|
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. */
|
|
|
|
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. */
|
|
|
|
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. */
|
|
|
|
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. */
|
|
|
|
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.
|
|
This also prints the info output by various InnoDB monitors. */
|
|
|
|
#ifndef __WIN__
|
|
void*
|
|
#else
|
|
ulint
|
|
#endif
|
|
srv_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 lasted
|
|
too long. These can be used to track bugs which cause hangs. */
|
|
|
|
#ifndef __WIN__
|
|
void*
|
|
#else
|
|
ulint
|
|
#endif
|
|
srv_error_monitor_thread(
|
|
/*=====================*/
|
|
/* out: a dummy parameter */
|
|
void* arg); /* in: a dummy parameter required by
|
|
os_thread_create */
|
|
/**********************************************************************
|
|
Sprintfs to a buffer the output of the InnoDB Monitor. */
|
|
|
|
void
|
|
srv_sprintf_innodb_monitor(
|
|
/*=======================*/
|
|
char* buf, /* in/out: buffer which must be at least 4 kB */
|
|
ulint len); /* in: length of the buffer */
|
|
|
|
|
|
/* Types for the threads existing in the system. Threads of types 4 - 9
|
|
are called utility threads. Note that utility threads are mainly disk
|
|
bound, except that version threads 6 - 7 may also be CPU bound, if
|
|
cleaning 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;
|
|
|
|
/* 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 */
|
|
com_endpoint_t* endpoint; /* the communication endpoint of the
|
|
server */
|
|
|
|
srv_table_t* threads; /* server thread table */
|
|
UT_LIST_BASE_NODE_T(que_thr_t)
|
|
tasks; /* task queue */
|
|
};
|
|
|
|
extern ulint srv_n_threads_active[];
|
|
|
|
#endif
|
|
|