diff --git a/deps/oblib/src/lib/utility/ob_tracepoint.h b/deps/oblib/src/lib/utility/ob_tracepoint.h index b98963ab72..bdc80b25db 100644 --- a/deps/oblib/src/lib/utility/ob_tracepoint.h +++ b/deps/oblib/src/lib/utility/ob_tracepoint.h @@ -633,6 +633,7 @@ class EventTable EN_ADD_BACKUP_FINISH_DAG_FAILED = 1108, EN_ADD_BACKUP_PREFETCH_DAG_FAILED = 1109, EN_BACKUP_PERSIST_SET_TASK_FAILED = 1110, + EN_BACKUP_READ_MACRO_BLOCK_FAILED = 1111, EVENT_TABLE_MAX = SIZE_OF_EVENT_TABLE }; diff --git a/src/share/ob_debug_sync_point.h b/src/share/ob_debug_sync_point.h index 5ab7454ffd..4d4e1344a9 100644 --- a/src/share/ob_debug_sync_point.h +++ b/src/share/ob_debug_sync_point.h @@ -420,6 +420,7 @@ class ObString; ACT(BEFORE_MIG_DDL_TABLE_MERGE_TASK,)\ ACT(BEFORE_COPY_DDL_SSTABLE,)\ ACT(BEFORE_DDL_WRITE_PREPARE_LOG,)\ + ACT(AFTER_BACKUP_FETCH_MACRO_BLOCK_FAILED,)\ ACT(MAX_DEBUG_SYNC_POINT,) DECLARE_ENUM(ObDebugSyncPoint, debug_sync_point, OB_DEBUG_SYNC_POINT_DEF); diff --git a/src/storage/backup/ob_backup_reader.cpp b/src/storage/backup/ob_backup_reader.cpp index 6a1c2960ca..ec8472ebf8 100644 --- a/src/storage/backup/ob_backup_reader.cpp +++ b/src/storage/backup/ob_backup_reader.cpp @@ -19,6 +19,8 @@ #include "storage/blocksstable/ob_block_manager.h" #include "storage/blocksstable/ob_macro_block_id.h" #include "storage/ls/ob_ls.h" +#include "lib/utility/ob_tracepoint.h" +#include "observer/ob_server_event_history_table_operator.h" using namespace oceanbase::blocksstable; using namespace oceanbase::storage; @@ -403,6 +405,7 @@ int ObMultiMacroBlockBackupReader::prepare_macro_block_reader_(const int64_t idx ret = OB_INVALID_ARGUMENT; LOG_WARN("get invalid args", K(ret), K(idx), K(readers_.count())); } else { + readers_.at(idx)->reset(); const ObBackupMacroBlockId ¯o_id = macro_list_.at(idx); const common::ObLogicMacroBlockId &logic_id = macro_id.logic_id_; const blocksstable::MacroBlockId ¯o_block_id = macro_id.macro_block_id_; @@ -419,12 +422,22 @@ int ObMultiMacroBlockBackupReader::fetch_macro_block_with_retry_( int ret = OB_SUCCESS; int64_t retry_times = 0; while (retry_times < OB_MAX_RETRY_TIMES) { - if (retry_times > 1) { + if (retry_times >= 1) { LOG_WARN("retry get macro block", K(retry_times)); } if (OB_FAIL(fetch_macro_block_(data, logic_id))) { LOG_WARN("failed to fetch macro block", K(ret), K(retry_times)); } +#ifdef ERRSIM + if (OB_SUCC(ret)) { + ret = E(EventTable::EN_BACKUP_READ_MACRO_BLOCK_FAILED) OB_SUCCESS; + if (OB_FAIL(ret)) { + SERVER_EVENT_SYNC_ADD("backup", "fetch_macro_block_failed", + "logic_id", logic_id); + DEBUG_SYNC(AFTER_BACKUP_FETCH_MACRO_BLOCK_FAILED); + } + } +#endif if (OB_SUCC(ret)) { break; }