[CP] [opt] optimize deps_lock_ in ObLogHandler

This commit is contained in:
BinChenn
2023-10-11 05:09:36 +00:00
committed by ob-robot
parent ca0c63ff12
commit ff219fca20
2 changed files with 4 additions and 1 deletions

View File

@ -1205,7 +1205,9 @@ int ObLogHandler::unlock_config_change(const int64_t lock_owner, const int64_t t
{
int ret = OB_SUCCESS;
const int64_t abs_timeout_us = common::ObTimeUtility::current_time() + timeout_us / 2;
WLockGuardWithTimeout deps_guard(deps_lock_, abs_timeout_us, ret);
// Note: rlock is safe, the deps_lock_ is used to protect states of ObLogHandler
// such as is_in_stop_state_.
RLockGuardWithTimeout deps_guard(deps_lock_, abs_timeout_us, ret);
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
} else if (OB_FAIL(ret)) {

View File

@ -690,6 +690,7 @@ public:
bool is_offline() const override final;
private:
static constexpr int64_t MIN_CONN_TIMEOUT_US = 5 * 1000 * 1000; // 5s
typedef common::TCRWLock::RLockGuardWithTimeout RLockGuardWithTimeout;
typedef common::TCRWLock::WLockGuardWithTimeout WLockGuardWithTimeout;
private:
int submit_config_change_cmd_(const LogConfigChangeCmd &req);