fix backup macro block reader not reset when in inner retry process

This commit is contained in:
oceanoverflow
2022-11-09 12:05:52 +00:00
committed by wangzelin.wzl
parent d43171fc6c
commit 2a46dfbd3a
3 changed files with 16 additions and 1 deletions

View File

@ -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);

View File

@ -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 &macro_id = macro_list_.at(idx);
const common::ObLogicMacroBlockId &logic_id = macro_id.logic_id_;
const blocksstable::MacroBlockId &macro_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;
}