From 93609b57c66daa5719b63c6fb6036f3d8b1aadbe Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Jan 2014 09:57:25 +0800 Subject: [PATCH] BUG 18117322 - DEFINE INNODB_THREAD_SLEEP_DELAY MAX VALUE The maximum value for innodb_thread_sleep_delay is 4294967295 (32-bit) or 18446744073709551615 (64-bit) microseconds. This is way too big, since the max value of innodb_thread_sleep_delay is limited by innodb_adaptive_max_sleep_delay if that value is set to non-zero value (its default is 150,000). Solution The maximum value of innodb_thread_sleep_delay should be the same as the maximum value of innodb_adaptive_max_sleep_delay, which is 1000000. Approved by Jimmy, rb#4429 --- .../r/innodb_thread_sleep_delay_basic.result | 30 +++++++++++++++++++ .../t/innodb_thread_sleep_delay_basic.test | 18 +++++++++++ storage/innobase/handler/ha_innodb.cc | 4 +-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result b/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result index fb7093ec3b3..0335db8e859 100644 --- a/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result @@ -41,6 +41,8 @@ set global innodb_thread_sleep_delay=1e1; ERROR 42000: Incorrect argument type to variable 'innodb_thread_sleep_delay' set global innodb_thread_sleep_delay="foo"; ERROR 42000: Incorrect argument type to variable 'innodb_thread_sleep_delay' +set global innodb_thread_sleep_delay=18446744073709551616; +ERROR 42000: Incorrect argument type to variable 'innodb_thread_sleep_delay' set global innodb_thread_sleep_delay=-7; Warnings: Warning 1292 Truncated incorrect innodb_thread_sleep_delay value: '-7' @@ -50,6 +52,34 @@ select @@global.innodb_thread_sleep_delay; select * from information_schema.global_variables where variable_name='innodb_thread_sleep_delay'; VARIABLE_NAME VARIABLE_VALUE INNODB_THREAD_SLEEP_DELAY 0 +set global innodb_thread_sleep_delay=0; +select @@global.innodb_thread_sleep_delay; +@@global.innodb_thread_sleep_delay +0 +set global innodb_thread_sleep_delay=1000; +select @@global.innodb_thread_sleep_delay; +@@global.innodb_thread_sleep_delay +1000 +set global innodb_thread_sleep_delay=1000000; +select @@global.innodb_thread_sleep_delay; +@@global.innodb_thread_sleep_delay +1000000 +set global innodb_thread_sleep_delay=1000001; +Warnings: +Warning 1292 Truncated incorrect innodb_thread_sleep_delay value: '1000001' +select @@global.innodb_thread_sleep_delay; +@@global.innodb_thread_sleep_delay +1000000 +set global innodb_thread_sleep_delay=4294967295; +Warnings: +Warning 1292 Truncated incorrect innodb_thread_sleep_delay value: '4294967295' +select @@global.innodb_thread_sleep_delay; +@@global.innodb_thread_sleep_delay +1000000 +set global innodb_thread_sleep_delay=555; +select @@global.innodb_thread_sleep_delay; +@@global.innodb_thread_sleep_delay +555 SET @@global.innodb_thread_sleep_delay = @start_global_value; SELECT @@global.innodb_thread_sleep_delay; @@global.innodb_thread_sleep_delay diff --git a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test index 7156f309a64..8cc4bfd34c7 100644 --- a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test @@ -40,11 +40,29 @@ set global innodb_thread_sleep_delay=1.1; set global innodb_thread_sleep_delay=1e1; --error ER_WRONG_TYPE_FOR_VAR set global innodb_thread_sleep_delay="foo"; +--error ER_WRONG_TYPE_FOR_VAR +set global innodb_thread_sleep_delay=18446744073709551616; set global innodb_thread_sleep_delay=-7; select @@global.innodb_thread_sleep_delay; select * from information_schema.global_variables where variable_name='innodb_thread_sleep_delay'; +# +# correct/overflowed values +# +set global innodb_thread_sleep_delay=0; +select @@global.innodb_thread_sleep_delay; +set global innodb_thread_sleep_delay=1000; +select @@global.innodb_thread_sleep_delay; +set global innodb_thread_sleep_delay=1000000; +select @@global.innodb_thread_sleep_delay; +set global innodb_thread_sleep_delay=1000001; +select @@global.innodb_thread_sleep_delay; +set global innodb_thread_sleep_delay=4294967295; +select @@global.innodb_thread_sleep_delay; +set global innodb_thread_sleep_delay=555; +select @@global.innodb_thread_sleep_delay; + # # cleanup # diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 565fa8846dc..b95a1f52ed5 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2014, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. @@ -11694,7 +11694,7 @@ static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency, static MYSQL_SYSVAR_ULONG(thread_sleep_delay, srv_thread_sleep_delay, PLUGIN_VAR_RQCMDARG, "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep", - NULL, NULL, 10000L, 0L, ~0UL, 0); + NULL, NULL, 10000L, 0L, 1000000L, 0); static MYSQL_SYSVAR_STR(data_file_path, innobase_data_file_path, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,