From 9b36886e828683048c75ee3ba53812eec35d7f4f Mon Sep 17 00:00:00 2001 From: ZenoWang Date: Tue, 27 Feb 2024 05:22:22 +0000 Subject: [PATCH] print throttled size in debug log --- src/share/allocator/ob_mds_allocator.cpp | 2 +- src/share/allocator/ob_shared_memory_allocator_mgr.h | 3 ++- src/share/allocator/ob_tx_data_allocator.cpp | 8 ++++++-- src/share/throttle/ob_share_throttle_define.cpp | 7 +++++-- src/share/throttle/ob_share_throttle_define.h | 3 ++- src/share/throttle/ob_throttle_unit.ipp | 3 ++- src/storage/ob_storage_table_guard.cpp | 10 +++++++--- 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/share/allocator/ob_mds_allocator.cpp b/src/share/allocator/ob_mds_allocator.cpp index 7f62fb5c93..e14ad08d41 100644 --- a/src/share/allocator/ob_mds_allocator.cpp +++ b/src/share/allocator/ob_mds_allocator.cpp @@ -190,7 +190,7 @@ ObMdsThrottleGuard::~ObMdsThrottleGuard() MDS_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "throttle tool is unexpected nullptr", KP(throttle_tool_)); } else if (throttle_tool_->is_throttling(share_ti_guard, module_ti_guard)) { (void)TxShareMemThrottleUtil::do_throttle( - for_replay_, abs_expire_time_, *throttle_tool_, share_ti_guard, module_ti_guard); + for_replay_, abs_expire_time_, share::mds_throttled_alloc(), *throttle_tool_, share_ti_guard, module_ti_guard); if (throttle_tool_->still_throttling(share_ti_guard, module_ti_guard)) { (void)throttle_tool_->skip_throttle( diff --git a/src/share/allocator/ob_shared_memory_allocator_mgr.h b/src/share/allocator/ob_shared_memory_allocator_mgr.h index b4d7d1d596..df57da87bd 100644 --- a/src/share/allocator/ob_shared_memory_allocator_mgr.h +++ b/src/share/allocator/ob_shared_memory_allocator_mgr.h @@ -87,6 +87,7 @@ public: template static int do_throttle(const bool for_replay, const int64_t abs_expire_time, + const int64_t throttle_memory_size, TxShareThrottleTool &throttle_tool, ObThrottleInfoGuard &share_ti_guard, ObThrottleInfoGuard &module_ti_guard) @@ -142,7 +143,7 @@ public: module_ti_guard, has_printed_lbt); } - PrintThrottleUtil::print_throttle_statistic(ret, ALLOCATOR::throttle_unit_name(), sleep_time); + PrintThrottleUtil::print_throttle_statistic(ret, ALLOCATOR::throttle_unit_name(), sleep_time, throttle_memory_size); if (for_replay && sleep_time > 0) { // avoid print replay_timeout diff --git a/src/share/allocator/ob_tx_data_allocator.cpp b/src/share/allocator/ob_tx_data_allocator.cpp index 45b401f009..a14c76f44d 100644 --- a/src/share/allocator/ob_tx_data_allocator.cpp +++ b/src/share/allocator/ob_tx_data_allocator.cpp @@ -126,8 +126,12 @@ ObTxDataThrottleGuard::~ObTxDataThrottleGuard() if (OB_ISNULL(throttle_tool_)) { MDS_LOG_RET(ERROR, OB_ERR_UNEXPECTED, "throttle tool is unexpected nullptr", KP(throttle_tool_)); } else if (throttle_tool_->is_throttling(share_ti_guard, module_ti_guard)) { - (void)TxShareMemThrottleUtil::do_throttle( - for_replay_, abs_expire_time_, *throttle_tool_, share_ti_guard, module_ti_guard); + (void)TxShareMemThrottleUtil::do_throttle(for_replay_, + abs_expire_time_, + share::tx_data_throttled_alloc(), + *throttle_tool_, + share_ti_guard, + module_ti_guard); if (throttle_tool_->still_throttling(share_ti_guard, module_ti_guard)) { (void)throttle_tool_->skip_throttle( diff --git a/src/share/throttle/ob_share_throttle_define.cpp b/src/share/throttle/ob_share_throttle_define.cpp index 9c4e80b1f8..9107a6ff8a 100644 --- a/src/share/throttle/ob_share_throttle_define.cpp +++ b/src/share/throttle/ob_share_throttle_define.cpp @@ -152,7 +152,8 @@ void PrintThrottleUtil::pirnt_throttle_info(const int err_code, void PrintThrottleUtil::print_throttle_statistic(const int err_code, const char *throttle_unit_name, - const int64_t sleep_time) + const int64_t sleep_time, + const int64_t throttle_memory_size) { int ret = err_code; const int64_t THROTTLE_LOG_INTERVAL = 1L * 1000L * 1000L; /*one seconds*/ @@ -162,7 +163,9 @@ void PrintThrottleUtil::print_throttle_statistic(const int err_code, "Throttle Unit Name", throttle_unit_name, "Throttle Sleep Time(us)", - sleep_time); + sleep_time, + "Throttle Memory Size", + throttle_memory_size); } } diff --git a/src/share/throttle/ob_share_throttle_define.h b/src/share/throttle/ob_share_throttle_define.h index 31b2421b40..c994521d01 100644 --- a/src/share/throttle/ob_share_throttle_define.h +++ b/src/share/throttle/ob_share_throttle_define.h @@ -94,7 +94,8 @@ public: static void print_throttle_statistic(const int err_code, const char *throttle_unit_name, - const int64_t sleep_time); + const int64_t sleep_time, + const int64_t throttle_memory_size = 0); }; } // namespace share diff --git a/src/share/throttle/ob_throttle_unit.ipp b/src/share/throttle/ob_throttle_unit.ipp index 902de64f80..1fd824c6b0 100644 --- a/src/share/throttle/ob_throttle_unit.ipp +++ b/src/share/throttle/ob_throttle_unit.ipp @@ -174,7 +174,8 @@ void ObThrottleUnit::print_throttle_info_(const int64_t holding_size, "Release Speed", release_speed, "Total Resource Limit", resource_limit_, "Config Specify Limit", config_specify_resource_limit_, - "Throttle Trigger Threshold", throttle_trigger); + "Throttle Trigger Threshold", throttle_trigger, + "Decay Factor", decay_factor_); } } diff --git a/src/storage/ob_storage_table_guard.cpp b/src/storage/ob_storage_table_guard.cpp index 158588f900..32491729f6 100644 --- a/src/storage/ob_storage_table_guard.cpp +++ b/src/storage/ob_storage_table_guard.cpp @@ -55,6 +55,7 @@ ObStorageTableGuard::~ObStorageTableGuard() { (void)throttle_if_needed_(); reset(); + share::memstore_throttled_alloc() = 0; } void ObStorageTableGuard::throttle_if_needed_() @@ -71,8 +72,12 @@ void ObStorageTableGuard::throttle_if_needed_() // only do throttle on active memtable if (OB_NOT_NULL(memtable_) && memtable_->is_active_memtable()) { reset(); - (void)TxShareMemThrottleUtil::do_throttle( - for_replay_, store_ctx_.timeout_, throttle_tool, share_ti_guard, module_ti_guard); + (void)TxShareMemThrottleUtil::do_throttle(for_replay_, + store_ctx_.timeout_, + share::memstore_throttled_alloc(), + throttle_tool, + share_ti_guard, + module_ti_guard); } // if throttle is skipped due to some reasons, advance clock by call skip_throttle() and clean throttle status @@ -190,7 +195,6 @@ void ObStorageTableGuard::reset() memtable_->dec_write_ref(); memtable_ = NULL; } - share::memstore_throttled_alloc() = 0; } void ObStorageTableGuard::double_check_inc_write_ref(