[CP] terminate process of switching to leader and return OB_SUCCESS when compensating abort log failed
This commit is contained in:
parent
7dd0d99d88
commit
bd7b419638
@ -599,12 +599,18 @@ int ObLSTxCtxMgr::replay_start_working_log(const ObTxStartWorkingLog &log, SCN s
|
||||
int ObLSTxCtxMgr::on_start_working_log_cb_succ(SCN start_working_ts)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
bool ignore_ret = false;
|
||||
WLockGuardWithRetryInterval guard(rwlock_, TRY_THRESOLD_US, RETRY_INTERVAL_US);
|
||||
StateHelper state_helper(ls_id_, state_);
|
||||
if (State::T_PENDING == state_ || State::T_BLOCKED_PENDING == state_) {
|
||||
SwitchToLeaderFunctor fn(start_working_ts);
|
||||
if (OB_FAIL(ls_tx_ctx_map_.for_each(fn))) {
|
||||
TRANS_LOG(WARN, "switch to leader failed", KR(ret), K(ls_id_));
|
||||
if (OB_NOT_MASTER == fn.get_ret()) {
|
||||
// ignore ret
|
||||
// PALF will switch to follower when submitting log return OB_NOT_MASTER
|
||||
ignore_ret = true;
|
||||
}
|
||||
}
|
||||
} else if (State::R_PENDING == state_ || State::R_BLOCKED_PENDING == state_) {
|
||||
ResumeLeaderFunctor fn(start_working_ts);
|
||||
@ -616,11 +622,15 @@ int ObLSTxCtxMgr::on_start_working_log_cb_succ(SCN start_working_ts)
|
||||
TRANS_LOG(ERROR, "unexpected state", KR(ret), K(ls_id_), K(state_));
|
||||
}
|
||||
if (OB_FAIL(ret)) {
|
||||
if (ignore_ret) {
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
// TODO dingxi, takeover failed, notify palf to revoke itself
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
// restore to follower
|
||||
if (OB_TMP_FAIL(state_helper.switch_state(Ops::SWL_CB_FAIL))) {
|
||||
TRANS_LOG(ERROR, "restore follower failed", KR(tmp_ret), K(ls_id_), K(state_));
|
||||
ret = tmp_ret;
|
||||
}
|
||||
} else {
|
||||
int tmp_ret = OB_SUCCESS;
|
||||
|
@ -184,7 +184,7 @@ private:
|
||||
class SwitchToLeaderFunctor
|
||||
{
|
||||
public:
|
||||
explicit SwitchToLeaderFunctor(share::SCN &start_working_ts)
|
||||
explicit SwitchToLeaderFunctor(share::SCN &start_working_ts) : ret_(common::OB_SUCCESS)
|
||||
{
|
||||
start_working_ts_ = start_working_ts;
|
||||
|
||||
@ -200,14 +200,16 @@ public:
|
||||
TRANS_LOG(WARN, "invalid argument", K(tx_id), "ctx", OB_P(tx_ctx));
|
||||
} else if (OB_TMP_FAIL(tx_ctx->switch_to_leader(start_working_ts_))) {
|
||||
TRANS_LOG(WARN, "switch_to_leader error", "ret", tmp_ret, K(*tx_ctx));
|
||||
ret_ = tmp_ret;
|
||||
} else {
|
||||
bool_ret = true;
|
||||
}
|
||||
return bool_ret;
|
||||
}
|
||||
|
||||
int get_ret() const { return ret_; }
|
||||
private:
|
||||
share::SCN start_working_ts_;
|
||||
int ret_;
|
||||
};
|
||||
|
||||
class SwitchToFollowerGracefullyFunctor
|
||||
|
Loading…
x
Reference in New Issue
Block a user