From 05d3a935cce055a455d5c42bc751d1c9b4d047a2 Mon Sep 17 00:00:00 2001 From: obdev Date: Tue, 14 Mar 2023 13:16:55 +0000 Subject: [PATCH] Limit archive memory usage based on send_task_status --- src/logservice/archiveservice/ob_archive_fetcher.cpp | 10 ++++++++++ src/logservice/restoreservice/ob_remote_log_iterator.h | 1 - .../restoreservice/ob_remote_log_iterator.ipp | 7 ------- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/logservice/archiveservice/ob_archive_fetcher.cpp b/src/logservice/archiveservice/ob_archive_fetcher.cpp index 0718534c1e..9b25305021 100644 --- a/src/logservice/archiveservice/ob_archive_fetcher.cpp +++ b/src/logservice/archiveservice/ob_archive_fetcher.cpp @@ -452,6 +452,8 @@ int ObArchiveFetcher::check_need_delay_(const ObLSID &id, SCN fetch_scn; need_delay = false; int64_t send_task_count = 0; + int64_t ls_archive_task_count = 0; + int64_t send_task_status_count = 0; if (FALSE_IT(check_capacity_enough_(commit_lsn, cur_lsn, end_lsn, data_enough, data_full))) { } else if (data_full) { @@ -473,6 +475,14 @@ int ObArchiveFetcher::check_need_delay_(const ObLSID &id, } else if (true == (need_delay = ! check_scn_enough_(fetch_scn, commit_scn))) { ARCHIVE_LOG(TRACE, "scn not enough, need delay", K(id), K(station), K(fetch_scn), K(commit_scn)); + } else { + ls_archive_task_count = ls_mgr_->get_ls_task_count(); + send_task_status_count = archive_sender_->get_send_task_status_count(); + if (ls_archive_task_count < send_task_status_count) { + need_delay = true; + ARCHIVE_LOG(TRACE, "archive_sender_ task status count more than ls archive task count, just wait", + K(ls_archive_task_count), K(send_task_status_count), K(need_delay)); + } } } } diff --git a/src/logservice/restoreservice/ob_remote_log_iterator.h b/src/logservice/restoreservice/ob_remote_log_iterator.h index 6639f62ff3..6202711476 100644 --- a/src/logservice/restoreservice/ob_remote_log_iterator.h +++ b/src/logservice/restoreservice/ob_remote_log_iterator.h @@ -117,7 +117,6 @@ private: int get_entry_(LogEntryType &entry, LSN &lsn, const char *&buf, int64_t &buf_size); void update_data_gen_max_lsn_(); void mark_source_error_(const int ret_code); - bool is_retry_ret_(const bool ret_code) const; private: bool inited_; diff --git a/src/logservice/restoreservice/ob_remote_log_iterator.ipp b/src/logservice/restoreservice/ob_remote_log_iterator.ipp index f416817a5d..dd6ffe73cb 100644 --- a/src/logservice/restoreservice/ob_remote_log_iterator.ipp +++ b/src/logservice/restoreservice/ob_remote_log_iterator.ipp @@ -334,10 +334,3 @@ void ObRemoteLogIterator::mark_source_error_(const int ret_code) source->mark_error(*ObCurTraceId::get_trace_id(), ret_code); } } - -template -bool ObRemoteLogIterator::is_retry_ret_(const bool ret_code) const -{ - return OB_ALLOCATE_MEMORY_FAILED == ret_code - || is_io_error(ret_code); -}