fix: gts_callback_interrupted change tenant failure

This commit is contained in:
fforkboat
2024-03-05 04:19:57 +00:00
committed by ob-robot
parent d1e9e08782
commit 3ba79326f4
6 changed files with 22 additions and 6 deletions

View File

@ -258,6 +258,11 @@ public:
MonotonicTs unused;
return source_.get_gts(stc, NULL, gts, unused);
}
virtual int remove_dropped_tenant(const uint64_t tenant_id)
{
UNUSED(tenant_id);
return OB_SUCCESS;
}
private:
MockObGtsSource &source_;
};

View File

@ -1196,12 +1196,15 @@ int ObPartTransCtx::gts_callback_interrupted(const int errcode)
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
TRANS_LOG(ERROR, "ObPartTransCtx not inited", K(ret));
} else if (OB_UNLIKELY(is_exiting_)) {
} else if (OB_UNLIKELY(!is_exiting_)) {
// at this time, ObTxCtxMgr should already be stopped,
// so ObPartTransCtx should already be killed
ret = OB_ERR_UNEXPECTED;
TRANS_LOG(ERROR, "ObPartTransCtx is not exiting", K(ret));
} else {
need_revert_ctx = true;
sub_state_.clear_gts_waiting();
TRANS_LOG(INFO, "transaction is interruputed gts callback", KR(ret), "context", *this);
} else {
ret = OB_EAGAIN;
}
}
if (need_revert_ctx) {

View File

@ -260,6 +260,8 @@ void ObTransService::stop()
TRANS_LOG(WARN, "ObTransTimer stop error", K(ret));
} else if (OB_FAIL(dup_table_scan_timer_.stop())) {
TRANS_LOG(WARN, "dup_table_scan_timer_ stop error", K(ret));
} else if (OB_FAIL(ts_mgr_->remove_dropped_tenant(tenant_id_))) {
TRANS_LOG(WARN, "gts_mgr stop error", K(ret));
} else {
rpc_->stop();
dup_table_rpc_->stop();

View File

@ -509,7 +509,7 @@ void ObTsMgr::run1()
ids.reset();
for (int64_t i = 0; i < check_ids.count(); i++) {
const uint64_t tenant_id = check_ids.at(i);
if (OB_FAIL(remove_dropped_tenant_(tenant_id))) {
if (OB_FAIL(remove_dropped_tenant(tenant_id))) {
TRANS_LOG(WARN, "remove dropped tenant failed", K(ret), K(tenant_id));
// ignore ret
ret = OB_SUCCESS;
@ -743,7 +743,7 @@ int ObTsMgr::delete_tenant_(const uint64_t tenant_id)
return ret;
}
int ObTsMgr::remove_dropped_tenant_(const uint64_t tenant_id)
int ObTsMgr::remove_dropped_tenant(const uint64_t tenant_id)
{
int ret = OB_SUCCESS;
ObTsTenantInfo tenant_info(tenant_id);

View File

@ -100,6 +100,7 @@ public:
bool &need_wait) = 0;
virtual int wait_gts_elapse(const uint64_t tenant_id, const share::SCN &scn) = 0;
virtual bool is_external_consistent(const uint64_t tenant_id) = 0;
virtual int remove_dropped_tenant(const uint64_t tenant_id) = 0;
public:
VIRTUAL_TO_STRING_KV("", "");
};
@ -405,6 +406,7 @@ public:
int wait_gts_elapse(const uint64_t tenant_id, const share::SCN &scn);
bool is_external_consistent(const uint64_t tenant_id);
int refresh_gts_location(const uint64_t tenant_id);
int remove_dropped_tenant(const uint64_t tenant_id);
public:
TO_STRING_KV("ts_source", "GTS");
public:
@ -420,7 +422,6 @@ private:
void revert_ts_source_info_(ObTsSourceInfoGuard &guard);
int add_tenant_(const uint64_t tenant_id);
int delete_tenant_(const uint64_t tenant_id);
int remove_dropped_tenant_(const uint64_t tenant_id);
static ObTsMgr* &get_instance_inner();
private:
bool is_inited_;

View File

@ -326,6 +326,11 @@ public:
return ret;
}
int remove_dropped_tenant(const uint64_t tenant_id) {
UNUSED(tenant_id);
return OB_SUCCESS;
}
int update_base_ts(const int64_t base_ts) { return OB_SUCCESS; }
int get_base_ts(int64_t &base_ts) { return OB_SUCCESS; }
bool is_external_consistent(const uint64_t tenant_id) { return true; }