diff --git a/src/storage/transaction/ob_trans_define.cpp b/src/storage/transaction/ob_trans_define.cpp index 8994e38127b90cc48b302d37a3ae712871fe34b9..b76b236e32d49ddc93b2f89abcda6f4237a12f91 100644 --- a/src/storage/transaction/ob_trans_define.cpp +++ b/src/storage/transaction/ob_trans_define.cpp @@ -1075,6 +1075,18 @@ void ObTransDesc::consistency_wait() void ObTransDesc::reset() { + if (OB_NOT_NULL(sche_ctx_)) { + need_print_trace_log_ = true; + if (EXECUTE_COUNT_PER_SEC(64)) { + TRANS_LOG(WARN, "reset trans desc without release sche ctx", K(*this), KP(sche_ctx_), "lbt", lbt()); + } + } + if (OB_NOT_NULL(part_ctx_)) { + need_print_trace_log_ = true; + if (EXECUTE_COUNT_PER_SEC(64)) { + TRANS_LOG(WARN, "reset trans desc without release part ctx", K(*this), KP(part_ctx_), "lbt", lbt()); + } + } if (need_print_trace_log_) { FORCE_PRINT_TRACE(&tlog_, "[trans error] "); } diff --git a/src/storage/transaction/ob_ts_mgr.h b/src/storage/transaction/ob_ts_mgr.h index 746bf802c9cf2a37bb79a11e12da1be385f22776..adad974fc3a876aa07937a12016b1168021d5337 100644 --- a/src/storage/transaction/ob_ts_mgr.h +++ b/src/storage/transaction/ob_ts_mgr.h @@ -14,6 +14,7 @@ #define OCEANBASE_TRANSACTION_OB_TS_MGR_ #include +#include "common/ob_clock_generator.h" #include "lib/utility/ob_print_utils.h" #include "lib/lock/ob_drw_lock.h" #include "lib/hash/ob_link_hashmap.h" @@ -189,11 +190,16 @@ public: } int set_invalid(); int switch_ts_source(const uint64_t tenant_id, const int ts_type); + TO_STRING_KV(K_(tenant_id), K_(last_check_switch_ts), K_(last_obtain_switch_ts), K_(check_switch_interval), + K_(cur_ts_type), K_(last_access_ts)); private: int switch_ts_source_(const uint64_t tenant_id, const int ts_type); void revert_ts_source_(ObTsSourceGuard& guard); +public: + static const int64_t DEFAULT_NEED_PRINT_INTERVAL_US = 120 * 1000 * 1000; + private: static const int64_t DEFAULT_CHECK_SWITCH_INTERVAL_US = 100 * 1000; static const int64_t MAX_CHECK_SWITCH_INTERVAL_US = 3 * 1000 * 1000; @@ -265,6 +271,12 @@ public: ret = common::OB_ERR_UNEXPECTED; TRANS_LOG(ERROR, "ha gts source is null", KR(ret), K(gts_tenant_info)); } else { + if (common::ObClockGenerator::getClock() - ts_source_info->get_last_obtain_switch_ts() >= + ObTsSourceInfo::DEFAULT_NEED_PRINT_INTERVAL_US) { + if (EXECUTE_COUNT_PER_SEC(5)) { + TRANS_LOG(WARN, "gts source maybe need delete", K(gts_tenant_info), K(*ts_source_info)); + } + } if (OB_FAIL(gts_source->refresh_gts(false))) { if (EXECUTE_COUNT_PER_SEC(1)) { TRANS_LOG(WARN, "refresh gts failed", KR(ret), K(gts_tenant_info));