Fix replay finish transfer in log allow tablet not exist bug.

This commit is contained in:
godyangfight
2024-04-02 05:12:00 +00:00
committed by ob-robot
parent 0e872264c0
commit 12d8b47370
8 changed files with 24 additions and 7 deletions

View File

@ -132,7 +132,8 @@ int ObTabletReplayExecutor::replay_get_tablet_(
} else {
const share::ObLSID &ls_id = ls->get_ls_id();
if (is_replay_update_tablet_status_()) {
if (OB_FAIL(ls->replay_get_tablet_no_check(tablet_id, scn, tablet_handle))) {
const bool allow_tablet_not_exist = replay_allow_tablet_not_exist_();
if (OB_FAIL(ls->replay_get_tablet_no_check(tablet_id, scn, allow_tablet_not_exist, tablet_handle))) {
CLOG_LOG(WARN, "replay get table failed", KR(ret), K(ls_id), K(tablet_id));
}
} else if (OB_FAIL(ls->replay_get_tablet(tablet_id, scn, is_update_mds_table, tablet_handle))) {

View File

@ -91,6 +91,8 @@ protected:
// @return other error codes, failed to replay.
virtual int replay_check_restore_status_(storage::ObTabletHandle &tablet_handle);
virtual bool replay_allow_tablet_not_exist_() { return true; }
// not allowed to pass ObTabletCreateDeleteMdsUserData or ObTabletBindingMdsUserData
template <typename T,
typename U = typename std::enable_if<

View File

@ -149,7 +149,9 @@ int ObDDLStartReplayExecutor::do_replay_(ObTabletHandle &tablet_handle)
LOG_WARN("get lob meta tablet id failed", K(ret));
} else if (lob_meta_tablet_id.is_valid()) {
ObTabletHandle lob_meta_tablet_handle;
if (OB_FAIL(ls_->replay_get_tablet_no_check(lob_meta_tablet_id, scn_, lob_meta_tablet_handle))) {
const bool replay_allow_tablet_not_exist = true;
if (OB_FAIL(ls_->replay_get_tablet_no_check(lob_meta_tablet_id, scn_,
replay_allow_tablet_not_exist, lob_meta_tablet_handle))) {
LOG_WARN("get tablet handle failed", K(ret), K(lob_meta_tablet_id), K(scn_));
} else if (OB_FAIL(replay_ddl_start(lob_meta_tablet_handle, true/*is_lob_meta_tablet*/))) {
LOG_WARN("replay ddl start for lob meta tablet failed", K(ret), K(lob_meta_tablet_id), K(scn_));
@ -423,7 +425,9 @@ int ObDDLCommitReplayExecutor::do_replay_(ObTabletHandle &tablet_handle)
LOG_WARN("get lob meta tablet id failed", K(ret));
} else if (lob_meta_tablet_id.is_valid()) {
ObTabletHandle lob_meta_tablet_handle;
if (OB_FAIL(ls_->replay_get_tablet_no_check(lob_meta_tablet_id, scn_, lob_meta_tablet_handle))) {
const bool replay_allow_tablet_not_exist = true;
if (OB_FAIL(ls_->replay_get_tablet_no_check(lob_meta_tablet_id, scn_,
replay_allow_tablet_not_exist, lob_meta_tablet_handle))) {
LOG_WARN("get tablet handle failed", K(ret), K(lob_meta_tablet_id), K(scn_));
} else if (OB_FAIL(replay_ddl_commit(lob_meta_tablet_handle))) {
LOG_WARN("replay ddl start for lob meta tablet failed", K(ret), K(lob_meta_tablet_id), K(scn_));

View File

@ -1694,6 +1694,7 @@ int ObLS::finish_slog_replay()
int ObLS::replay_get_tablet_no_check(
const common::ObTabletID &tablet_id,
const SCN &scn,
const bool replay_allow_tablet_not_exist,
ObTabletHandle &handle) const
{
int ret = OB_SUCCESS;
@ -1727,9 +1728,10 @@ int ObLS::replay_get_tablet_no_check(
} else if (!max_scn.is_valid()) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("max_scn is invalid", KR(ret), K(key), K(scn), K(tablet_change_checkpoint_scn));
} else if (scn > SCN::scn_inc(max_scn)) {
} else if (scn > SCN::scn_inc(max_scn) || !replay_allow_tablet_not_exist) {
ret = OB_EAGAIN;
LOG_INFO("tablet does not exist, but need retry", KR(ret), K(key), K(scn), K(tablet_change_checkpoint_scn), K(max_scn));
LOG_INFO("tablet does not exist, but need retry", KR(ret), K(key), K(scn),
K(tablet_change_checkpoint_scn), K(max_scn), K(replay_allow_tablet_not_exist));
} else {
ret = OB_OBSOLETE_CLOG_NEED_SKIP;
LOG_INFO("tablet already gc, but scn is more than tablet_change_checkpoint_scn", KR(ret),
@ -1757,11 +1759,12 @@ int ObLS::replay_get_tablet(
ObTablet *tablet = nullptr;
ObTabletCreateDeleteMdsUserData data;
bool is_committed = false;
const bool replay_allow_tablet_not_exist = true;
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("ls is not inited", KR(ret));
} else if (OB_FAIL(replay_get_tablet_no_check(tablet_id, scn, tablet_handle))) {
} else if (OB_FAIL(replay_get_tablet_no_check(tablet_id, scn, replay_allow_tablet_not_exist, tablet_handle))) {
LOG_WARN("failed to get tablet", K(ret), K(ls_id), K(tablet_id), K(scn));
} else if (tablet_id.is_ls_inner_tablet()) {
// do nothing

View File

@ -380,6 +380,7 @@ public:
int replay_get_tablet_no_check(
const common::ObTabletID &tablet_id,
const share::SCN &scn,
const bool replay_allow_tablet_not_exist,
ObTabletHandle &tablet_handle) const;
int flush_if_need(const bool need_flush);

View File

@ -175,7 +175,8 @@ int ObTabletBindingHelper::get_tablet_for_new_mds(const ObLS &ls, const ObTablet
const ObTabletMapKey key(ls.get_ls_id(), tablet_id);
const bool for_replay = replay_scn.is_valid();
if (for_replay) {
if (OB_FAIL(ls.replay_get_tablet_no_check(tablet_id, replay_scn, handle))) {
const bool replay_allow_tablet_not_exist = true;
if (OB_FAIL(ls.replay_get_tablet_no_check(tablet_id, replay_scn, replay_allow_tablet_not_exist, handle))) {
if (OB_OBSOLETE_CLOG_NEED_SKIP == ret) {
ret = OB_NO_NEED_UPDATE;
LOG_WARN("clog is obsolete, should skip replay", K(ret));

View File

@ -148,6 +148,8 @@ protected:
return true;
}
virtual bool replay_allow_tablet_not_exist_() { return false; }
private:
int check_src_transfer_tablet_(ObTabletHandle &tablet_handle);
@ -585,6 +587,7 @@ protected:
{
return true;
}
virtual bool replay_allow_tablet_not_exist_() { return false; }
private:
int check_dest_transfer_tablet_(ObTabletHandle &tablet_handle);

View File

@ -68,6 +68,8 @@ protected:
return true;
}
virtual bool replay_allow_tablet_not_exist_() { return false; }
private:
int check_src_transfer_tablet_(ObTabletHandle &tablet_handle);