From 1bb857cd7ed8cc3465500c7d986e59f1ca00f3f5 Mon Sep 17 00:00:00 2001 From: obdev Date: Tue, 28 Mar 2023 02:11:53 +0000 Subject: [PATCH] Move ls_id reference usage in archive and restore --- src/logservice/archiveservice/ob_archive_fetcher.cpp | 10 +++++----- src/logservice/archiveservice/ob_archive_sender.cpp | 8 ++++---- src/logservice/archiveservice/ob_archive_task.h | 5 ++--- src/logservice/archiveservice/ob_ls_mgr.cpp | 2 +- src/logservice/archiveservice/ob_ls_task.cpp | 2 +- .../restoreservice/ob_remote_fetch_log_worker.cpp | 4 ++-- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/logservice/archiveservice/ob_archive_fetcher.cpp b/src/logservice/archiveservice/ob_archive_fetcher.cpp index d9866df4d..e7c7dc2c9 100644 --- a/src/logservice/archiveservice/ob_archive_fetcher.cpp +++ b/src/logservice/archiveservice/ob_archive_fetcher.cpp @@ -322,7 +322,7 @@ int ObArchiveFetcher::handle_single_task_() ARCHIVE_LOG(ERROR, "data is NULL", K(ret), K(data)); } else { ObArchiveLogFetchTask *task = static_cast(data); - ObLSID id = task->get_ls_id_copy(); + ObLSID id = task->get_ls_id(); ArchiveKey key = task->get_station().get_round(); // task will be submit to fetch_log_queue or re-submit to handle or free due to fatal error @@ -511,7 +511,7 @@ int ObArchiveFetcher::init_helper_(ObArchiveLogFetchTask &task, const LSN &commi { int ret = OB_SUCCESS; LSN start_offset; - const ObLSID &id = task.get_ls_id(); + const ObLSID id = task.get_ls_id(); const LSN &end_offset = task.get_end_offset(); const ObArchivePiece &cur_piece = task.get_piece(); const ObArchivePiece &next_piece = task.get_next_piece(); @@ -771,7 +771,7 @@ int ObArchiveFetcher::update_log_fetch_task_(ObArchiveLogFetchTask &fetch_task, int ObArchiveFetcher::submit_fetch_log_(ObArchiveLogFetchTask &task, bool &submitted) { int ret = OB_SUCCESS; - const ObLSID &id = task.get_ls_id(); + const ObLSID id = task.get_ls_id(); submitted = false; if (! task.has_fetch_log()) { @@ -779,10 +779,10 @@ int ObArchiveFetcher::submit_fetch_log_(ObArchiveLogFetchTask &task, bool &submi } else { GET_LS_TASK_CTX(ls_mgr_, id) { if (OB_FAIL(ls_archive_task->push_fetch_log(task))) { - ARCHIVE_LOG(WARN, "push fetch log failed", K(ret), K(task)); + ARCHIVE_LOG(WARN, "push fetch log failed", K(ret), K(id), K(task)); } else { submitted = true; - ARCHIVE_LOG(INFO, "push fetch log succ", KP(&task)); + ARCHIVE_LOG(INFO, "push fetch log succ", K(id), KP(&task)); } } } diff --git a/src/logservice/archiveservice/ob_archive_sender.cpp b/src/logservice/archiveservice/ob_archive_sender.cpp index af146c8a6..a70fd878a 100644 --- a/src/logservice/archiveservice/ob_archive_sender.cpp +++ b/src/logservice/archiveservice/ob_archive_sender.cpp @@ -217,14 +217,14 @@ int ObArchiveSender::modify_thread_count(const int64_t thread_count) int ObArchiveSender::submit_send_task_(ObArchiveSendTask *task) { int ret = OB_SUCCESS; - const ObLSID &id = task->get_ls_id(); + const ObLSID id = task->get_ls_id(); if (OB_ISNULL(ls_mgr_)) { ret = OB_ERR_UNEXPECTED; ARCHIVE_LOG(ERROR, "ls_mgr_ is NULL", K(ret), K(ls_mgr_)); } else { GET_LS_TASK_CTX(ls_mgr_, id) { if (OB_FAIL(ls_archive_task->push_send_task(*task, *this))) { - ARCHIVE_LOG(WARN, "push_send_task fail", K(ret), KPC(task)); + ARCHIVE_LOG(WARN, "push_send_task fail", K(ret), K(id), KPC(task)); } } } @@ -428,7 +428,7 @@ bool ObArchiveSender::in_normal_status_(const ArchiveKey &key) const void ObArchiveSender::handle(ObArchiveSendTask &task, TaskConsumeStatus &consume_status) { int ret = OB_SUCCESS; - const ObLSID &id = task.get_ls_id(); + const ObLSID id = task.get_ls_id(); const ArchiveWorkStation &station = task.get_station(); share::ObBackupDest backup_dest; if (OB_UNLIKELY(! task.is_valid())) { @@ -507,7 +507,7 @@ int ObArchiveSender::check_piece_continuous_(const ObArchiveSendTask &task, { int ret = OB_SUCCESS; ObLSArchivePersistInfo info; - const ObLSID &id = task.get_ls_id(); + const ObLSID id = task.get_ls_id(); const ObArchivePiece &piece = task.get_piece(); const ArchiveWorkStation &station = task.get_station(); if (! ls_task_tuple.get_piece().is_valid()) { diff --git a/src/logservice/archiveservice/ob_archive_task.h b/src/logservice/archiveservice/ob_archive_task.h index d115b8cf8..f01d7f1d4 100644 --- a/src/logservice/archiveservice/ob_archive_task.h +++ b/src/logservice/archiveservice/ob_archive_task.h @@ -71,8 +71,7 @@ public: const LSN &start_lsn, const LSN &end_lsn); uint64_t get_tenant_id() const { return tenant_id_; } - const ObLSID &get_ls_id() const { return id_; } - ObLSID get_ls_id_copy() { return id_; } + ObLSID get_ls_id() const { return id_; } const ArchiveWorkStation &get_station() { return station_; } const LSN &get_start_offset() const { return start_offset_; } const LSN &get_cur_offset() const { return cur_offset_; } @@ -163,7 +162,7 @@ public: const share::SCN &max_scn); bool is_valid() const; uint64_t get_tenant_id() const { return tenant_id_;} - const ObLSID &get_ls_id() const { return id_; } + ObLSID get_ls_id() const { return id_; } const ArchiveWorkStation &get_station() const { return station_; } const ObArchivePiece &get_piece() const { return piece_; } const LSN &get_start_lsn() const { return start_offset_; } diff --git a/src/logservice/archiveservice/ob_ls_mgr.cpp b/src/logservice/archiveservice/ob_ls_mgr.cpp index a30470508..7c4e9eca4 100644 --- a/src/logservice/archiveservice/ob_ls_mgr.cpp +++ b/src/logservice/archiveservice/ob_ls_mgr.cpp @@ -479,7 +479,7 @@ int ObArchiveLSMgr::add_task_(const ObLSID &id, int ObArchiveLSMgr::insert_or_update_ls_(const StartArchiveHelper &helper) { int ret = OB_SUCCESS; - const ObLSID &id = helper.get_ls_id(); + const ObLSID id = helper.get_ls_id(); if (OB_UNLIKELY(! helper.is_valid())) { ARCHIVE_LOG(WARN, "helper is not valid", KR(ret), K(helper)); diff --git a/src/logservice/archiveservice/ob_ls_task.cpp b/src/logservice/archiveservice/ob_ls_task.cpp index 0a125564d..87e0d0b4d 100644 --- a/src/logservice/archiveservice/ob_ls_task.cpp +++ b/src/logservice/archiveservice/ob_ls_task.cpp @@ -713,7 +713,7 @@ int ObLSArchiveTask::ArchiveDest::push_fetch_log(ObArchiveLogFetchTask &task) int ObLSArchiveTask::ArchiveDest::push_send_task(ObArchiveSendTask &task, ObArchiveWorker &worker) { int ret = OB_SUCCESS; - const ObLSID &id = task.get_ls_id(); + const ObLSID id = task.get_ls_id(); if (NULL == send_task_queue_) { if (OB_ISNULL(send_task_queue_ = allocator_->alloc_send_task_status(id))) { ret = OB_ALLOCATE_MEMORY_FAILED; diff --git a/src/logservice/restoreservice/ob_remote_fetch_log_worker.cpp b/src/logservice/restoreservice/ob_remote_fetch_log_worker.cpp index 516bb72cd..ee5f427ef 100644 --- a/src/logservice/restoreservice/ob_remote_fetch_log_worker.cpp +++ b/src/logservice/restoreservice/ob_remote_fetch_log_worker.cpp @@ -337,7 +337,7 @@ int ObRemoteFetchWorker::submit_entries_(ObFetchLogTask &task) const char *buf = NULL; int64_t size = 0; LSN lsn; - const ObLSID &id = task.id_; + const ObLSID id = task.id_; while (OB_SUCC(ret) && ! has_set_stop()) { bool quota_done = false; if (OB_FAIL(task.iter_.next(entry, lsn, buf, size))) { @@ -447,7 +447,7 @@ int ObRemoteFetchWorker::try_retire_(ObFetchLogTask *&task) int ObRemoteFetchWorker::push_submit_array_(ObFetchLogTask &task) { int ret = OB_SUCCESS; - const ObLSID &id = task.id_; + const ObLSID id = task.id_; DEBUG_SYNC(BEFORE_RESTORE_SERVICE_PUSH_FETCH_DATA); GET_RESTORE_HANDLER_CTX(id) { if (OB_FAIL(restore_handler->submit_sorted_task(task))) {