From 274dd54952b97a10314d7536e38f5c0f70e969fc Mon Sep 17 00:00:00 2001 From: marko <> Date: Thu, 25 Jun 2009 12:11:57 +0000 Subject: [PATCH] branches/5.1: Merge r5418 from branches/zip: ------------------------------------------------------------------------ r5418 | marko | 2009-06-25 15:55:52 +0300 (Thu, 25 Jun 2009) | 5 lines Changed paths: M /branches/zip/ChangeLog M /branches/zip/handler/ha_innodb.cc M /branches/zip/mysql-test/innodb_bug42101-nonzero.result M /branches/zip/mysql-test/innodb_bug42101-nonzero.test M /branches/zip/mysql-test/innodb_bug42101.result M /branches/zip/mysql-test/innodb_bug42101.test branches/zip: Fix a race condition caused by SET GLOBAL innodb_commit_concurrency=DEFAULT. (Bug #45749) When innodb_commit_concurrency is initially set nonzero, DEFAULT would change it back to 0, triggering Bug #42101. rb://139 approved by Heikki Tuuri. ------------------------------------------------------------------------ --- handler/ha_innodb.cc | 34 +++++++++++++++++++++++ mysql-test/innodb_bug42101-nonzero.result | 6 +++- mysql-test/innodb_bug42101-nonzero.test | 2 ++ mysql-test/innodb_bug42101.result | 4 +++ mysql-test/innodb_bug42101.test | 2 ++ 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/handler/ha_innodb.cc b/handler/ha_innodb.cc index 4b710157719..80f4ac8758c 100644 --- a/handler/ha_innodb.cc +++ b/handler/ha_innodb.cc @@ -166,6 +166,20 @@ static handler *innobase_create_handler(handlerton *hton, static const char innobase_hton_name[]= "InnoDB"; +/** @brief Initialize the default value of innodb_commit_concurrency. + +Once InnoDB is running, the innodb_commit_concurrency must not change +from zero to nonzero. (Bug #42101) + +The initial default value is 0, and without this extra initialization, +SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter +to 0, even if it was initially set to nonzero at the command line +or configuration file. */ +static +void +innobase_commit_concurrency_init_default(void); +/*==========================================*/ + /***************************************************************** Check for a valid value of innobase_commit_concurrency. */ static @@ -1775,6 +1789,8 @@ innobase_init( (char*)"latin1_swedish_ci")); memcpy(srv_latin1_ordering, my_charset_latin1.sort_order, 256); + innobase_commit_concurrency_init_default(); + /* Since we in this module access directly the fields of a trx struct, and due to different headers and flags it might happen that mutex_t has a different size in this module and in InnoDB @@ -8479,3 +8495,21 @@ mysql_declare_plugin(innobase) NULL /* reserved */ } mysql_declare_plugin_end; + +/** @brief Initialize the default value of innodb_commit_concurrency. + +Once InnoDB is running, the innodb_commit_concurrency must not change +from zero to nonzero. (Bug #42101) + +The initial default value is 0, and without this extra initialization, +SET GLOBAL innodb_commit_concurrency=DEFAULT would set the parameter +to 0, even if it was initially set to nonzero at the command line +or configuration file. */ +static +void +innobase_commit_concurrency_init_default(void) +/*==========================================*/ +{ + MYSQL_SYSVAR_NAME(commit_concurrency).def_val + = innobase_commit_concurrency; +} diff --git a/mysql-test/innodb_bug42101-nonzero.result b/mysql-test/innodb_bug42101-nonzero.result index 8a14296381c..277dfffdd35 100644 --- a/mysql-test/innodb_bug42101-nonzero.result +++ b/mysql-test/innodb_bug42101-nonzero.result @@ -11,11 +11,15 @@ set global innodb_commit_concurrency=42; select @@innodb_commit_concurrency; @@innodb_commit_concurrency 42 +set global innodb_commit_concurrency=DEFAULT; +select @@innodb_commit_concurrency; +@@innodb_commit_concurrency +1 set global innodb_commit_concurrency=0; ERROR HY000: Incorrect arguments to SET select @@innodb_commit_concurrency; @@innodb_commit_concurrency -42 +1 set global innodb_commit_concurrency=1; select @@innodb_commit_concurrency; @@innodb_commit_concurrency diff --git a/mysql-test/innodb_bug42101-nonzero.test b/mysql-test/innodb_bug42101-nonzero.test index c691a234c51..685fdf20489 100644 --- a/mysql-test/innodb_bug42101-nonzero.test +++ b/mysql-test/innodb_bug42101-nonzero.test @@ -12,6 +12,8 @@ set global innodb_commit_concurrency=1; select @@innodb_commit_concurrency; set global innodb_commit_concurrency=42; select @@innodb_commit_concurrency; +set global innodb_commit_concurrency=DEFAULT; +select @@innodb_commit_concurrency; --error ER_WRONG_ARGUMENTS set global innodb_commit_concurrency=0; select @@innodb_commit_concurrency; diff --git a/mysql-test/innodb_bug42101.result b/mysql-test/innodb_bug42101.result index 9a9c8e0ce9b..805097ffe9d 100644 --- a/mysql-test/innodb_bug42101.result +++ b/mysql-test/innodb_bug42101.result @@ -16,3 +16,7 @@ set global innodb_commit_concurrency=0; select @@innodb_commit_concurrency; @@innodb_commit_concurrency 0 +set global innodb_commit_concurrency=DEFAULT; +select @@innodb_commit_concurrency; +@@innodb_commit_concurrency +0 diff --git a/mysql-test/innodb_bug42101.test b/mysql-test/innodb_bug42101.test index 13d531ecde7..b6536490d48 100644 --- a/mysql-test/innodb_bug42101.test +++ b/mysql-test/innodb_bug42101.test @@ -15,3 +15,5 @@ set global innodb_commit_concurrency=42; select @@innodb_commit_concurrency; set global innodb_commit_concurrency=0; select @@innodb_commit_concurrency; +set global innodb_commit_concurrency=DEFAULT; +select @@innodb_commit_concurrency;