diff options
author | Jan Lindström <jan.lindstrom@skysql.com> | 2014-11-17 09:55:55 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@skysql.com> | 2014-11-17 09:59:52 +0200 |
commit | 7bf391c2059f452eafb424336faa30d402f92b67 (patch) | |
tree | 8c6782aa29e8a560aa63b4a5117788777ef33cc8 /storage | |
parent | ea8322687254fad00143ff7850a67ea8c7f0027e (diff) | |
download | mariadb-git-7bf391c2059f452eafb424336faa30d402f92b67.tar.gz |
MDEV-7108: Make long semaphore wait timeout configurable
Merge Facebook commit https://github.com/facebook/mysql-5.6/commit/cd063ab930f05efdba39d504543998512d1bd71f
authored by Peng Tian from https://github.com/facebook/mysql-5.6
Introduced a new configuration variable innodb_fatal_semaphore_wait_threshold,
it makes the fatal semaphore timeout configurable. Modified original commit
so that no MariaDB server files are changed, instead introduced a new
InnoDB/XtraDB configuration variable.
Its default/min/max vlaues are 600/1/2^32-1 in seconds (it was hardcoded
as 600, now its default value is 600, so the default behavior of this diff
should be no change).
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 15 | ||||
-rw-r--r-- | storage/innobase/include/srv0srv.h | 6 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 3 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 2 | ||||
-rw-r--r-- | storage/xtradb/handler/ha_innodb.cc | 15 | ||||
-rw-r--r-- | storage/xtradb/include/srv0srv.h | 6 | ||||
-rw-r--r-- | storage/xtradb/lock/lock0lock.cc | 3 | ||||
-rw-r--r-- | storage/xtradb/srv/srv0srv.cc | 2 |
8 files changed, 44 insertions, 8 deletions
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 02f511d7a6d..8c00961f1d2 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -13219,7 +13219,7 @@ ha_innobase::check( CHECK TABLE. */ os_increment_counter_by_amount( server_mutex, - srv_fatal_semaphore_wait_threshold, + srv_fatal_semaphore_wait_threshold, SRV_SEMAPHORE_WAIT_EXTENSION); bool valid = btr_validate_index(index, prebuilt->trx); @@ -13227,7 +13227,7 @@ ha_innobase::check( CHECK TABLE. */ os_decrement_counter_by_amount( server_mutex, - srv_fatal_semaphore_wait_threshold, + srv_fatal_semaphore_wait_threshold, SRV_SEMAPHORE_WAIT_EXTENSION); if (!valid) { @@ -18836,6 +18836,15 @@ static MYSQL_SYSVAR_BOOL(use_mtflush, srv_use_mtflush, "Use multi-threaded flush. Default FALSE.", NULL, NULL, FALSE); +static MYSQL_SYSVAR_ULONG(fatal_semaphore_wait_threshold, srv_fatal_semaphore_wait_threshold, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Maximum number of seconds that semaphore times out in InnoDB.", + NULL, NULL, + DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT, /* Default setting */ + 1, /* Minimum setting */ + UINT_MAX32, /* Maximum setting */ + 0); + static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(api_trx_level), @@ -19010,6 +19019,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(compression_algorithm), MYSQL_SYSVAR(mtflush_threads), MYSQL_SYSVAR(use_mtflush), + + MYSQL_SYSVAR(fatal_semaphore_wait_threshold), NULL }; diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index c3c9083f3cd..e87750b7540 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -492,7 +492,6 @@ extern my_bool srv_ibuf_disable_background_merge; extern my_bool srv_purge_view_update_only_debug; #endif /* UNIV_DEBUG */ -extern ulint srv_fatal_semaphore_wait_threshold; #define SRV_SEMAPHORE_WAIT_EXTENSION 7200 extern ulint srv_dml_needed_delay; @@ -531,6 +530,11 @@ extern srv_stats_t srv_stats; /** Simulate compression failures. */ extern uint srv_simulate_comp_failures; +/** Fatal semaphore wait threshold = maximum number of seconds +that semaphore times out in InnoDB */ +#define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600 +extern ulong srv_fatal_semaphore_wait_threshold; + # ifdef UNIV_PFS_THREAD /* Keys to register InnoDB threads with performance schema */ extern mysql_pfs_key_t buf_page_cleaner_thread_key; diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index bd88e7e94de..8dbe1668e36 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4987,6 +4987,9 @@ lock_table( lock_mutex_enter(); + DBUG_EXECUTE_IF("fatal-semaphore-timeout", + { os_thread_sleep(3600000000); }); + /* We have to check if the new lock is compatible with any locks other transactions have in the table lock queue. */ diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index c61a098d146..d56f942f661 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -80,7 +80,7 @@ extern int wsrep_debug; extern int wsrep_trx_is_aborting(void *thd_ptr); #endif /* The following is the maximum allowed duration of a lock wait. */ -UNIV_INTERN ulint srv_fatal_semaphore_wait_threshold = 600; +UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT; /* How much data manipulation language (DML) statements need to be delayed, in microseconds, in order to reduce the lagging of the purge thread. */ diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index e321feb77f3..f0b848a6e21 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -13897,7 +13897,7 @@ ha_innobase::check( CHECK TABLE. */ os_increment_counter_by_amount( server_mutex, - srv_fatal_semaphore_wait_threshold, + srv_fatal_semaphore_wait_threshold, SRV_SEMAPHORE_WAIT_EXTENSION); bool valid = btr_validate_index(index, prebuilt->trx); @@ -13905,7 +13905,7 @@ ha_innobase::check( CHECK TABLE. */ os_decrement_counter_by_amount( server_mutex, - srv_fatal_semaphore_wait_threshold, + srv_fatal_semaphore_wait_threshold, SRV_SEMAPHORE_WAIT_EXTENSION); if (!valid) { @@ -20128,6 +20128,15 @@ static MYSQL_SYSVAR_BOOL(use_mtflush, srv_use_mtflush, "Use multi-threaded flush. Default FALSE.", NULL, NULL, FALSE); +static MYSQL_SYSVAR_ULONG(fatal_semaphore_wait_threshold, srv_fatal_semaphore_wait_threshold, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Maximum number of seconds that semaphore times out in InnoDB.", + NULL, NULL, + DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT, /* Default setting */ + 1, /* Minimum setting */ + UINT_MAX32, /* Maximum setting */ + 0); + static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(log_block_size), MYSQL_SYSVAR(additional_mem_pool_size), @@ -20340,6 +20349,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(compression_algorithm), MYSQL_SYSVAR(mtflush_threads), MYSQL_SYSVAR(use_mtflush), + + MYSQL_SYSVAR(fatal_semaphore_wait_threshold), NULL }; diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index c892e21db9d..4a18c0711f3 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -585,7 +585,6 @@ extern my_bool srv_ibuf_disable_background_merge; extern my_bool srv_purge_view_update_only_debug; #endif /* UNIV_DEBUG */ -extern ulint srv_fatal_semaphore_wait_threshold; #define SRV_SEMAPHORE_WAIT_EXTENSION 7200 extern ulint srv_dml_needed_delay; extern long long srv_kill_idle_transaction; @@ -670,6 +669,11 @@ extern my_bool srv_fake_changes_locks; /** Simulate compression failures. */ extern uint srv_simulate_comp_failures; +/** Fatal semaphore wait threshold = maximum number of seconds +that semaphore times out in InnoDB */ +#define DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT 600 +extern ulong srv_fatal_semaphore_wait_threshold; + # ifdef UNIV_PFS_THREAD /* Keys to register InnoDB threads with performance schema */ extern mysql_pfs_key_t buf_page_cleaner_thread_key; diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 30ad3ee7922..0df0d790925 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -5028,6 +5028,9 @@ lock_table( lock_mutex_enter(); + DBUG_EXECUTE_IF("fatal-semaphore-timeout", + { os_thread_sleep(3600000000); }); + /* We have to check if the new lock is compatible with any locks other transactions have in the table lock queue. */ diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 3495302a45f..6af5f0d782c 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -95,7 +95,7 @@ in the server */ UNIV_INTERN ulint srv_activity_count = 0; /* The following is the maximum allowed duration of a lock wait. */ -UNIV_INTERN ulint srv_fatal_semaphore_wait_threshold = 600; +UNIV_INTERN ulong srv_fatal_semaphore_wait_threshold = DEFAULT_SRV_FATAL_SEMAPHORE_TIMEOUT; /**/ UNIV_INTERN long long srv_kill_idle_transaction = 0; |