Commit 02878f12 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-31813 SET GLOBAL innodb_max_purge_lag_wait hangs if innodb_read_only

innodb_max_purge_lag_wait_update(): Return immediately if we are
in high_level_read_only mode.

srv_wake_purge_thread_if_not_active(): Relax a debug assertion.
If srv_read_only_mode holds, purge_sys.enabled() will not hold
and this function will do nothing.

trx_t::commit_in_memory(): Remove a redundant condition before
invoking srv_wake_purge_thread_if_not_active().
parent e9f3ca61
...@@ -35,6 +35,7 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; ...@@ -35,6 +35,7 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t; SELECT * FROM t;
a a
3 3
SET GLOBAL innodb_max_purge_lag_wait=0;
# restart # restart
SELECT * FROM t; SELECT * FROM t;
a a
......
...@@ -37,6 +37,7 @@ UPDATE t SET a=3 WHERE a=1; ...@@ -37,6 +37,7 @@ UPDATE t SET a=3 WHERE a=1;
SELECT * FROM t; SELECT * FROM t;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM t; SELECT * FROM t;
SET GLOBAL innodb_max_purge_lag_wait=0;
--let $restart_parameters= --let $restart_parameters=
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
SELECT * FROM t; SELECT * FROM t;
......
...@@ -238,6 +238,8 @@ static uint innodb_max_purge_lag_wait; ...@@ -238,6 +238,8 @@ static uint innodb_max_purge_lag_wait;
static void innodb_max_purge_lag_wait_update(THD *thd, st_mysql_sys_var *, static void innodb_max_purge_lag_wait_update(THD *thd, st_mysql_sys_var *,
void *, const void *limit) void *, const void *limit)
{ {
if (high_level_read_only)
return;
const uint l= *static_cast<const uint*>(limit); const uint l= *static_cast<const uint*>(limit);
if (trx_sys.rseg_history_len <= l) if (trx_sys.rseg_history_len <= l)
return; return;
......
...@@ -1902,8 +1902,7 @@ srv_active_wake_master_thread_low() ...@@ -1902,8 +1902,7 @@ srv_active_wake_master_thread_low()
void void
srv_wake_purge_thread_if_not_active() srv_wake_purge_thread_if_not_active()
{ {
ut_ad(!srv_read_only_mode); ut_ad(srv_read_only_mode || !mutex_own(&srv_sys.mutex));
ut_ad(!mutex_own(&srv_sys.mutex));
if (purge_sys.enabled() && !purge_sys.paused() if (purge_sys.enabled() && !purge_sys.paused()
&& !srv_sys.n_threads_active[SRV_PURGE] && !srv_sys.n_threads_active[SRV_PURGE]
......
...@@ -1477,7 +1477,6 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr) ...@@ -1477,7 +1477,6 @@ inline void trx_t::commit_in_memory(const mtr_t *mtr)
trx_mutex_exit(this); trx_mutex_exit(this);
ut_a(error_state == DB_SUCCESS); ut_a(error_state == DB_SUCCESS);
if (!srv_read_only_mode)
srv_wake_purge_thread_if_not_active(); srv_wake_purge_thread_if_not_active();
} }
......
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