Commit dd67456a authored by Sergei Golubchik's avatar Sergei Golubchik

InnoDB: disallow fast_shutdown=0 when purge threads have exited

parent fc279d7e
......@@ -15,6 +15,8 @@ shutdown;
connection default;
disconnect con1;
delete from t1 where a=3;
set global innodb_fast_shutdown=0;
ERROR 42000: Variable 'innodb_fast_shutdown' can't be set to the value of '0'
kill ID;
ERROR 70100: Connection was killed
drop table t1;
......@@ -24,6 +24,8 @@ let $wait_condition=select count(*) = 0 from information_schema.processlist wher
source include/wait_condition.inc;
delete from t1 where a=3;
--error ER_WRONG_VALUE_FOR_VAR
set global innodb_fast_shutdown=0;
let $me=`select connection_id()`;
replace_result $me ID;
......
......@@ -723,6 +723,7 @@ static PSI_file_info all_innodb_files[] = {
static void innodb_remember_check_sysvar_funcs();
mysql_var_check_func check_sysvar_enum;
mysql_var_check_func check_sysvar_int;
// should page compression be used by default for new tables
static MYSQL_THDVAR_BOOL(compression_default, PLUGIN_VAR_OPCMDARG,
......@@ -18286,6 +18287,34 @@ innodb_file_format_name_validate(
return(1);
}
/*************************************************************//**
Don't allow to set innodb_fast_shutdown=0 if purge threads are
already down.
@return 0 if innodb_fast_shutdown can be set */
static
int
fast_shutdown_validate(
/*=============================*/
THD* thd, /*!< in: thread handle */
struct st_mysql_sys_var* var, /*!< in: pointer to system
variable */
void* save, /*!< out: immediate result
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{
if (check_sysvar_int(thd, var, save, value)) {
return(1);
}
uint new_val = *reinterpret_cast<uint*>(save);
if (srv_fast_shutdown && !new_val && !srv_running) {
return(1);
}
return(0);
}
/****************************************************************//**
Update the system variable innodb_file_format using the "saved"
value. This function is registered as a callback with MySQL. */
......@@ -20628,7 +20657,7 @@ static MYSQL_SYSVAR_UINT(fast_shutdown, srv_fast_shutdown,
PLUGIN_VAR_OPCMDARG,
"Speeds up the shutdown process of the InnoDB storage engine. Possible"
" values are 0, 1 (faster) or 2 (fastest - crash-like).",
NULL, NULL, 1, 0, 2, 0);
fast_shutdown_validate, NULL, 1, 0, 2, 0);
static MYSQL_SYSVAR_BOOL(file_per_table, srv_file_per_table,
PLUGIN_VAR_NOCMDARG,
......@@ -22924,6 +22953,9 @@ static void innodb_remember_check_sysvar_funcs()
/* remember build-in sysvar check functions */
ut_ad((MYSQL_SYSVAR_NAME(checksum_algorithm).flags & 0x1FF) == PLUGIN_VAR_ENUM);
check_sysvar_enum = MYSQL_SYSVAR_NAME(checksum_algorithm).check;
ut_ad((MYSQL_SYSVAR_NAME(flush_log_at_timeout).flags & 15) == PLUGIN_VAR_INT);
check_sysvar_int = MYSQL_SYSVAR_NAME(flush_log_at_timeout).check;
}
/********************************************************************//**
......
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