Auto switch freeze mode for palf.

This commit is contained in:
obdev
2022-11-06 03:05:40 +00:00
committed by wangzelin.wzl
parent f40dd6025e
commit 525fc5ba35
8 changed files with 166 additions and 24 deletions

View File

@ -556,8 +556,19 @@ bool PalfEnvImpl::FreezeLogFunctor::operator() (const LSKey &palf_id, PalfHandle
int tmp_ret = OB_SUCCESS;
if (NULL == palf_handle_impl) {
PALF_LOG(ERROR, "palf_handle_impl is NULL", KP(palf_handle_impl), K(palf_id));
} else if (OB_SUCCESS != (tmp_ret = palf_handle_impl->try_freeze_last_log())) {
PALF_LOG(WARN, "try_freeze_last_log failed", K(tmp_ret), K(palf_id));
} else if (OB_SUCCESS != (tmp_ret = palf_handle_impl->period_freeze_last_log())) {
PALF_LOG(WARN, "period_freeze_last_log failed", K(tmp_ret), K(palf_id));
} else {}
return true;
}
bool PalfEnvImpl::CheckFreezeModeFunctor::operator() (const LSKey &palf_id, PalfHandleImpl *palf_handle_impl)
{
int tmp_ret = OB_SUCCESS;
if (NULL == palf_handle_impl) {
PALF_LOG(ERROR, "palf_handle_impl is NULL", KP(palf_handle_impl), K(palf_id));
} else if (OB_SUCCESS != (tmp_ret = palf_handle_impl->check_and_switch_freeze_mode())) {
PALF_LOG(WARN, "check_and_switch_freeze_mode failed", K(tmp_ret), K(palf_id));
} else {}
return true;
}
@ -575,6 +586,19 @@ int PalfEnvImpl::try_switch_state_for_all()
return ret;
}
int PalfEnvImpl::check_and_switch_freeze_mode()
{
int ret = OB_SUCCESS;
CheckFreezeModeFunctor check_freeze_mode_functor;
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
PALF_LOG(WARN, "PalfEnvImpl is not inited", K(ret));
} else if (OB_FAIL(palf_handle_impl_map_.for_each(check_freeze_mode_functor))) {
PALF_LOG(WARN, "palf_handle_impl_map_ for_each failed", K(ret));
} else {}
return ret;
}
int PalfEnvImpl::try_freeze_log_for_all()
{
int ret = OB_SUCCESS;