From 7c67aee4a01bd5f9241bfdce52aefe06bc0c69a1 Mon Sep 17 00:00:00 2001 From: Ignat Loskutov Date: Fri, 9 Jun 2023 13:25:57 -0700 Subject: [PATCH] statistics.cc: fix mistype (#11509) Summary: Add new tickers: `rocksdb.error.handler.bg.error.count`, `rocksdb.error.handler.bg.io.error.count`, `rocksdb.error.handler.bg.retryable.io.error.count` to replace the misspelled ones: `rocksdb.error.handler.bg.errro.count`, `rocksdb.error.handler.bg.io.errro.count`, `rocksdb.error.handler.bg.retryable.io.errro.count` ('error' instead of 'errro'). Users should switch to use the new tickers before 9.0 release as the misspelled old tickers will be completely removed then. Pull Request resolved: https://github.com/facebook/rocksdb/pull/11509 Reviewed By: ltamasi Differential Revision: D46542809 Pulled By: jowlyzhang fbshipit-source-id: a2a6d8354af46a060de81d40ef6f5336a80bd32e --- db/error_handler.cc | 13 +++++++++++++ include/rocksdb/statistics.h | 7 ++++++- monitoring/statistics.cc | 8 +++++++- .../public_api_changes/fix_tickers_typo.md | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 unreleased_history/public_api_changes/fix_tickers_typo.md diff --git a/db/error_handler.cc b/db/error_handler.cc index 98c3e82d5..55821952d 100644 --- a/db/error_handler.cc +++ b/db/error_handler.cc @@ -279,6 +279,7 @@ const Status& ErrorHandler::HandleKnownErrors(const Status& bg_err, if (bg_error_stats_ != nullptr) { RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_ERROR_COUNT); + RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_ERROR_COUNT_MISSPELLED); } ROCKS_LOG_INFO(db_options_.info_log, "ErrorHandler: Set regular background error\n"); @@ -416,7 +417,11 @@ const Status& ErrorHandler::SetBGError(const Status& bg_status, CheckAndSetRecoveryAndBGError(bg_err); if (bg_error_stats_ != nullptr) { RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_ERROR_COUNT); + RecordTick(bg_error_stats_.get(), + ERROR_HANDLER_BG_ERROR_COUNT_MISSPELLED); RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_IO_ERROR_COUNT); + RecordTick(bg_error_stats_.get(), + ERROR_HANDLER_BG_IO_ERROR_COUNT_MISSPELLED); } ROCKS_LOG_INFO( db_options_.info_log, @@ -443,9 +448,15 @@ const Status& ErrorHandler::SetBGError(const Status& bg_status, &auto_recovery); if (bg_error_stats_ != nullptr) { RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_ERROR_COUNT); + RecordTick(bg_error_stats_.get(), + ERROR_HANDLER_BG_ERROR_COUNT_MISSPELLED); RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_IO_ERROR_COUNT); + RecordTick(bg_error_stats_.get(), + ERROR_HANDLER_BG_IO_ERROR_COUNT_MISSPELLED); RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_RETRYABLE_IO_ERROR_COUNT); + RecordTick(bg_error_stats_.get(), + ERROR_HANDLER_BG_RETRYABLE_IO_ERROR_COUNT_MISSPELLED); } ROCKS_LOG_INFO(db_options_.info_log, "ErrorHandler: Set background retryable IO error\n"); @@ -486,6 +497,8 @@ const Status& ErrorHandler::SetBGError(const Status& bg_status, } else { if (bg_error_stats_ != nullptr) { RecordTick(bg_error_stats_.get(), ERROR_HANDLER_BG_IO_ERROR_COUNT); + RecordTick(bg_error_stats_.get(), + ERROR_HANDLER_BG_IO_ERROR_COUNT_MISSPELLED); } // HandleKnownErrors() will use recovery_error_, so ignore // recovery_io_error_. diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index cfeaa5a53..68c9935e5 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -357,10 +357,15 @@ enum Tickers : uint32_t { FILES_DELETED_IMMEDIATELY, // The counters for error handler, not that, bg_io_error is the subset of - // bg_error and bg_retryable_io_error is the subset of bg_io_error + // bg_error and bg_retryable_io_error is the subset of bg_io_error. + // The misspelled versions are deprecated and only kept for compatibility. + // TODO: remove the misspelled tickers in the next major release. ERROR_HANDLER_BG_ERROR_COUNT, + ERROR_HANDLER_BG_ERROR_COUNT_MISSPELLED, ERROR_HANDLER_BG_IO_ERROR_COUNT, + ERROR_HANDLER_BG_IO_ERROR_COUNT_MISSPELLED, ERROR_HANDLER_BG_RETRYABLE_IO_ERROR_COUNT, + ERROR_HANDLER_BG_RETRYABLE_IO_ERROR_COUNT_MISSPELLED, ERROR_HANDLER_AUTORESUME_COUNT, ERROR_HANDLER_AUTORESUME_RETRY_TOTAL_COUNT, ERROR_HANDLER_AUTORESUME_SUCCESS_COUNT, diff --git a/monitoring/statistics.cc b/monitoring/statistics.cc index 0e9c2250f..56abd8dba 100644 --- a/monitoring/statistics.cc +++ b/monitoring/statistics.cc @@ -176,10 +176,16 @@ const std::vector> TickersNameMap = { "rocksdb.block.cache.compression.dict.add.redundant"}, {FILES_MARKED_TRASH, "rocksdb.files.marked.trash"}, {FILES_DELETED_IMMEDIATELY, "rocksdb.files.deleted.immediately"}, - {ERROR_HANDLER_BG_ERROR_COUNT, "rocksdb.error.handler.bg.errro.count"}, + {ERROR_HANDLER_BG_ERROR_COUNT, "rocksdb.error.handler.bg.error.count"}, + {ERROR_HANDLER_BG_ERROR_COUNT_MISSPELLED, + "rocksdb.error.handler.bg.errro.count"}, {ERROR_HANDLER_BG_IO_ERROR_COUNT, + "rocksdb.error.handler.bg.io.error.count"}, + {ERROR_HANDLER_BG_IO_ERROR_COUNT_MISSPELLED, "rocksdb.error.handler.bg.io.errro.count"}, {ERROR_HANDLER_BG_RETRYABLE_IO_ERROR_COUNT, + "rocksdb.error.handler.bg.retryable.io.error.count"}, + {ERROR_HANDLER_BG_RETRYABLE_IO_ERROR_COUNT_MISSPELLED, "rocksdb.error.handler.bg.retryable.io.errro.count"}, {ERROR_HANDLER_AUTORESUME_COUNT, "rocksdb.error.handler.autoresume.count"}, {ERROR_HANDLER_AUTORESUME_RETRY_TOTAL_COUNT, diff --git a/unreleased_history/public_api_changes/fix_tickers_typo.md b/unreleased_history/public_api_changes/fix_tickers_typo.md new file mode 100644 index 000000000..eb789d5fc --- /dev/null +++ b/unreleased_history/public_api_changes/fix_tickers_typo.md @@ -0,0 +1 @@ +Add new tickers: `rocksdb.error.handler.bg.error.count`, `rocksdb.error.handler.bg.io.error.count`, `rocksdb.error.handler.bg.retryable.io.error.count` to replace the misspelled ones: `rocksdb.error.handler.bg.errro.count`, `rocksdb.error.handler.bg.io.errro.count`, `rocksdb.error.handler.bg.retryable.io.errro.count` ('error' instead of 'errro'). Users should switch to use the new tickers before 9.0 release as the misspelled old tickers will be completely removed then.