diff --git a/deps/oblib/src/lib/lock/ob_scond.h b/deps/oblib/src/lib/lock/ob_scond.h index 6f856cd172..b607bf64da 100644 --- a/deps/oblib/src/lib/lock/ob_scond.h +++ b/deps/oblib/src/lib/lock/ob_scond.h @@ -33,10 +33,16 @@ public: uint32_t get_key() { return ATOMIC_LOAD(&futex_.uval()); } void wait(uint32_t key, int64_t timeout) { if (timeout > 0 && get_key() == key) { - ObWaitEventGuard guard(event_no_, timeout / 1000, reinterpret_cast(this), 0, 0, true); - ATOMIC_FAA(&n_waiters_, 1); - futex_.wait(key, timeout); - ATOMIC_FAA(&n_waiters_, -1); + if (ObWaitEventIds::DEFAULT_COND_WAIT != event_no_) { + ObWaitEventGuard guard(event_no_, timeout / 1000, reinterpret_cast(this), 0, 0, true); + ATOMIC_FAA(&n_waiters_, 1); + futex_.wait(key, timeout); + ATOMIC_FAA(&n_waiters_, -1); + } else { + ATOMIC_FAA(&n_waiters_, 1); + futex_.wait(key, timeout); + ATOMIC_FAA(&n_waiters_, -1); + } } } diff --git a/deps/oblib/src/lib/stat/ob_diagnose_info.cpp b/deps/oblib/src/lib/stat/ob_diagnose_info.cpp index 739b5a8e94..e09cc64e72 100644 --- a/deps/oblib/src/lib/stat/ob_diagnose_info.cpp +++ b/deps/oblib/src/lib/stat/ob_diagnose_info.cpp @@ -641,8 +641,8 @@ ObWaitEventGuard::ObWaitEventGuard(const int64_t event_no, const uint64_t timeou : event_no_(0), di_(nullptr), is_atomic_(is_atomic) { di_ = ObLocalDiagnosticInfo::get(); - if (OB_NOT_NULL(di_) && oceanbase::lib::is_diagnose_info_enabled() && - di_->get_ash_stat().is_active_session_) { need_record_ = true; + if (OB_NOT_NULL(di_) && di_->get_ash_stat().is_active_session_ && oceanbase::lib::is_diagnose_info_enabled()) { + need_record_ = true; event_no_ = event_no; di_->begin_wait_event(event_no, timeout_ms, p1, p2, p3); } else {