fixed restore hang because last log on nfs is not integrity.

This commit is contained in:
HaHaJeff
2024-02-09 18:07:51 +00:00
committed by ob-robot
parent dbba584bb9
commit 3a81957550
2 changed files with 12 additions and 5 deletions

View File

@ -125,7 +125,8 @@ private:
void update_data_gen_max_lsn_();
void advance_data_gen_lsn_();
void mark_source_error_(const int ret_code);
bool need_prepare_buf_(const int ret_code) const;
bool need_prepare_buf_(const int ret_code,
int has_retry_count) const;
private:
bool inited_;

View File

@ -240,10 +240,11 @@ int ObRemoteLogIterator<LogEntryType>::next_entry_(LogEntryType &entry, LSN &lsn
{
int ret = OB_SUCCESS;
bool done = false;
int64_t has_retry_count = 0;
do {
if (OB_FAIL(ret)) {
} else if (OB_FAIL(get_entry_(entry, lsn, buf, buf_size))) {
if (need_prepare_buf_(ret)) {
if (need_prepare_buf_(ret, has_retry_count)) {
CLOG_LOG(TRACE, "buf not enough, need read data", K(ret), KPC(this));
} else {
CLOG_LOG(WARN, "get entry failed", K(ret), KPC(this));
@ -259,13 +260,15 @@ int ObRemoteLogIterator<LogEntryType>::next_entry_(LogEntryType &entry, LSN &lsn
}
}
if (need_prepare_buf_(ret)) {
if (need_prepare_buf_(ret, has_retry_count)) {
if (OB_FAIL(prepare_buf_())) {
if (OB_ITER_END != ret) {
CLOG_LOG(WARN, "prepare buffer failed", K(ret));
} else {
CLOG_LOG(TRACE, "prepare buffer to end", K(ret), KPC(this));
}
} else {
has_retry_count++;
}
}
@ -284,9 +287,12 @@ int ObRemoteLogIterator<LogEntryType>::next_entry_(LogEntryType &entry, LSN &lsn
}
template<class LogEntryType>
bool ObRemoteLogIterator<LogEntryType>::need_prepare_buf_(const int ret_code) const
bool ObRemoteLogIterator<LogEntryType>::need_prepare_buf_(const int ret_code,
int has_retry_count) const
{
return OB_BUF_NOT_ENOUGH == ret_code || OB_NEED_RETRY == ret_code;
const int MAX_RETRY_COUNT = 2;
return OB_BUF_NOT_ENOUGH == ret_code
|| (OB_NEED_RETRY == ret_code && has_retry_count < MAX_RETRY_COUNT);
}
template<class LogEntryType>