提交 062a57e1 编写于 作者: O obdev 提交者: wangzelin.wzl

[CP] add defense for drop tenant and trans desc reset

上级 0336a929
......@@ -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] ");
}
......
......@@ -14,6 +14,7 @@
#define OCEANBASE_TRANSACTION_OB_TS_MGR_
#include <stdint.h>
#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));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册