You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2019/02/22 13:07:25 UTC

[tinkerpop] branch TINKERPOP-1992 updated: TINKERPOP-1992 Prevented reset of barrier from happening more than once

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

spmallette pushed a commit to branch TINKERPOP-1992
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/TINKERPOP-1992 by this push:
     new d9d26e7  TINKERPOP-1992 Prevented reset of barrier from happening more than once
d9d26e7 is described below

commit d9d26e73cb890e7e014b5eaa2d5bce7a2e72aebe
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Fri Feb 22 08:06:55 2019 -0500

    TINKERPOP-1992 Prevented reset of barrier from happening more than once
---
 .../process/traversal/step/map/GroupStep.java      |  7 ++++++-
 .../step/sideEffect/GroupSideEffectStep.java       |  7 ++++++-
 .../process/traversal/step/util/ProfileStep.java   | 24 ++++++++++++++--------
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java
index 405951e..1ba364c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroupStep.java
@@ -126,7 +126,12 @@ public final class GroupStep<S, K, V> extends ReducingBarrierStep<S, Map<K, V>>
 
         // reset the barrierStep as there are now ProfileStep instances present and the timers won't start right
         // without specific configuration through wrapping both the Barrier and ProfileStep in ProfiledBarrier
-        if (resetBarrierForProfiling) barrierStep = determineBarrierStep(valueTraversal);
+        if (resetBarrierForProfiling) {
+            barrierStep = determineBarrierStep(valueTraversal);
+
+            // the barrier only needs to be reset once
+            resetBarrierForProfiling = false;
+        }
 
         if (null == this.barrierStep) {
             if (this.valueTraversal.hasNext())
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupSideEffectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupSideEffectStep.java
index a5a9b4c..fd31bc3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupSideEffectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GroupSideEffectStep.java
@@ -100,7 +100,12 @@ public final class GroupSideEffectStep<S, K, V> extends SideEffectStep<S> implem
 
         // reset the barrierStep as there are now ProfileStep instances present and the timers won't start right
         // without specific configuration through wrapping both the Barrier and ProfileStep in ProfiledBarrier
-        if (resetBarrierForProfiling) barrierStep = GroupStep.determineBarrierStep(valueTraversal);
+        if (resetBarrierForProfiling) {
+            barrierStep = GroupStep.determineBarrierStep(valueTraversal);
+
+            // the barrier only needs to be reset once
+            resetBarrierForProfiling = false;
+        }
 
         if (null == this.barrierStep) {
             if (this.valueTraversal.hasNext())
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ProfileStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ProfileStep.java
index 66cf10a..cd9c72b 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ProfileStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ProfileStep.java
@@ -46,15 +46,6 @@ public final class ProfileStep<S> extends AbstractStep<S, S> implements MemoryCo
         return metrics;
     }
 
-    public void start() {
-        this.initializeIfNeeded();
-        this.metrics.start();
-    }
-
-    public void stop() {
-        this.metrics.stop();
-    }
-
     @Override
     public Traverser.Admin<S> next() {
         Traverser.Admin<S> start = null;
@@ -119,6 +110,21 @@ public final class ProfileStep<S> extends AbstractStep<S, S> implements MemoryCo
         return clone;
     }
 
+    /**
+     * Starts the metrics timer.
+     */
+    public void start() {
+        this.initializeIfNeeded();
+        this.metrics.start();
+    }
+
+    /**
+     * Stops the metrics timer.
+     */
+    public void stop() {
+        this.metrics.stop();
+    }
+
     /////
 
     public static class ProfileBiOperator implements BinaryOperator<MutableMetrics>, Serializable {