kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject [2/4] kudu git commit: KUDU-1294 fix issue with unreleased consumption
Date Wed, 17 May 2017 00:10:21 GMT
KUDU-1294 fix issue with unreleased consumption

In DEBUG builds, the DCHECK assert on unreleased consumption fires
from time to time in the destructor of MemTracker objects.  The root
cause was found by Todd and described in the first comment on KUDU-1294.
This patch fixes the issue by re-ordering the sequence of removing the
transaction driver from the map and releasing its memory consumption.

As a test, I ran 1K+ iterations of security-faults-itest test built
in DEBUG configuration with --stress-cpu-threads=8.  Prior to this fix,
usually ~15 out of 1024 tests were failing due to the issue:
  http://dist-test.cloudera.org//job?job_id=aserbin.1494966417.6076
After the fix, there were not any failures in the whole 1K run:
  http://dist-test.cloudera.org//job?job_id=aserbin.1494963982.18117

Change-Id: I41d4fd4c0030af02ae5b1e83bd52833632ed6743
Reviewed-on: http://gerrit.cloudera.org:8080/6901
Reviewed-by: Adar Dembo <adar@cloudera.com>
Tested-by: Kudu Jenkins


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/edd9840b
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/edd9840b
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/edd9840b

Branch: refs/heads/master
Commit: edd9840b0252e59313495a99ec35d996b6808248
Parents: a4b71fa
Author: Alexey Serbin <aserbin@cloudera.com>
Authored: Tue May 16 12:46:41 2017 -0700
Committer: Alexey Serbin <aserbin@cloudera.com>
Committed: Tue May 16 23:04:21 2017 +0000

----------------------------------------------------------------------
 .../tablet/transactions/transaction_tracker.cc   | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/edd9840b/src/kudu/tablet/transactions/transaction_tracker.cc
----------------------------------------------------------------------
diff --git a/src/kudu/tablet/transactions/transaction_tracker.cc b/src/kudu/tablet/transactions/transaction_tracker.cc
index 3ac55a9..603092b 100644
--- a/src/kudu/tablet/transactions/transaction_tracker.cc
+++ b/src/kudu/tablet/transactions/transaction_tracker.cc
@@ -159,21 +159,16 @@ void TransactionTracker::DecrementCounters(const TransactionDriver&
driver) cons
 void TransactionTracker::Release(TransactionDriver* driver) {
   DecrementCounters(*driver);
 
-  State st;
-  {
-    // Remove the transaction from the map, retaining the state for use
-    // below.
-    std::lock_guard<simple_spinlock> l(lock_);
-    st = FindOrDie(pending_txns_, driver);
-    if (PREDICT_FALSE(pending_txns_.erase(driver) != 1)) {
-      LOG(FATAL) << "Could not remove pending transaction from map: "
-          << driver->ToStringUnlocked();
-    }
-  }
-
+  // Remove the transaction from the map updating memory consumption if needed.
+  std::lock_guard<simple_spinlock> l(lock_);
+  State st = FindOrDie(pending_txns_, driver);
   if (mem_tracker_) {
     mem_tracker_->Release(st.memory_footprint);
   }
+  if (PREDICT_FALSE(pending_txns_.erase(driver) != 1)) {
+    LOG(FATAL) << "Could not remove pending transaction from map: "
+        << driver->ToStringUnlocked();
+  }
 }
 
 void TransactionTracker::GetPendingTransactions(


Mime
View raw message