From 6f8e3be56291a020222d271685ce8eebf7367783 Mon Sep 17 00:00:00 2001 From: BinChenn Date: Tue, 17 Oct 2023 03:43:40 +0000 Subject: [PATCH] [CP] [opt] optimize the receive_batch_log interface by removing some useless logs --- src/logservice/palf/log_iterator_impl.h | 2 +- src/logservice/palf/palf_handle_impl.cpp | 20 +++++++++++++------- src/logservice/palf/palf_iterator.h | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/logservice/palf/log_iterator_impl.h b/src/logservice/palf/log_iterator_impl.h index 4eadf0e0f..f94899dc1 100644 --- a/src/logservice/palf/log_iterator_impl.h +++ b/src/logservice/palf/log_iterator_impl.h @@ -774,7 +774,7 @@ int LogIteratorImpl::verify_accum_checksum_(const LogGroupEntry &entry, PALF_LOG(WARN, "invalid data", K(ret), KPC(this), K(entry)); } else if (-1 == accumulate_checksum_) { new_accumulate_checksum = expected_verify_checksum; - PALF_LOG(INFO, "init accumulate_checksum to first LogGroupEntry", K(entry), KPC(this), + PALF_LOG(TRACE, "init accumulate_checksum to first LogGroupEntry", K(entry), KPC(this), K(new_accumulate_checksum)); } else if (OB_FAIL(LogChecksum::verify_accum_checksum( accumulate_checksum_, data_checksum, diff --git a/src/logservice/palf/palf_handle_impl.cpp b/src/logservice/palf/palf_handle_impl.cpp index d600d3b0d..255e20b06 100755 --- a/src/logservice/palf/palf_handle_impl.cpp +++ b/src/logservice/palf/palf_handle_impl.cpp @@ -3095,15 +3095,19 @@ int PalfHandleImpl::receive_batch_log(const common::ObAddr &server, int64_t curr_log_proposal_id = 0; const char *buf_each_round = NULL; int64_t buf_len_each_round = 0; - int64_t count = 0; + int64_t count = 0, success_count = 0; while (OB_SUCC(iterator.next())) { if (OB_FAIL(iterator.get_entry(buf_each_round, buf_len_each_round, curr_lsn_each_round, curr_log_proposal_id))) { PALF_LOG(ERROR, "get_entry failed", K(ret), KPC(this), K(iterator), KP(buf_each_round)); } else if (OB_FAIL(receive_log_(server, FETCH_LOG_RESP, msg_proposal_id, prev_lsn_each_round, prev_log_proposal_id_each_round, curr_lsn_each_round, buf_each_round, buf_len_each_round))) { - PALF_LOG(WARN, "receive_log failed", K(ret), KPC(this), K(iterator), K(server), K(FETCH_LOG_RESP), K(msg_proposal_id), - K(prev_lsn_each_round), K(prev_log_proposal_id_each_round), K(curr_lsn_each_round), KP(buf_each_round), - K(buf_len_each_round)); + if (REACH_TIME_INTERVAL(100 * 1000)) { + PALF_LOG(WARN, "receive_log failed", K(ret), KPC(this), K(iterator), K(server), K(FETCH_LOG_RESP), + K(msg_proposal_id), K(prev_lsn_each_round), K(prev_log_proposal_id_each_round), + K(curr_lsn_each_round), KP(buf_each_round), K(buf_len_each_round)); + } + } else { + success_count++; } prev_lsn_each_round = curr_lsn_each_round; prev_log_proposal_id_each_round = curr_log_proposal_id; @@ -3112,9 +3116,11 @@ int PalfHandleImpl::receive_batch_log(const common::ObAddr &server, if (OB_ITER_END == ret) { ret = OB_SUCCESS; } - int64_t cost_ts = ObTimeUtility::current_time() - start_ts; - PALF_LOG(TRACE, "receive_batch_log finished", K(ret), KPC(this), K(server), K(count), K(prev_lsn), K(curr_lsn), - K(buf_len), K(cost_ts), K_(sw), K(iterator)); + int64_t cost_us = ObTimeUtility::current_time() - start_ts; + if (cost_us > 200 * 1000) { + PALF_LOG(INFO, "receive_batch_log cost too much time", K(ret), KPC(this), K(server), K(count), + K(success_count), K(cost_us), K(prev_lsn), K(curr_lsn), K(buf_len), K_(sw), K(iterator)); + } } return ret; } diff --git a/src/logservice/palf/palf_iterator.h b/src/logservice/palf/palf_iterator.h index 96fbc16c0..06b485409 100644 --- a/src/logservice/palf/palf_iterator.h +++ b/src/logservice/palf/palf_iterator.h @@ -41,7 +41,7 @@ public: } else if (OB_FAIL(do_init_(start_offset, get_file_end_lsn, get_mode_version, log_storage))) { PALF_LOG(WARN, "PalfIterator init failed", K(ret)); } else { - PALF_LOG(INFO, "PalfIterator init success", K(ret), K(start_offset), KPC(this)); + PALF_LOG(TRACE, "PalfIterator init success", K(ret), K(start_offset), KPC(this)); is_inited_ = true; } return ret; @@ -264,7 +264,7 @@ private: } else if (OB_FAIL(iterator_impl_.init(get_mode_version, &iterator_storage_))) { PALF_LOG(WARN, "PalfIterator init failed", K(ret)); } else { - PALF_LOG(INFO, "PalfIterator init success", K(ret), K(start_offset), KPC(this)); + PALF_LOG(TRACE, "PalfIterator init success", K(ret), K(start_offset), KPC(this)); is_inited_ = true; } return ret;