add check status in coordinator write and deal -4018 error of coordinator heartbeat

This commit is contained in:
obdev 2024-02-10 05:19:59 +00:00 committed by ob-robot
parent 5821a7cce7
commit 0eb10fb821

View File

@ -851,8 +851,17 @@ int ObTableLoadCoordinator::heart_beat()
LOG_WARN("ObTableLoadCoordinator not init", KR(ret), KP(this));
} else {
LOG_DEBUG("coordinator heart beat");
// 心跳是为了让数据节点感知控制节点存活, 控制节点不依赖心跳感知数据节点状态, 忽略失败
heart_beat_peer();
// 心跳是为了让数据节点感知控制节点存活, 让控制节点感知数据节点是否重启过(返回-4018),忽略其它失败
if (OB_FAIL(heart_beat_peer())) {
if (ret == OB_ENTRY_NOT_EXIST) {
LOG_WARN("store has been restarted", K(ret));
if (OB_FAIL(coordinator_ctx_->set_status_abort())) {
LOG_WARN("fail to set coordinator status abort", KR(ret));
} else {
coordinator_ctx_->set_enable_heart_beat(false);
}
}
}
}
return ret;
}
@ -1431,6 +1440,8 @@ int ObTableLoadCoordinator::write(const ObTableLoadTransId &trans_id, int32_t se
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("ObTableLoadCoordinator not init", KR(ret), KP(this));
} else if (OB_FAIL(coordinator_ctx_->check_status(ObTableLoadStatusType::LOADING))) {
LOG_WARN("fail to check coordinator status", KR(ret));
} else {
LOG_DEBUG("coordinator write");
ObTableLoadCoordinatorTrans *trans = nullptr;
@ -1498,6 +1509,8 @@ int ObTableLoadCoordinator::write(const ObTableLoadTransId &trans_id,
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("ObTableLoadCoordinator not init", KR(ret), KP(this));
} else if (OB_FAIL(coordinator_ctx_->check_status(ObTableLoadStatusType::LOADING))) {
LOG_WARN("fail to check coordinator status", KR(ret));
} else {
LOG_DEBUG("coordinator write");
ObTableLoadCoordinatorTrans *trans = nullptr;