diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7cb1f6beb62de..a3ff2101a9549 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18478,22 +18478,13 @@ static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*, mysql_mutex_lock(&LOCK_global_system_variables); } -static void innodb_log_spin_wait_delay_update(THD *thd, st_mysql_sys_var*, - void *var, const void *save) +static void innodb_log_spin_wait_delay_update(THD *, st_mysql_sys_var*, + void *, const void *save) { - ut_ad(var == &mtr_t::spin_wait_delay); - - unsigned delay= *static_cast(save); - - if (!delay != !mtr_t::spin_wait_delay) - { - log_sys.latch.wr_lock(SRW_LOCK_CALL); - mtr_t::spin_wait_delay= delay; - mtr_t::finisher_update(); - log_sys.latch.wr_unlock(); - } - else - mtr_t::spin_wait_delay= delay; + log_sys.latch.wr_lock(SRW_LOCK_CALL); + mtr_t::spin_wait_delay= *static_cast(save); + mtr_t::finisher_update(); + log_sys.latch.wr_unlock(); } /** Update innodb_status_output or innodb_status_output_locks, diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 4844fe1206f1c..d180fe57e3897 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -715,8 +715,7 @@ struct mtr_t { { return finisher(this, len); } public: /** Poll interval in log_sys.lock_lsn(); 0 to use log_sys.lsn_lock. - Protected by LOCK_global_system_variables; changes to and from 0 - are additionally protected by exclusive log_sys.latch. */ + Protected by LOCK_global_system_variables and log_sys.latch. */ static unsigned spin_wait_delay; /** Update finisher when spin_wait_delay is changing to or from 0. */ static void finisher_update(); diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index b6bf3f65990d4..1835b4f6ef2fd 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -962,7 +962,7 @@ size_t log_t::lock_lsn() noexcept size_t b= buf_free.fetch_or(buf_free_LOCK, std::memory_order_acquire); if (b & buf_free_LOCK) { - const size_t m= my_cpu_relax_multiplier * srv_spin_wait_delay / 32; + const size_t m= mtr_t::spin_wait_delay; constexpr size_t DELAY= 10, MAX_ITERATIONS= 10; for (size_t delay_count= DELAY, delay_iterations= 1; ((b= buf_free.load(std::memory_order_relaxed)) & buf_free_LOCK) ||