From c478c395058d4233005fecc24204a27f1e704163 Mon Sep 17 00:00:00 2001 From: qiuyg3 <101090778+qiuyg3@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:19:56 +0800 Subject: [PATCH] fix issue 1922 (#2011) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update ob_mvcc_row.h modify the note of function update_dml_flag_ * fix no obvious “secure_file_priv” prompt when load data error issue 981 fix no obvious “secure_file_priv” prompt when load data error issue 981 * fix no obvious “secure_file_priv” prompt when load data error issue 981 fix no obvious “secure_file_priv” prompt when load data error issue 981 * fix no obvious “secure_file_priv” prompt when load data error issue 981 fix no obvious “secure_file_priv” prompt when load data error issue 981 * Update ob_errno.h fix no obvious “secure_file_priv” prompt when load data error issue 981 * Update ob_errno.cpp fix no obvious “secure_file_priv” prompt when load data error issue 981 * Update ob_resolver_utils.cpp fix no obvious “secure_file_priv” prompt when load data error issue 981 * Update ob_log_config.h fix the issue 1786 * fix issue 1922 * fix issue 1922 0618 * fix issue 1922 * Revert "fix issue 1922" This reverts commit 0e620f18ea95dce22a3c15d454d8ceed09a78460. * Revert "Revert "fix issue 1922"" This reverts commit ee79221426d02a7d693adf75bd076a9876fbb5b8. * Revert "Revert "Revert "fix issue 1922""" This reverts commit 9fbed3d2e5dc8ab78b56e9f11a1492dc79d50f31. * Revert "Revert "Revert "Revert "fix issue 1922"""" This reverts commit 5905050d874f72a6a3aaf6d6003c1387fdc73bbd. * Revert "Revert "Revert "Revert "Revert "fix issue 1922""""" This reverts commit 2b83107ef3fa99395dbf21fd68c4508a46883b8c. * fix issue 1922 0625 --- .../logminer/ob_log_miner_logger.cpp | 34 +++++++++++++++++-- src/logservice/logminer/ob_log_miner_logger.h | 3 ++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/logservice/logminer/ob_log_miner_logger.cpp b/src/logservice/logminer/ob_log_miner_logger.cpp index cdb3361b38f..9e0624cb911 100644 --- a/src/logservice/logminer/ob_log_miner_logger.cpp +++ b/src/logservice/logminer/ob_log_miner_logger.cpp @@ -29,8 +29,15 @@ LogMinerLogger &LogMinerLogger::get_logminer_logger_instance() static LogMinerLogger logger_instance; return logger_instance; } + LogMinerLogger::LogMinerLogger(): - verbose_(false) { memset(pb_str_, '>', sizeof(pb_str_)); } + verbose_(false), + begin_ts_(0), + last_ts_(0), + last_record_num_(0) +{ + memset(pb_str_, '>', sizeof(pb_str_)); +} void LogMinerLogger::log_stdout(const char *format, ...) { @@ -79,8 +86,29 @@ int LogMinerLogger::log_progress(int64_t record_num, int64_t current_ts, int64_t nls_format, 0, time_buf, sizeof(time_buf), pos))) { LOG_WARN("datetime to string failed", K(current_ts), K(LOGMINER_TZ.get_tz_info())); } else { - fprintf(stdout, "\r%s %s %5.1lf%%, written records: %-20jd", time_buf, pb_buf, - progress, record_num); + int64_t current_time = ObTimeUtility::current_time(); + int64_t average_rps = 0; + int64_t current_rps = 0; + int64_t inc_record_num = 0; + if (begin_ts_ == 0) { + begin_ts_ = current_time; + } + if (last_ts_ == 0) { + last_ts_ = current_time; + } + if (current_time - begin_ts_ > 0) { + // calculated in seconds + average_rps = record_num * 1000 * 1000 / (current_time - begin_ts_); + } + if (current_time - last_ts_ > 0) { + inc_record_num = record_num - last_record_num_; + // calculated in seconds + current_rps = inc_record_num * 1000 * 1000 / (current_time - last_ts_); + last_ts_ = current_time; + last_record_num_ = record_num; + } + fprintf(stdout, "\r%s %s %5.1lf%%, written records: %5.1jd, current rps: %5.1jd, average rps: %5.1jd", + time_buf, pb_buf, progress, record_num, current_rps, average_rps); fflush(stdout); } return ret; diff --git a/src/logservice/logminer/ob_log_miner_logger.h b/src/logservice/logminer/ob_log_miner_logger.h index a28d69569dd..e83d24a6a9b 100644 --- a/src/logservice/logminer/ob_log_miner_logger.h +++ b/src/logservice/logminer/ob_log_miner_logger.h @@ -43,6 +43,9 @@ class LogMinerLogger { static const int MAX_SCREEN_WIDTH = 4096; bool verbose_; char pb_str_[MAX_SCREEN_WIDTH]; + int64_t begin_ts_; + int64_t last_ts_; + int64_t last_record_num_; }; }