From c7818f11572d78fb5e07b67d139a2688bd50aa12 Mon Sep 17 00:00:00 2001 From: xiaoxmeng Date: Wed, 11 Oct 2023 23:14:51 -0700 Subject: [PATCH] [native]Add non-reclaimable operator memory reclaim attempts --- .../presto_cpp/main/PeriodicTaskManager.cpp | 4 ++++ presto-native-execution/presto_cpp/main/common/Counters.cpp | 2 ++ presto-native-execution/presto_cpp/main/common/Counters.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp b/presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp index 889bbab7a65c4..af1938325a4a3 100644 --- a/presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp +++ b/presto-native-execution/presto_cpp/main/PeriodicTaskManager.cpp @@ -543,6 +543,10 @@ void PeriodicTaskManager::updateArbitratorStatsTask() { REPORT_IF_NOT_ZERO( kCounterArbitratorFreeCapacityBytes, deltaArbitratorStats.freeCapacityBytes); + REPORT_IF_NOT_ZERO( + kCounterArbitratorNonReclaimableAttempts, + deltaArbitratorStats.numNonReclaimableAttempts); + if (!deltaArbitratorStats.empty()) { LOG(INFO) << "Updated memory arbitrator stats: " << updatedArbitratorStats.toString(); diff --git a/presto-native-execution/presto_cpp/main/common/Counters.cpp b/presto-native-execution/presto_cpp/main/common/Counters.cpp index dd889332904fb..245b0331f693d 100644 --- a/presto-native-execution/presto_cpp/main/common/Counters.cpp +++ b/presto-native-execution/presto_cpp/main/common/Counters.cpp @@ -241,6 +241,8 @@ void registerPrestoCppCounters() { kCounterArbitratorNumReclaimedBytes, facebook::velox::StatType::SUM); REPORT_ADD_STAT_EXPORT_TYPE( kCounterArbitratorFreeCapacityBytes, facebook::velox::StatType::AVG); + REPORT_ADD_STAT_EXPORT_TYPE( + kCounterArbitratorNonReclaimableAttempts, facebook::velox::StatType::SUM); // NOTE: Metrics type exporting for file handle cache counters are in // PeriodicTaskManager because they have dynamic names. The following counters diff --git a/presto-native-execution/presto_cpp/main/common/Counters.h b/presto-native-execution/presto_cpp/main/common/Counters.h index e8840f43ae199..213af45655be4 100644 --- a/presto-native-execution/presto_cpp/main/common/Counters.h +++ b/presto-native-execution/presto_cpp/main/common/Counters.h @@ -162,6 +162,9 @@ constexpr folly::StringPiece kCounterArbitratorNumReclaimedBytes{ /// The free memory capacity in bytes. constexpr folly::StringPiece kCounterArbitratorFreeCapacityBytes{ "presto_cpp.arbitrator_free_capacity_bytes"}; +/// The number of non-reclaimable operator reclaim attempts. +constexpr folly::StringPiece kCounterArbitratorNonReclaimableAttempts{ + "presto_cpp.arbitrator_non_reclaimable_attempts"}; /// ================== Disk Spilling Counters =================