This is an automated email from the ASF dual-hosted git repository.

joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git


The following commit(s) were added to refs/heads/master by this push:
     new 0bbd2b684 IMPALA-13628: Use impala::Thread in PeriodicCounterUpdater
0bbd2b684 is described below

commit 0bbd2b684ddc7dcf8b6c16f1f7c6fab15291f782
Author: Riza Suminto <[email protected]>
AuthorDate: Thu Dec 19 10:50:44 2024 -0800

    IMPALA-13628: Use impala::Thread in PeriodicCounterUpdater
    
    This patch change the thread in PeriodicCounterUpdater from
    boost::thread to impala:Thread. Using impala::Thread and
    impala::Thread::Create will make both instance_>update_thread_ and
    system_instance_>update_thread_ observable through '/threadz' page in
    WebUI.
    
    Replaced all boost include with std in periodic-counter-updater.h.
    
    Testing:
    - Run test_tpcds_queries.py and confirm the is no abnormality observed.
    - Confirm that both 'periodic-counter-updater' and
      'periodic-system-counter-updater' shows up in '/threadz' page.
    
    Change-Id: I0b04fe7818726832c520425ee29c9732cc100cb2
    Reviewed-on: http://gerrit.cloudera.org:8080/22246
    Reviewed-by: Impala Public Jenkins <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 be/src/util/periodic-counter-updater.cc | 12 ++++++------
 be/src/util/periodic-counter-updater.h  | 18 ++++++++----------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/be/src/util/periodic-counter-updater.cc 
b/be/src/util/periodic-counter-updater.cc
index d776ebd0c..49472b9ad 100644
--- a/be/src/util/periodic-counter-updater.cc
+++ b/be/src/util/periodic-counter-updater.cc
@@ -47,16 +47,16 @@ void PeriodicCounterUpdater::Init() {
   // Create two singletons, which will live until the process terminates.
   instance_ = new 
PeriodicCounterUpdater(FLAGS_periodic_counter_update_period_ms);
 
-  instance_->update_thread_.reset(
-      new thread(boost::bind(&PeriodicCounterUpdater::UpdateLoop, instance_, 
instance_)));
+  ABORT_IF_ERROR(Thread::Create("common", "periodic-counter-updater",
+      &PeriodicCounterUpdater::UpdateLoop, instance_, instance_,
+      &instance_->update_thread_));
 
   system_instance_ =
       new 
PeriodicCounterUpdater(FLAGS_periodic_system_counter_update_period_ms);
 
-  system_instance_->update_thread_.reset(
-      new thread(boost::bind(&PeriodicCounterUpdater::UpdateLoop, 
system_instance_,
-          system_instance_)));
-
+  ABORT_IF_ERROR(Thread::Create("common", "periodic-system-counter-updater",
+      &PeriodicCounterUpdater::UpdateLoop, system_instance_, system_instance_,
+      &system_instance_->update_thread_));
 }
 
 void PeriodicCounterUpdater::RegisterUpdateFunction(UpdateFn update_fn, bool 
is_system) {
diff --git a/be/src/util/periodic-counter-updater.h 
b/be/src/util/periodic-counter-updater.h
index 6b3ef0eaf..311d8c5a9 100644
--- a/be/src/util/periodic-counter-updater.h
+++ b/be/src/util/periodic-counter-updater.h
@@ -18,13 +18,11 @@
 #pragma once
 
 #include <mutex>
-#include <boost/function.hpp>
-#include <boost/scoped_ptr.hpp>
-#include <boost/thread/thread.hpp>
-#include <boost/unordered_map.hpp>
-#include <boost/unordered_set.hpp>
+#include <unordered_map>
+#include <unordered_set>
 
 #include "util/runtime-profile.h"
+#include "util/thread.h"
 
 namespace impala {
 
@@ -116,7 +114,7 @@ class PeriodicCounterUpdater {
   [[noreturn]] void UpdateLoop(PeriodicCounterUpdater* instance);
 
   /// Thread performing asynchronous updates.
-  boost::scoped_ptr<boost::thread> update_thread_;
+  std::unique_ptr<impala::Thread> update_thread_;
 
   /// List of functions that will be called before individual counters will be 
sampled.
   std::vector<UpdateFn> update_fns_;
@@ -128,7 +126,7 @@ class PeriodicCounterUpdater {
   SpinLock rate_lock_;
 
   /// A map of the dst (rate) counter to the src counter and elapsed time.
-  typedef boost::unordered_map<RuntimeProfile::Counter*, RateCounterInfo> 
RateCounterMap;
+  typedef std::unordered_map<RuntimeProfile::Counter*, RateCounterInfo> 
RateCounterMap;
   RateCounterMap rate_counters_;
 
   /// Spinlock that protects the map of averages over samples of counters
@@ -136,7 +134,7 @@ class PeriodicCounterUpdater {
 
   /// A map of the dst (averages over samples) counter to the src counter (to 
be sampled)
   /// and number of samples taken.
-  typedef boost::unordered_map<RuntimeProfile::Counter*, SamplingCounterInfo>
+  typedef std::unordered_map<RuntimeProfile::Counter*, SamplingCounterInfo>
       SamplingCounterMap;
   SamplingCounterMap sampling_counters_;
 
@@ -144,7 +142,7 @@ class PeriodicCounterUpdater {
   SpinLock bucketing_lock_;
 
   /// Map from a bucket of counters to the src counter
-  typedef boost::unordered_map<std::vector<RuntimeProfile::Counter*>*, 
BucketCountersInfo>
+  typedef std::unordered_map<std::vector<RuntimeProfile::Counter*>*, 
BucketCountersInfo>
       BucketCountersMap;
   BucketCountersMap bucketing_counters_;
 
@@ -152,7 +150,7 @@ class PeriodicCounterUpdater {
   SpinLock time_series_lock_;
 
   /// Set of time series counters that need to be updated
-  typedef boost::unordered_set<RuntimeProfile::TimeSeriesCounter*> 
TimeSeriesCounters;
+  typedef std::unordered_set<RuntimeProfile::TimeSeriesCounter*> 
TimeSeriesCounters;
   TimeSeriesCounters time_series_counters_;
 
   /// Singleton object that keeps track of all profile rate counters and the 
thread

Reply via email to