From 856ae12473b6bdff7347278999d0eb77ffe0ba36 Mon Sep 17 00:00:00 2001 From: obdev Date: Fri, 8 Sep 2023 12:53:39 +0800 Subject: [PATCH] check is_inited_ before destroy ObStandbyTimestampService --- .../tx/ob_standby_timestamp_service.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/storage/tx/ob_standby_timestamp_service.cpp b/src/storage/tx/ob_standby_timestamp_service.cpp index 7eb015a65..696cdd5e3 100644 --- a/src/storage/tx/ob_standby_timestamp_service.cpp +++ b/src/storage/tx/ob_standby_timestamp_service.cpp @@ -96,15 +96,17 @@ void ObStandbyTimestampService::wait() void ObStandbyTimestampService::destroy() { - inited_ = false; - tenant_id_ = OB_INVALID_ID; - //TODO(SCN):zhaoxing last_id should be uint64_t - last_id_ = OB_INVALID_VERSION; - epoch_ = OB_INVALID_TIMESTAMP; - switch_to_leader_ts_ = OB_INVALID_TIMESTAMP; - TG_DESTROY(tg_id_); - rpc_.destroy(); - TRANS_LOG(INFO, "standby timestamp service destroy", K_(tenant_id)); + if (inited_) { + inited_ = false; + tenant_id_ = OB_INVALID_ID; + //TODO(SCN):zhaoxing last_id should be uint64_t + last_id_ = OB_INVALID_VERSION; + epoch_ = OB_INVALID_TIMESTAMP; + switch_to_leader_ts_ = OB_INVALID_TIMESTAMP; + TG_DESTROY(tg_id_); + rpc_.destroy(); + TRANS_LOG(INFO, "standby timestamp service destroy", K_(tenant_id)); + } } int ObStandbyTimestampService::query_and_update_last_id()