You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ar...@apache.org on 2018/01/26 12:44:34 UTC

[10/11] drill git commit: DRILL-6102: Fix ConcurrentModificationException in the BaseAllocator's print method

DRILL-6102: Fix ConcurrentModificationException in the BaseAllocator's print method

closes #1100


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

Branch: refs/heads/master
Commit: f42115263cefaa8eacc117696c77725ac7f3058b
Parents: 186536d
Author: Timothy Farkas <ti...@apache.org>
Authored: Mon Jan 22 12:02:43 2018 -0800
Committer: Arina Ielchiieva <ar...@gmail.com>
Committed: Fri Jan 26 13:42:51 2018 +0200

----------------------------------------------------------------------
 .../apache/drill/exec/memory/BaseAllocator.java | 28 +++++++++++---------
 1 file changed, 15 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/f4211526/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BaseAllocator.java
----------------------------------------------------------------------
diff --git a/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BaseAllocator.java b/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BaseAllocator.java
index 6662073..eb51dc3 100644
--- a/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BaseAllocator.java
+++ b/exec/memory/base/src/main/java/org/apache/drill/exec/memory/BaseAllocator.java
@@ -742,21 +742,23 @@ public abstract class BaseAllocator extends Accountant implements BufferAllocato
         .append('\n');
 
     if (DEBUG) {
-      indent(sb, level + 1).append(String.format("child allocators: %d\n", childAllocators.size()));
-      for (BaseAllocator child : childAllocators.keySet()) {
-        child.print(sb, level + 2, verbosity);
-      }
+      synchronized (DEBUG_LOCK) {
+        indent(sb, level + 1).append(String.format("child allocators: %d\n", childAllocators.size()));
+        for (BaseAllocator child : childAllocators.keySet()) {
+          child.print(sb, level + 2, verbosity);
+        }
 
-      indent(sb, level + 1).append(String.format("ledgers: %d\n", childLedgers.size()));
-      for (BufferLedger ledger : childLedgers.keySet()) {
-        ledger.print(sb, level + 2, verbosity);
-      }
+        indent(sb, level + 1).append(String.format("ledgers: %d\n", childLedgers.size()));
+        for (BufferLedger ledger : childLedgers.keySet()) {
+          ledger.print(sb, level + 2, verbosity);
+        }
 
-      final Set<Reservation> reservations = this.reservations.keySet();
-      indent(sb, level + 1).append(String.format("reservations: %d\n", reservations.size()));
-      for (final Reservation reservation : reservations) {
-        if (verbosity.includeHistoricalLog) {
-          reservation.historicalLog.buildHistory(sb, level + 3, true);
+        final Set<Reservation> reservations = this.reservations.keySet();
+        indent(sb, level + 1).append(String.format("reservations: %d\n", reservations.size()));
+        for (final Reservation reservation : reservations) {
+          if (verbosity.includeHistoricalLog) {
+            reservation.historicalLog.buildHistory(sb, level + 3, true);
+          }
         }
       }
     }