mirror of
https://github.com/MariaDB/server.git
synced 2025-02-02 12:01:42 +01:00
810efe1245
------------------------------------------------------------------------ r2867 | marko | 2008-10-24 10:24:17 +0300 (Fri, 24 Oct 2008) | 2 lines branches/zip: ChangeLog: Document r2763, r2794, r2683, r2799, r2809, r2866. ------------------------------------------------------------------------ r2869 | vasil | 2008-10-24 11:14:16 +0300 (Fri, 24 Oct 2008) | 4 lines branches/zip: White space cleanup in ChangeLog ------------------------------------------------------------------------ r2870 | vasil | 2008-10-24 13:36:14 +0300 (Fri, 24 Oct 2008) | 8 lines branches/zip: Remove a statement that causes the innodb-index test to fail. The change in behavior was introduced in MySQL BZR-r2738. Suggested by: Marko ------------------------------------------------------------------------ r2871 | vasil | 2008-10-24 13:48:38 +0300 (Fri, 24 Oct 2008) | 5 lines branches/zip: Adjust mysql-test/patches/innodb-index.diff after the change to mysql-test/innodb-index.(test|result) in r2870. ------------------------------------------------------------------------ r2878 | calvin | 2008-10-27 11:05:42 +0200 (Mon, 27 Oct 2008) | 8 lines branches/zip: port the fix of Bug#19424 - InnoDB: Possibly a memory overrun of the buffer being freed with 64-bit Microsoft Visual C++. The changed file: CMakeLists.txt: Removing Win64 compiler optimizations for all innodb/mem/* files. ------------------------------------------------------------------------ r2884 | vasil | 2008-10-27 11:48:46 +0200 (Mon, 27 Oct 2008) | 7 lines branches/zip: ChangeLog: Add entry for the fix of Bug#19424 InnoDB: Possibly a memory overrun of the buffer being freed (64-bit Visual C) ------------------------------------------------------------------------ r2886 | calvin | 2008-10-27 22:39:11 +0200 (Mon, 27 Oct 2008) | 8 lines branches/zip: This patch is to solve the issue that file handles can not cross DLL/EXE boundaries on Windows. In builtin InnoDB, it makes call to MySQL server for creating tmp files. innobase_mysql_tmpfile is now rewritten for the plugin. rb://5 Approved by: Marko ------------------------------------------------------------------------ r2887 | calvin | 2008-10-27 22:48:29 +0200 (Mon, 27 Oct 2008) | 44 lines branches/zip: implement the delayloading of externals for the plugin on Windows, which includes: * Load mysqld.map and insert all symbol/address pairs into hash for quick access * Resolves all external data variables. The delayloading mechanism in MSVC does not support automatic imports of data variables. A workaround is to explicitly handle the data import using the delay loader during the initialization of the plugin. * Resolves all external functions during run-time, by implementing the delayed loading helper function delayLoadHelper2, which is called by run-time as well as HrLoadAllImportsForDll. The delay loader reuses the hash implementation in InnoDB. The normal hash_create (in hash0hash.c) creates hash tables in buffer pool. But the delay loader is invoked before the engine is initialized, and buffer pools are not ready yet. Instead, the delay loader has its own implementation of hash_create() and hash_table_free(), called wdl_hash_create() and wdl_hash_table_free(). This patch should be used with other two patches in order to build a dynamically linked plugin on Windows: * patch for tmpfile functions (r2886) * patch for "build" files (to be committed) The list of file changed: handler/handler0vars.h: new file, defines a list of external data variables (no external functions). handler/win_delay_loader.cc: new file, the implementation of the delay loader for Windows plugin. handler/ha_innodb.cc: add a header file, and changes for copying the system variables. handler/handler0alter.cc: add a header file handler/i_s.cc: add a header file rb://27 Reviewed by: Sunny, Marko Approved by: Sunny ------------------------------------------------------------------------ r2888 | calvin | 2008-10-28 01:51:49 +0200 (Tue, 28 Oct 2008) | 25 lines branches/zip: for building dynamic plugin on Windows, ha_innodb.dll, when INNODB_DYNAMIC_PLUGIN is specified. The changes are: CMakeLists.txt: add project ha_innodb for dynamic plugin on Windows. ha_innodb depends on project mysqld. ha_innodb.def: a new file with standard exports for a dynamic plugin. Two new files will be added: * sql/mysqld.def: .def file for 32-bit compiler * sql/mysqld_x64.def: .def file for x64 compiler It is also required to apply a patch to the MySQL source tree. The patch is described in win-plugin/README: win-plugin/win-plugin.diff - a patch to be applied to MySQL source tree. When applied, the following files will be modified: * CMakeLists.txt: add INNODB_DYNAMIC_PLUGIN and _USE_32BIT_TIME_T * sql/CMakeLists.txt: add mysqld.def or mysqld_x64.def for mysqld * win/configure.js: add INNODB_DYNAMIC_PLUGIN * win/build-vs71.bat: provide an option to specify CMAKE_BUILD_TYPE * win/build-vs8.bat: provide an option to specify CMAKE_BUILD_TYPE * win/build-vs8_x64.bat: provide an option to specify CMAKE_BUILD_TYPE ------------------------------------------------------------------------ r2894 | marko | 2008-10-28 08:36:39 +0200 (Tue, 28 Oct 2008) | 4 lines branches/zip: dict_str_starts_with_keyword(): Removed this unused function. Spotted by Sunny. ------------------------------------------------------------------------ r2895 | vasil | 2008-10-28 08:40:45 +0200 (Tue, 28 Oct 2008) | 6 lines branches/zip: ChangeLog: add entry for the Windows plugin. ------------------------------------------------------------------------ r2917 | marko | 2008-10-28 23:53:23 +0200 (Tue, 28 Oct 2008) | 3 lines branches/zip: innodb_plugin_init(): Do not copy session variables, even when the variable is a global variable in the built-in InnoDB. ------------------------------------------------------------------------ r2918 | calvin | 2008-10-29 00:08:11 +0200 (Wed, 29 Oct 2008) | 2 lines branches/zip: fix a problem introduced in r2917 - dyn is not initialized. Move the check into for(). ------------------------------------------------------------------------ r2922 | calvin | 2008-10-29 08:29:01 +0200 (Wed, 29 Oct 2008) | 16 lines branches/zip: fix issue #102 - Windows plugin: resolve dbug functions during run-time. Implement wrapper functions in the plugin. The plugin will get the function entries from mysqld.exe during the init, and invoke the corresponding functions (in mysqld.exe). The list of functions are: _db_pargs_ _db_doprnt_ _db_enter_ _db_return_ _db_dump_ rb://38 Approved by: Marko ------------------------------------------------------------------------ r2923 | marko | 2008-10-29 09:52:30 +0200 (Wed, 29 Oct 2008) | 1 line branches/zip: ChangeLog: Mention Bug #27276. ------------------------------------------------------------------------ r2925 | calvin | 2008-10-29 10:09:41 +0200 (Wed, 29 Oct 2008) | 16 lines branches/zip: change function names in sql/mysqld.def in order to work with 5.1.29-rc. In 5.1.29, the following function names are changed: _hash_init hash_free hash_search hash_delete changed to _my_hash_init my_hash_free my_hash_search my_hash_delete Approved by: Marko (on IM) ------------------------------------------------------------------------ r2927 | marko | 2008-10-29 11:43:23 +0200 (Wed, 29 Oct 2008) | 4 lines branches/zip: ha_innodb.cc: Make some functions static, so that they will not be compiled as weak global symbols. These functions must not be redirected to the built-in InnoDB. ------------------------------------------------------------------------ r2928 | michael | 2008-10-29 19:20:10 +0200 (Wed, 29 Oct 2008) | 4 lines Remove unnecessary assert Approved by: Heikki, over IM ------------------------------------------------------------------------ r2930 | marko | 2008-10-29 21:39:24 +0200 (Wed, 29 Oct 2008) | 33 lines branches/zip: Merge revisions 2854:2929 from branches/5.1, except r2924, which was merged from branches/zip r2866 to branches/5.1 and except r2879 which was merged separately by Calvin: ------------------------------------------------------------------------ r2902 | vasil | 2008-10-28 12:10:25 +0200 (Tue, 28 Oct 2008) | 10 lines branches/5.1: Fix Bug#38189 innodb_stats_on_metadata missing Make the variable innodb_stats_on_metadata visible to the users and also settable at runtime. Previously it was only "visible" as a command line startup option to mysqld. Approved by: Marko (https://svn.innodb.com/rb/r/36) ------------------------------------------------------------------------ r2929 | marko | 2008-10-29 21:26:14 +0200 (Wed, 29 Oct 2008) | 13 lines branches/5.1: dtype_get_sql_null_size(): return the correct storage size of a SQL NULL column. (Bug #40369) When MySQL Bug #20877 was fixed in r834, this function was accidentally modified to return 0 or 1. Apparently, the only impact of this bug is that fixed-length columns cannot be updated in-place from or to SQL NULL, even in ROW_FORMAT=REDUNDANT. After this fix, fixed-length columns in ROW_FORMAT=REDUNDANT will have a constant storage size as they should, no matter if NULL or non-NULL. The bug caused fixed-length NULL columns to occupy 1 byte. rb://37 approved by Heikki over IM. ------------------------------------------------------------------------ ------------------------------------------------------------------------ r2931 | vasil | 2008-10-29 22:10:40 +0200 (Wed, 29 Oct 2008) | 4 lines branches/zip: Add 2 ChangeLog entries for the 2 bugfixes that were merged from branches/5.1. ------------------------------------------------------------------------ r2935 | vasil | 2008-10-30 12:17:23 +0200 (Thu, 30 Oct 2008) | 17 lines branches/zip: Fix "Bug#40360 Binlog related errors with binlog off" in InnoDB code in order to have a Bug#40360-free InnoDB Plugin 1.0.2. The fix does check whether binary logging is enabled in MySQL by accessing the opt_bin_log global variable that is defined in sql/mysqld.cc. In case MySQL does develop another solution to this via Bug#40360 then we can revert this patch (except the mysql-tests). The windows-plugin part of this fix will be committed as a separate commit to ease eventual merge into branches/5.1 [note from the future: the separate commit went into r2936]. Approved by: Marko (https://svn.innodb.com/rb/r/39) ------------------------------------------------------------------------ r2936 | vasil | 2008-10-30 12:24:09 +0200 (Thu, 30 Oct 2008) | 7 lines branches/zip: Followup to r2935: add the Windows Delay Loader stuff for the MySQL variable that we are accessing. If someday we have another solution for Bug#40360 Binlog related errors with binlog off then this should also be reverted. ------------------------------------------------------------------------ r2937 | vasil | 2008-10-30 12:28:47 +0200 (Thu, 30 Oct 2008) | 4 lines branches/zip: Add ChangeLog entry for Bug#40360 Binlog related errors with binlog off ------------------------------------------------------------------------ r2938 | vasil | 2008-10-30 12:33:28 +0200 (Thu, 30 Oct 2008) | 5 lines branches/zip: Non-functional change: convert handler/handler0vars.h and handler/win_delay_loader.cc from \r\n (dos) to \n (unix) line terminators. ------------------------------------------------------------------------ r2939 | marko | 2008-10-30 12:38:18 +0200 (Thu, 30 Oct 2008) | 2 lines branches/zip: Set svn:eol-style native on some recently added text files. ------------------------------------------------------------------------ r2940 | marko | 2008-10-30 12:46:21 +0200 (Thu, 30 Oct 2008) | 1 line branches/zip: ChangeLog, ha_innodb.def: Set svn:eol-style native ------------------------------------------------------------------------ r2941 | vasil | 2008-10-30 19:34:27 +0200 (Thu, 30 Oct 2008) | 4 lines branches/zip: Increment the InnoDB Plugin version from 1.0.1 to 1.0.2. ------------------------------------------------------------------------ r2943 | sunny | 2008-10-31 09:40:29 +0200 (Fri, 31 Oct 2008) | 15 lines branches/zip: 1. We add a vector of locks to trx_t. This array contains the autoinc locks granted to a transaction. There is one per table. 2. We enforce releasing of these locks in the reverse order from the one in which they are acquired. The assumption is that since the AUTOINC locks are statement level locks. Nested statements introduced by triggers are stacked it should hold. There was some cleanup done to the vector code too by adding const and some new functions. Rename dict_table_t::auto_inc_lock to autoinc_lock. Fix Bug#26316 Triggers create duplicate entries on auto-increment columns rb://22 ------------------------------------------------------------------------ r2944 | vasil | 2008-10-31 09:44:16 +0200 (Fri, 31 Oct 2008) | 12 lines branches/zip: Revert our temporary fix for "Bug#40360 Binlog related errors with binlog off" (r2935, r2936) and deploy MySQL's one, but put the function mysql_bin_log_is_engaged() inside mysql_addons.cc instead of in mysql's log.cc and use a different name for it so there is no collision when MySQL adds this function in log.cc. [note from the future: the windows part of this patch went into r2947] Approved by: Marko (https://svn.innodb.com/rb/r/41/) ------------------------------------------------------------------------ r2945 | sunny | 2008-10-31 09:44:45 +0200 (Fri, 31 Oct 2008) | 2 lines branches/zip: Update ChangeLog with r2943 info. ------------------------------------------------------------------------ r2946 | marko | 2008-10-31 10:18:47 +0200 (Fri, 31 Oct 2008) | 2 lines branches/zip: Revert the unintended change to univ.i that was made in r2943. ------------------------------------------------------------------------ r2947 | calvin | 2008-10-31 10:38:26 +0200 (Fri, 31 Oct 2008) | 6 lines branches/zip: Windows plugin part of r2944 r2944 has reference to mysql_bin_log.is_open(), which is new in InnoDB. Add two new entries and remove one duplicate in mysqld.def & mysqld_x64.def. ------------------------------------------------------------------------ r2948 | vasil | 2008-10-31 11:39:07 +0200 (Fri, 31 Oct 2008) | 9 lines branches/zip: Fix Mantis issue#106 plugin init error:InnoDB: stats_on_metadata in static InnoDB (flags=0x2401) differs from stats_on_metadata in dynamic InnoDB (fl Ignore the NOSYSVAR flag in addition to ignoring the READONLY flag. Approved by: Marko (https://svn.innodb.com/rb/r/42/) ------------------------------------------------------------------------ r2949 | vasil | 2008-10-31 11:47:56 +0200 (Fri, 31 Oct 2008) | 4 lines branches/zip: White-space cleanup in ChangeLog. ------------------------------------------------------------------------ r2951 | marko | 2008-10-31 14:21:43 +0200 (Fri, 31 Oct 2008) | 4 lines branches/zip: scripts/install_innodb_plugins_win.sql: New script, for installing the InnoDB plugins in Windows. Copied from scripts/install_innodb_plugins.sql. ------------------------------------------------------------------------ r2954 | calvin | 2008-11-04 09:15:26 +0200 (Tue, 04 Nov 2008) | 8 lines branches/zip: ignore the failure when builtin_innobase_plugin is not available. External variable builtin_innobase_plugin is not available when mysqld does not have a builtin InnoDB. The init of the Windows plugin should not fail in this case. Approved by: Marko (on IM) ------------------------------------------------------------------------ r2955 | calvin | 2008-11-04 12:43:14 +0200 (Tue, 04 Nov 2008) | 11 lines branches/zip: windows plugin - fix references to array variables. This problem surfaced when running new test innodb_bug40360.test. Both tx_isolation_names and binlog_format_names are name arrays, and should be defined as wdl_tx_isolation_names and wdl_binlog_format_names, not *wdl_tx_isolation_names and *wdl_binlog_format_names. Another array variable is all_charsets, which is already correctly defined. Approved by: Marko (on IM) ------------------------------------------------------------------------ r2986 | marko | 2008-11-11 09:28:37 +0200 (Tue, 11 Nov 2008) | 11 lines branches/zip: ha_innobase::create(): Remove the dependences on DICT_TF_ZSSIZE_MAX, so that the code can be compiled with a different uncompressed page size by redefining UNIV_PAGE_SIZE_SHIFT in univ.i. Currently, the allowed values are 12, 13, or 14 (4k, 8k, 16k). Make the default compressed page size half the uncompressed page size. The previous default was 8 kilobytes, which is the same when compiling with the default 16k uncompressed page size. rb://50 approved by Pekka Lampio and Sunny Bains. ------------------------------------------------------------------------
566 lines
18 KiB
C
566 lines
18 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 "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;
|
|
|
|
/* 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))
|
|
|
|
/* This is set to TRUE if the MySQL user has set it in MySQL */
|
|
extern ibool srv_lower_case_table_names;
|
|
|
|
/* 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 */
|
|
extern my_bool srv_file_per_table;
|
|
/* The file format to use on new *.ibd files. */
|
|
extern ulint srv_file_format;
|
|
/* Whether to check file format during startup.*/
|
|
extern ulint srv_check_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;
|
|
|
|
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 ulong srv_auto_extend_increment;
|
|
|
|
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 ulint srv_log_buffer_size;
|
|
extern ulong srv_flush_log_at_trx_commit;
|
|
|
|
/* The sort order table of the MySQL latin1_swedish_ci character set
|
|
collation */
|
|
extern const byte* srv_latin1_ordering;
|
|
extern ulong srv_buf_pool_size; /* requested size in bytes */
|
|
extern ulong srv_buf_pool_old_size; /* previously requested size */
|
|
extern ulong srv_buf_pool_curr_size; /* current size in bytes */
|
|
extern ulint srv_mem_pool_size;
|
|
extern ulint srv_lock_table_size;
|
|
|
|
extern ulint srv_n_file_io_threads;
|
|
|
|
#ifdef UNIV_LOG_ARCHIVE
|
|
extern ibool srv_log_archive_on;
|
|
extern ibool srv_archive_recovery;
|
|
extern dulint 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 ulong srv_commit_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 ibool srv_set_thread_priorities;
|
|
extern int srv_query_thread_priority;
|
|
|
|
extern ulong srv_max_buf_pool_modified_pct;
|
|
extern ulong srv_max_purge_lag;
|
|
|
|
extern ulong srv_replication_delay;
|
|
/*-------------------------------------------*/
|
|
|
|
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 ulong srv_n_spin_wait_rounds;
|
|
extern ulong srv_n_free_tickets_to_enter;
|
|
extern ulong srv_thread_sleep_delay;
|
|
extern ulint srv_spin_wait_delay;
|
|
extern ibool srv_priority_boost;
|
|
|
|
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;
|
|
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 100
|
|
|
|
/* 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;
|
|
|
|
/* 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;
|
|
|
|
/* variable to count the number of buffer pool reads that led to the
|
|
reading of a disk page */
|
|
extern ulint srv_buf_pool_reads;
|
|
|
|
/* variable to count the number of sequential read-aheads were done */
|
|
extern ulint srv_read_ahead_seq;
|
|
|
|
/* variable to count the number of random read-aheads were done */
|
|
extern ulint srv_read_ahead_rnd;
|
|
|
|
/* In this structure we store status variables to be passed to MySQL */
|
|
typedef struct export_var_struct export_struc;
|
|
|
|
extern export_struc export_vars;
|
|
|
|
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_FSYNC 1 /* This is the default */
|
|
#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 */
|
|
|
|
/** Types of threads existing in the system. */
|
|
enum srv_thread_type {
|
|
SRV_COM = 1, /**< threads serving communication and queries */
|
|
SRV_CONSOLE, /**< thread serving console */
|
|
SRV_WORKER, /**< threads serving parallelized queries and
|
|
queries released from lock wait */
|
|
#if 0
|
|
/* Utility threads */
|
|
SRV_BUFFER, /**< thread flushing dirty buffer blocks */
|
|
SRV_RECOVERY, /**< threads finishing a recovery */
|
|
SRV_INSERT, /**< thread flushing the insert buffer to disk */
|
|
#endif
|
|
SRV_MASTER /**< the master thread, (whose type number must
|
|
be biggest) */
|
|
};
|
|
|
|
/*************************************************************************
|
|
Boots Innobase server. */
|
|
UNIV_INTERN
|
|
ulint
|
|
srv_boot(void);
|
|
/*==========*/
|
|
/* out: DB_SUCCESS or error code */
|
|
/*************************************************************************
|
|
Initializes the server. */
|
|
UNIV_INTERN
|
|
void
|
|
srv_init(void);
|
|
/*==========*/
|
|
/*************************************************************************
|
|
Frees the OS fast mutex created in srv_boot(). */
|
|
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. */
|
|
UNIV_INTERN
|
|
ulint
|
|
srv_get_n_threads(void);
|
|
/*===================*/
|
|
/*************************************************************************
|
|
Returns the calling thread type. */
|
|
|
|
enum srv_thread_type
|
|
srv_get_thread_type(void);
|
|
/*=====================*/
|
|
/* out: SRV_COM, ... */
|
|
/*************************************************************************
|
|
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! */
|
|
UNIV_INTERN
|
|
ulint
|
|
srv_release_threads(
|
|
/*================*/
|
|
/* out: number of threads
|
|
released: this may be < n if
|
|
not enough threads were
|
|
suspended at the moment */
|
|
enum srv_thread_type type, /* in: thread type */
|
|
ulint n); /* in: number of threads to release */
|
|
/*************************************************************************
|
|
The master thread controlling the server. */
|
|
UNIV_INTERN
|
|
os_thread_ret_t
|
|
srv_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 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);
|
|
/*========================*/
|
|
/*************************************************************************
|
|
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.
|
|
This also prints the info output by various InnoDB monitors. */
|
|
UNIV_INTERN
|
|
os_thread_ret_t
|
|
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. */
|
|
UNIV_INTERN
|
|
os_thread_ret_t
|
|
srv_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. */
|
|
UNIV_INTERN
|
|
void
|
|
srv_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 */
|
|
UNIV_INTERN
|
|
void
|
|
srv_export_innodb_status(void);
|
|
/*=====================*/
|
|
|
|
/* 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;
|
|
#ifdef UNIV_DEBUG
|
|
ulint innodb_buffer_pool_pages_latched;
|
|
#endif /* UNIV_DEBUG */
|
|
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_int64_t 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{
|
|
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
|
|
|