rollback retain_cause after insert into retain_ctx_mgr failed
This commit is contained in:
@ -5895,11 +5895,11 @@ int ObPartTransCtx::insert_into_retain_ctx_mgr_(RetainCause cause,
|
|||||||
retain_lock_timeout = 10 * 1000;
|
retain_lock_timeout = 10 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ObTxRetainCtxMgr &retain_ctx_mgr = ls_tx_ctx_mgr_->get_retain_ctx_mgr();
|
||||||
if (OB_ISNULL(ls_tx_ctx_mgr_) || RetainCause::UNKOWN == cause) {
|
if (OB_ISNULL(ls_tx_ctx_mgr_) || RetainCause::UNKOWN == cause) {
|
||||||
ret = OB_INVALID_ARGUMENT;
|
ret = OB_INVALID_ARGUMENT;
|
||||||
TRANS_LOG(WARN, "invalid argument", K(ret), K(cause), KP(ls_tx_ctx_mgr_), KPC(this));
|
TRANS_LOG(WARN, "invalid argument", K(ret), K(cause), KP(ls_tx_ctx_mgr_), KPC(this));
|
||||||
} else {
|
} else {
|
||||||
ObTxRetainCtxMgr &retain_ctx_mgr = ls_tx_ctx_mgr_->get_retain_ctx_mgr();
|
|
||||||
|
|
||||||
if (OB_ISNULL(retain_func_ptr = static_cast<ObMDSRetainCtxFunctor *>(
|
if (OB_ISNULL(retain_func_ptr = static_cast<ObMDSRetainCtxFunctor *>(
|
||||||
retain_ctx_mgr.alloc_object((sizeof(ObMDSRetainCtxFunctor)))))) {
|
retain_ctx_mgr.alloc_object((sizeof(ObMDSRetainCtxFunctor)))))) {
|
||||||
@ -5915,12 +5915,18 @@ int ObPartTransCtx::insert_into_retain_ctx_mgr_(RetainCause cause,
|
|||||||
// if (OB_FAIL(retain_ctx_mgr.reset()))
|
// if (OB_FAIL(retain_ctx_mgr.reset()))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OB_FAIL(ret) && !(OB_EAGAIN == ret && for_replay)) {
|
if (OB_FAIL(ret)) {
|
||||||
TRANS_LOG(ERROR, "insert into retain_ctx_mgr error, retain ctx will not deleted from ctx_mgr",
|
clean_retain_cause_();
|
||||||
K(ret), KPC(this));
|
if (retain_func_ptr != nullptr) {
|
||||||
// ob_abort();
|
retain_ctx_mgr.free_object(retain_func_ptr);
|
||||||
|
retain_func_ptr = nullptr;
|
||||||
|
}
|
||||||
|
if (!(OB_EAGAIN == ret && for_replay)) {
|
||||||
|
TRANS_LOG(ERROR, "insert into retain_ctx_mgr error, retain ctx will not deleted from ctx_mgr",
|
||||||
|
K(ret), KPC(this));
|
||||||
|
// ob_abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -240,10 +240,14 @@ int ObTxRetainCtxMgr::force_gc_retain_ctx()
|
|||||||
SpinWLockGuard guard(retain_ctx_lock_);
|
SpinWLockGuard guard(retain_ctx_lock_);
|
||||||
tg.click();
|
tg.click();
|
||||||
|
|
||||||
|
const int64_t before_remove_count = retain_ctx_list_.size();
|
||||||
if (OB_FAIL(for_each_remove_(&ObTxRetainCtxMgr::force_gc_, nullptr, INT64_MAX))) {
|
if (OB_FAIL(for_each_remove_(&ObTxRetainCtxMgr::force_gc_, nullptr, INT64_MAX))) {
|
||||||
TRANS_LOG(WARN, "[RetainCtxMgr] force gc all retain ctx faild", K(ret));
|
TRANS_LOG(WARN, "[RetainCtxMgr] force gc all retain ctx faild", K(ret));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRANS_LOG(INFO, "[RetainCtxMgr] force gc all retain ctx", K(ret), K(before_remove_count),
|
||||||
|
KPC(this));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -122,7 +122,10 @@ public:
|
|||||||
|
|
||||||
void try_advance_retain_ctx_gc(share::ObLSID ls_id);
|
void try_advance_retain_ctx_gc(share::ObLSID ls_id);
|
||||||
|
|
||||||
TO_STRING_KV(K(retain_ctx_list_.size()));
|
TO_STRING_KV(K(retain_ctx_list_.size()),
|
||||||
|
K(max_wait_ckpt_ts_),
|
||||||
|
K(last_push_gc_task_ts_),
|
||||||
|
K(skip_remove_cnt_));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int remove_ctx_func_(RetainCtxList::iterator remove_iter);
|
int remove_ctx_func_(RetainCtxList::iterator remove_iter);
|
||||||
|
|||||||
Reference in New Issue
Block a user