Commit bb0e1c34 authored by marko's avatar marko

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.
parent 3b765849
2009-06-25 The InnoDB Team
* handler/ha_innodb.cc,
mysql-test/innodb_bug42101.test,
mysql-test/innodb_bug42101.result,
mysql-test/innodb_bug42101-nonzero.test,
mysql-test/innodb_bug42101-nonzero.result:
Fix Bug#45749 Race condition in SET GLOBAL
innodb_commit_concurrency=DEFAULT
2009-06-25 The InnoDB Team 2009-06-25 The InnoDB Team
* dict/dict0dict.c: * dict/dict0dict.c:
......
...@@ -228,6 +228,20 @@ static handler *innobase_create_handler(handlerton *hton, ...@@ -228,6 +228,20 @@ static handler *innobase_create_handler(handlerton *hton,
TABLE_SHARE *table, TABLE_SHARE *table,
MEM_ROOT *mem_root); MEM_ROOT *mem_root);
/** @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);
/*==========================================*/
/************************************************************//** /************************************************************//**
Validate the file format name and return its corresponding id. Validate the file format name and return its corresponding id.
@return valid file format id */ @return valid file format id */
...@@ -2196,6 +2210,8 @@ innobase_init( ...@@ -2196,6 +2210,8 @@ innobase_init(
ut_a(0 == strcmp(my_charset_latin1.name, "latin1_swedish_ci")); ut_a(0 == strcmp(my_charset_latin1.name, "latin1_swedish_ci"));
srv_latin1_ordering = my_charset_latin1.sort_order; srv_latin1_ordering = my_charset_latin1.sort_order;
innobase_commit_concurrency_init_default();
/* Since we in this module access directly the fields of a trx /* Since we in this module access directly the fields of a trx
struct, and due to different headers and flags it might happen that struct, and due to different headers and flags it might happen that
mutex_t has a different size in this module and in InnoDB mutex_t has a different size in this module and in InnoDB
...@@ -9887,6 +9903,24 @@ i_s_innodb_cmpmem, ...@@ -9887,6 +9903,24 @@ i_s_innodb_cmpmem,
i_s_innodb_cmpmem_reset i_s_innodb_cmpmem_reset
mysql_declare_plugin_end; 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;
}
#ifdef UNIV_COMPILE_TEST_FUNCS #ifdef UNIV_COMPILE_TEST_FUNCS
typedef struct innobase_convert_name_test_struct { typedef struct innobase_convert_name_test_struct {
......
...@@ -11,11 +11,15 @@ set global innodb_commit_concurrency=42; ...@@ -11,11 +11,15 @@ set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
42 42
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
1
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
ERROR HY000: Incorrect arguments to SET ERROR HY000: Incorrect arguments to SET
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
42 1
set global innodb_commit_concurrency=1; set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
......
...@@ -12,6 +12,8 @@ set global innodb_commit_concurrency=1; ...@@ -12,6 +12,8 @@ set global innodb_commit_concurrency=1;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=42; set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
--error ER_WRONG_ARGUMENTS --error ER_WRONG_ARGUMENTS
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
......
...@@ -16,3 +16,7 @@ set global innodb_commit_concurrency=0; ...@@ -16,3 +16,7 @@ set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
@@innodb_commit_concurrency @@innodb_commit_concurrency
0 0
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
@@innodb_commit_concurrency
0
...@@ -15,3 +15,5 @@ set global innodb_commit_concurrency=42; ...@@ -15,3 +15,5 @@ set global innodb_commit_concurrency=42;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=0; set global innodb_commit_concurrency=0;
select @@innodb_commit_concurrency; select @@innodb_commit_concurrency;
set global innodb_commit_concurrency=DEFAULT;
select @@innodb_commit_concurrency;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment