#!!! notice !!!
# Any small change to this file in the main branch
# should be done or reviewed by the maintainer!
-diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
---- a/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:41:52.045404706 +0900
-+++ b/storage/innobase/handler/ha_innodb.cc 2010-12-03 15:42:11.568959457 +0900
+--- a/storage/innobase/handler/ha_innodb.cc
++++ b/storage/innobase/handler/ha_innodb.cc
@@ -148,6 +148,7 @@
static ulong innobase_write_io_threads;
static long innobase_buffer_pool_instances = 1;
static long long innobase_buffer_pool_size, innobase_log_file_size;
/** Percentage of the buffer pool to reserve for 'old' blocks.
-@@ -2496,6 +2497,9 @@
+@@ -2577,6 +2578,9 @@
srv_n_log_files = (ulint) innobase_log_files_in_group;
srv_log_file_size = (ulint) innobase_log_file_size;
#ifdef UNIV_LOG_ARCHIVE
srv_log_archive_on = (ulint) innobase_log_archive;
#endif /* UNIV_LOG_ARCHIVE */
-@@ -11373,6 +11377,12 @@
+@@ -11601,6 +11605,12 @@
"Maximum delay between polling for a spin lock (6 by default)",
NULL, NULL, 6L, 0L, ~0L, 0);
static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
PLUGIN_VAR_RQCMDARG,
"Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.",
-@@ -11586,6 +11596,7 @@
+@@ -11859,6 +11869,7 @@
MYSQL_SYSVAR(spin_wait_delay),
MYSQL_SYSVAR(table_locks),
MYSQL_SYSVAR(thread_concurrency),
MYSQL_SYSVAR(thread_sleep_delay),
MYSQL_SYSVAR(autoinc_lock_mode),
MYSQL_SYSVAR(show_verbose_locks),
-diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
---- a/storage/innobase/include/srv0srv.h 2010-12-03 15:37:45.543027751 +0900
-+++ b/storage/innobase/include/srv0srv.h 2010-12-03 15:42:11.571024631 +0900
-@@ -164,6 +164,8 @@
+--- a/storage/innobase/include/srv0srv.h
++++ b/storage/innobase/include/srv0srv.h
+@@ -165,6 +165,8 @@
extern ulint srv_mem_pool_size;
extern ulint srv_lock_table_size;
+extern ibool srv_thread_concurrency_timer_based;
+
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;
-diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
---- a/storage/innobase/srv/srv0srv.c 2010-12-03 15:37:45.546023493 +0900
-+++ b/storage/innobase/srv/srv0srv.c 2010-12-03 15:42:11.574955879 +0900
-@@ -344,6 +344,7 @@
+--- a/storage/innobase/srv/srv0srv.c
++++ b/storage/innobase/srv/srv0srv.c
+@@ -349,6 +349,7 @@
computer. Bigger computers need bigger values. Value 0 will disable the
concurrency check. */
UNIV_INTERN ulong srv_thread_concurrency = 0;
/* this mutex protects srv_conc data structures */
-@@ -1130,6 +1131,75 @@
+@@ -1148,6 +1149,75 @@
/*********************************************************************//**
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. */
+ enter_innodb_with_tickets(trx);
+ return;
+ }
-+ os_atomic_increment_lint(&srv_conc_n_threads, -1);
++ (void) os_atomic_increment_lint(&srv_conc_n_threads, -1);
+ }
+ if (!has_yielded)
+ {
+static void
+srv_conc_exit_innodb_timer_based(trx_t* trx)
+{
-+ os_atomic_increment_lint(&srv_conc_n_threads, -1);
++ (void) os_atomic_increment_lint(&srv_conc_n_threads, -1);
+ trx->declared_to_be_inside_innodb = FALSE;
+ trx->n_tickets_to_enter_innodb = 0;
+ return;
UNIV_INTERN
void
srv_conc_enter_innodb(
-@@ -1160,6 +1230,13 @@
+@@ -1182,6 +1252,13 @@
return;
}
os_fast_mutex_lock(&srv_conc_mutex);
retry:
if (trx->declared_to_be_inside_innodb) {
-@@ -1305,6 +1382,14 @@
+@@ -1335,6 +1412,14 @@
}
ut_ad(srv_conc_n_threads >= 0);
+#ifdef HAVE_ATOMIC_BUILTINS
+ if (srv_thread_concurrency_timer_based) {
-+ os_atomic_increment_lint(&srv_conc_n_threads, 1);
++ (void) os_atomic_increment_lint(&srv_conc_n_threads, 1);
+ trx->declared_to_be_inside_innodb = TRUE;
+ trx->n_tickets_to_enter_innodb = 1;
+ return;
os_fast_mutex_lock(&srv_conc_mutex);
-@@ -1338,6 +1423,13 @@
+@@ -1368,6 +1453,13 @@
return;
}