Remove unused MemTracker debug logging

The MemTracker code included debug logging support that is not used from
anywhere in the code.

Change-Id: I9871839938ff8f7a56ca0fa5f991cce9de6ada79
Reviewed-on: http://gerrit.cloudera.org:8080/4117
Reviewed-by: Marcel Kornacker <[email protected]>
Tested-by: Internal Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/480efc90
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/480efc90
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/480efc90

Branch: refs/heads/master
Commit: 480efc90834a50fdbf72f16adba80adc894626b6
Parents: 58cf558
Author: Tim Armstrong <[email protected]>
Authored: Wed Aug 24 14:27:38 2016 -0700
Committer: Internal Jenkins <[email protected]>
Committed: Thu Aug 25 02:56:27 2016 +0000

----------------------------------------------------------------------
 be/src/runtime/mem-tracker.cc | 14 --------------
 be/src/runtime/mem-tracker.h  | 17 -----------------
 2 files changed, 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/480efc90/be/src/runtime/mem-tracker.cc
----------------------------------------------------------------------
diff --git a/be/src/runtime/mem-tracker.cc b/be/src/runtime/mem-tracker.cc
index 463bd5e..e1251f3 100644
--- a/be/src/runtime/mem-tracker.cc
+++ b/be/src/runtime/mem-tracker.cc
@@ -58,8 +58,6 @@ MemTracker::MemTracker(int64_t byte_limit, int64_t 
rm_reserved_limit, const stri
     local_counter_(TUnit::BYTES),
     consumption_metric_(NULL),
     auto_unregister_(false),
-    enable_logging_(false),
-    log_stack_(false),
     log_usage_if_zero_(log_usage_if_zero),
     query_resource_mgr_(NULL),
     num_gcs_metric_(NULL),
@@ -81,8 +79,6 @@ MemTracker::MemTracker(
     local_counter_(TUnit::BYTES),
     consumption_metric_(NULL),
     auto_unregister_(false),
-    enable_logging_(false),
-    log_stack_(false),
     log_usage_if_zero_(true),
     query_resource_mgr_(NULL),
     num_gcs_metric_(NULL),
@@ -103,8 +99,6 @@ MemTracker::MemTracker(UIntGauge* consumption_metric,
     local_counter_(TUnit::BYTES),
     consumption_metric_(consumption_metric),
     auto_unregister_(false),
-    enable_logging_(false),
-    log_stack_(false),
     log_usage_if_zero_(true),
     query_resource_mgr_(NULL),
     num_gcs_metric_(NULL),
@@ -294,14 +288,6 @@ string MemTracker::LogUsage(const string& prefix, const 
list<MemTracker*>& track
   return join(usage_strings, "\n");
 }
 
-void MemTracker::LogUpdate(bool is_consume, int64_t bytes) const {
-  stringstream ss;
-  ss << this << " " << (is_consume ? "Consume: " : "Release: ") << bytes
-     << " Consumption: " << consumption() << " Limit: " << limit_;
-  if (log_stack_) ss << endl << GetStackTrace();
-  LOG(ERROR) << ss.str();
-}
-
 Status MemTracker::MemLimitExceeded(RuntimeState* state, const std::string& 
details,
     int64_t failed_allocation_size) {
   Status status = Status::MemLimitExceeded();

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/480efc90/be/src/runtime/mem-tracker.h
----------------------------------------------------------------------
diff --git a/be/src/runtime/mem-tracker.h b/be/src/runtime/mem-tracker.h
index 2c8d0a9..52119a2 100644
--- a/be/src/runtime/mem-tracker.h
+++ b/be/src/runtime/mem-tracker.h
@@ -126,7 +126,6 @@ class MemTracker {
       RefreshConsumptionFromMetric();
       return;
     }
-    if (UNLIKELY(enable_logging_)) LogUpdate(true, bytes);
     for (std::vector<MemTracker*>::iterator tracker = all_trackers_.begin();
          tracker != all_trackers_.end(); ++tracker) {
       (*tracker)->consumption_->Add(bytes);
@@ -143,7 +142,6 @@ class MemTracker {
   /// the limit recorded in one of its ancestors already happened.
   void ConsumeLocal(int64_t bytes, MemTracker* end_tracker) {
     DCHECK(consumption_metric_ == NULL) << "Should not be called on root.";
-    if (UNLIKELY(enable_logging_)) LogUpdate(bytes > 0, bytes);
     for (int i = 0; i < all_trackers_.size(); ++i) {
       if (all_trackers_[i] == end_tracker) return;
       DCHECK(!all_trackers_[i]->has_limit());
@@ -162,7 +160,6 @@ class MemTracker {
   bool TryConsume(int64_t bytes) {
     if (consumption_metric_ != NULL) RefreshConsumptionFromMetric();
     if (UNLIKELY(bytes <= 0)) return true;
-    if (UNLIKELY(enable_logging_)) LogUpdate(true, bytes);
     int i;
     // Walk the tracker tree top-down, to avoid expanding a limit on a child 
whose parent
     // won't accommodate the change.
@@ -231,7 +228,6 @@ class MemTracker {
       consumption_->Set(consumption_metric_->value());
       return;
     }
-    if (UNLIKELY(enable_logging_)) LogUpdate(false, bytes);
     for (std::vector<MemTracker*>::iterator tracker = all_trackers_.begin();
          tracker != all_trackers_.end(); ++tracker) {
       (*tracker)->consumption_->Add(-bytes);
@@ -337,11 +333,6 @@ class MemTracker {
   /// Logs the usage of this tracker and all of its children (recursively).
   std::string LogUsage(const std::string& prefix = "") const;
 
-  void EnableLogging(bool enable, bool log_stack) {
-    enable_logging_ = enable;
-    log_stack_ = log_stack;
-  }
-
   /// Log the memory usage when memory limit is exceeded and return a status 
object with
   /// details of the allocation which caused the limit to be exceeded.
   /// If 'failed_allocation_size' is greater than zero, logs the allocation 
size. If
@@ -377,9 +368,6 @@ class MemTracker {
   /// Adds tracker to child_trackers_
   void AddChildTracker(MemTracker* tracker);
 
-  /// Logs the stack of the current consume/release. Used for debugging only.
-  void LogUpdate(bool is_consume, int64_t bytes) const;
-
   static std::string LogUsage(const std::string& prefix,
       const std::list<MemTracker*>& trackers);
 
@@ -472,11 +460,6 @@ class MemTracker {
   /// to do cleanup another way.
   bool auto_unregister_;
 
-  /// If true, logs to INFO every consume/release called. Used for debugging.
-  bool enable_logging_;
-  /// If true, log the stack as well.
-  bool log_stack_;
-
   /// If false, this tracker (and its children) will not be included in 
LogUsage() output
   /// if consumption is 0.
   bool log_usage_if_zero_;

Reply via email to