drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vita...@apache.org
Subject [3/5] drill git commit: DRILL-6275: Fixed direct memory reporting in sys.memory.
Date Tue, 20 Mar 2018 20:58:08 GMT
DRILL-6275: Fixed direct memory reporting in sys.memory.

closes #1176


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

Branch: refs/heads/master
Commit: cdc21ce72416f6b426ce7cab7614766af37dca2f
Parents: edc982a
Author: Timothy Farkas <timothyfarkas@apache.org>
Authored: Mon Mar 19 13:16:37 2018 -0700
Committer: Vitalii Diravka <vitalii.diravka@gmail.com>
Committed: Tue Mar 20 22:38:16 2018 +0200

----------------------------------------------------------------------
 .../org/apache/drill/exec/ops/ExecutorFragmentContext.java     | 6 ++++++
 .../java/org/apache/drill/exec/ops/FragmentContextImpl.java    | 5 +++++
 .../java/org/apache/drill/exec/store/sys/MemoryIterator.java   | 4 ++--
 .../drill/exec/physical/unit/PhysicalOpUnitTestBase.java       | 6 ++++++
 4 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/cdc21ce7/exec/java-exec/src/main/java/org/apache/drill/exec/ops/ExecutorFragmentContext.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/ExecutorFragmentContext.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/ExecutorFragmentContext.java
index 82bb886..8031a15 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/ExecutorFragmentContext.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/ExecutorFragmentContext.java
@@ -18,6 +18,7 @@
 package org.apache.drill.exec.ops;
 
 import org.apache.drill.exec.coord.ClusterCoordinator;
+import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.physical.impl.OperatorCreatorRegistry;
 import org.apache.drill.exec.planner.PhysicalPlanReader;
 import org.apache.drill.exec.proto.CoordinationProtos;
@@ -31,6 +32,11 @@ import java.util.Map;
 import java.util.Set;
 
 public interface ExecutorFragmentContext extends RootFragmentContext {
+  /**
+   * Returns the root allocator for the Drillbit.
+   * @return The root allocator for the Drillbit.
+   */
+  BufferAllocator getRootAllocator();
 
   PhysicalPlanReader getPlanReader();
 

http://git-wip-us.apache.org/repos/asf/drill/blob/cdc21ce7/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContextImpl.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContextImpl.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContextImpl.java
index b3c84bc..c9b2070 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContextImpl.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/ops/FragmentContextImpl.java
@@ -336,6 +336,11 @@ public class FragmentContextImpl extends BaseFragmentContext implements
Executor
   }
 
   @Override
+  public BufferAllocator getRootAllocator() {
+    return context.getAllocator();
+  }
+
+  @Override
   public BufferAllocator getNewChildAllocator(final String operatorName,
       final int operatorId,
       final long initialReservation,

http://git-wip-us.apache.org/repos/asf/drill/blob/cdc21ce7/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/MemoryIterator.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/MemoryIterator.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/MemoryIterator.java
index 8d437a6..1140685 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/MemoryIterator.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/store/sys/MemoryIterator.java
@@ -61,8 +61,8 @@ public class MemoryIterator implements Iterator<Object> {
     BufferPoolMXBean directBean = getDirectBean();
     memoryInfo.jvm_direct_current = directBean.getMemoryUsed();
 
-
-    memoryInfo.direct_current = context.getAllocator().getAllocatedMemory();
+    // We need the memory used by the root allocator for the Drillbit
+    memoryInfo.direct_current = context.getRootAllocator().getAllocatedMemory();
     memoryInfo.direct_max = DrillConfig.getMaxDirectMemory();
     return memoryInfo;
   }

http://git-wip-us.apache.org/repos/asf/drill/blob/cdc21ce7/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/PhysicalOpUnitTestBase.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/PhysicalOpUnitTestBase.java
b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/PhysicalOpUnitTestBase.java
index b5dbcf8..93a7e54 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/PhysicalOpUnitTestBase.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/physical/unit/PhysicalOpUnitTestBase.java
@@ -26,6 +26,7 @@ import org.antlr.runtime.CommonTokenStream;
 import org.antlr.runtime.RecognitionException;
 import org.apache.calcite.rel.RelFieldCollation;
 import org.apache.drill.exec.coord.ClusterCoordinator;
+import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.ops.AccountingDataTunnel;
 import org.apache.drill.exec.ops.AccountingUserConnection;
 import org.apache.drill.exec.ops.ExecutorFragmentContext;
@@ -345,6 +346,11 @@ public class PhysicalOpUnitTestBase extends ExecTest {
     }
 
     @Override
+    public BufferAllocator getRootAllocator() {
+      return null;
+    }
+
+    @Override
     public PhysicalPlanReader getPlanReader() {
       throw new UnsupportedOperationException();
     }


Mime
View raw message