From cc7aa7132af562b35e91d95c8ff304dbcfd6cb7e Mon Sep 17 00:00:00 2001 From: hiddenbomb Date: Mon, 28 Aug 2023 08:47:40 +0000 Subject: [PATCH] set errno to OB_EAGAIN if replay get tablet interface returns OB_TIMEOUT --- .../ob_tablet_replay_executor.cpp | 21 ++++++++++++++----- src/storage/ls/ob_ls_storage_clog_handler.cpp | 14 ++++++------- src/storage/ob_storage_clog_recorder.cpp | 10 ++++++++- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/logservice/replayservice/ob_tablet_replay_executor.cpp b/src/logservice/replayservice/ob_tablet_replay_executor.cpp index 32cf96c777..4c46a10699 100644 --- a/src/logservice/replayservice/ob_tablet_replay_executor.cpp +++ b/src/logservice/replayservice/ob_tablet_replay_executor.cpp @@ -128,13 +128,24 @@ int ObTabletReplayExecutor::replay_get_tablet_( } else if (OB_ISNULL(ls = ls_handle.get_ls())) { ret = OB_ERR_UNEXPECTED; CLOG_LOG(WARN, "log stream should not be NULL", KR(ret), K(scn)); - } else if (is_replay_update_tablet_status_()) { - if (OB_FAIL(ls->replay_get_tablet_no_check(tablet_id, scn, tablet_handle))) { - CLOG_LOG(WARN, "replay get table failed", KR(ret), "ls_id", ls->get_ls_id()); + } 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))) { + 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, tablet_handle))) { + CLOG_LOG(WARN, "replay get table failed", KR(ret), K(ls_id), K(tablet_id)); + } + + if (OB_FAIL(ret)) { + if (OB_TIMEOUT == ret) { + ret = OB_EAGAIN; + CLOG_LOG(WARN, "retry get tablet for timeout error", KR(ret), K(ls_id), K(tablet_id)); + } } - } else if (OB_FAIL(ls->replay_get_tablet(tablet_id, scn, tablet_handle))) { - CLOG_LOG(WARN, "replay get table failed", KR(ret), "ls_id", ls->get_ls_id()); } + return ret; } diff --git a/src/storage/ls/ob_ls_storage_clog_handler.cpp b/src/storage/ls/ob_ls_storage_clog_handler.cpp index 703238505a..768d15f7ca 100644 --- a/src/storage/ls/ob_ls_storage_clog_handler.cpp +++ b/src/storage/ls/ob_ls_storage_clog_handler.cpp @@ -114,18 +114,18 @@ int ObMediumCompactionClogHandler::inner_replay( LOG_WARN("fail to deserialize tablet id", K(ret), K(buffer_size), K(pos), K(tablet_id)); } else if (OB_FAIL(ls_->replay_get_tablet(tablet_id, scn, handle))) { if (OB_OBSOLETE_CLOG_NEED_SKIP == ret) { - LOG_INFO("clog is obsolete, should skip replay", K(ret), K(tablet_id)); + LOG_INFO("clog is obsolete, should skip replay", K(ret), K(tablet_id), K(scn)); ret = OB_SUCCESS; + } else if (OB_TIMEOUT == ret) { + ret = OB_EAGAIN; + LOG_INFO("retry get tablet for timeout error", K(ret), K(tablet_id), K(scn)); } else { - LOG_WARN("failed to get tablet", K(ret), K(tablet_id)); + LOG_WARN("failed to get tablet", K(ret), K(tablet_id), K(scn)); } } else if (OB_FAIL(handle.get_obj()->replay_medium_compaction_clog(scn, buffer, buffer_size, new_pos))) { - LOG_WARN("failed to replay medium compaction clog", K(ret), K(tablet_id), K(buffer_size), K(new_pos)); - } - if (OB_TIMEOUT == ret) { - LOG_INFO("replace timeout errno", KR(ret), K(scn), K(tablet_id)); - ret = OB_EAGAIN; + LOG_WARN("failed to replay medium compaction clog", K(ret), K(tablet_id), K(scn), K(buffer_size), K(new_pos)); } + return ret; } diff --git a/src/storage/ob_storage_clog_recorder.cpp b/src/storage/ob_storage_clog_recorder.cpp index eac2d8aac0..3c17e351f6 100644 --- a/src/storage/ob_storage_clog_recorder.cpp +++ b/src/storage/ob_storage_clog_recorder.cpp @@ -311,7 +311,15 @@ int ObIStorageClogRecorder::replay_get_tablet_handle( if (OB_FAIL(MTL(ObLSService *)->get_ls(ls_id, ls_handle, ObLSGetMod::STORAGE_MOD))) { LOG_WARN("failed to get log stream", K(ret), K(ls_id)); } else if (OB_FAIL(ls_handle.get_ls()->replay_get_tablet(tablet_id, scn, tablet_handle))) { - LOG_WARN("failed to get tablet", K(ret), K(ls_id), K(tablet_id), K(scn)); + if (OB_OBSOLETE_CLOG_NEED_SKIP == ret) { + LOG_INFO("clog is obsolete, should skip replay", K(ret), K(ls_id), K(tablet_id), K(scn)); + ret = OB_SUCCESS; + } else if (OB_TIMEOUT == ret) { + ret = OB_EAGAIN; + LOG_INFO("retry get tablet for timeout error", K(ret), K(ls_id), K(tablet_id), K(scn)); + } else { + LOG_WARN("failed to get tablet", K(ret), K(ls_id), K(tablet_id), K(scn)); + } } return ret; }