--- /root/mysql-8.32/mysql-8.0.32/storage/innobase/lock/lock0wait.cc 2022-12-16 23:34:44.000000000 +0800 +++ lock0wait.cc 2023-09-27 11:10:31.567000000 +0800 @@ -320,8 +320,9 @@ if (thr->lock_state == QUE_THR_LOCK_ROW) { const auto diff_time = std::chrono::steady_clock::now() - start_time; - + lock_wait_mutex_enter(); srv_stats.n_lock_wait_current_count.dec(); + lock_wait_mutex_exit(); srv_stats.n_lock_wait_time.add( std::chrono::duration_cast(diff_time) .count());