Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1642 249a5d36e -> 31551ec0f
TINKERPOP-1642 Made Mutating steps implement Scoping.
This simplified PathUtil.getReferencedLabels() and reduced iterations over
Parameter traversals.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/31551ec0
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/31551ec0
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/31551ec0
Branch: refs/heads/TINKERPOP-1642
Commit: 31551ec0f3ca8b52e403c8c5a75d754f6a52cbae
Parents: 249a5d3
Author: Stephen Mallette
Authored: Fri Mar 10 15:11:52 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 15:11:52 2017 -0500
--
CHANGELOG.asciidoc | 1 +
.../process/traversal/Parameterizing.java | 8 +
.../gremlin/process/traversal/step/Scoping.java | 14 +---
.../process/traversal/step/map/AddEdgeStep.java | 10 +-
.../traversal/step/map/AddVertexStartStep.java | 9 -
.../traversal/step/map/AddVertexStep.java | 9 -
.../step/sideEffect/AddPropertyStep.java| 9 -
.../process/traversal/step/util/Parameters.java | 37 +---
.../process/traversal/util/PathUtil.java| 17 +
9 files changed, 84 insertions(+), 30 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31551ec0/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 4f7f0c7..3f2db36 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~
+* `Mutating` steps now implement `Scoping` interface.
* `LABELED_PATH` requirement is now set if any step in the traversal is
labeled.
* Split `ComputerVerificationStrategy` into two strategies:
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
* Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as
it makes too many assumptions about provider compilation.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31551ec0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
--
diff --git
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
index 8af80b3..9b7e088 100644
---
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
+++
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
@@ -21,9 +21,17 @@ package org.apache.tinkerpop.gremlin.process.traversal;
import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
/**
+ * An interface for {@link Step} implementations that hold a {@link
Parameters} object, which fold in arguments from
+ * other steps. It is typically used on mutating steps, such as {@code
addV()}, where calls to {@code property(k,v)}
+ * are folded in as parameters to that add vertex step.
+ *
* @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
*/
public interface Parameterizing {
+/**
+ * Gets the parameters on the step.
+ */
public Parameters getParameters();
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31551ec0/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
--
diff --git
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
index 22109bf..683e661 100644
---
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
+++
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
@@ -20,23 +20,27 @@ package org.apache.tinkerpop.gremlin.process.traversal.step;
import org.apache.tinkerpop.gremlin.process.traversal.Path;
import org.apache.tinkerpop.gremlin.process.traversal.Pop;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import
org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
-import java.util.EnumSet;
import java.util.Map;
import
Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1642 103d7f9df -> 249a5d36e
TINKERPOP-1642 Minor refactoring to get rid of duplicate code
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/249a5d36
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/249a5d36
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/249a5d36
Branch: refs/heads/TINKERPOP-1642
Commit: 249a5d36ea2e29f26c6495e1130b2f0661133985
Parents: 103d7f9
Author: Stephen Mallette
Authored: Fri Mar 10 13:27:01 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 13:27:01 2017 -0500
--
.../process/traversal/util/TraversalHelper.java | 19 ++-
1 file changed, 10 insertions(+), 9 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/249a5d36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
--
diff --git
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index 5163824..95862d0 100644
---
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -417,7 +417,7 @@ public final class TraversalHelper {
* Determine if any step in {@link Traversal} or its children match the
step given the provided {@link Predicate}.
*
* @param predicate the match function
- * @param traversal th traversal to perform the action on
+ * @param traversal the traversal to perform the action on
* @return {@code true} if there is a match and {@code false} otherwise
*/
public static boolean anyStepRecursively(final Predicate predicate,
final Traversal.Admin traversal) {
@@ -425,18 +425,19 @@ public final class TraversalHelper {
if (predicate.test(step)) {
return true;
}
-if (step instanceof TraversalParent) {
-for (final Traversal.Admin localChild :
((TraversalParent) step).getLocalChildren()) {
-if (anyStepRecursively(predicate, localChild)) return true;
-}
-for (final Traversal.Admin globalChild :
((TraversalParent) step).getGlobalChildren()) {
-if (anyStepRecursively(predicate, globalChild)) return
true;
-}
-}
+
+if (step instanceof TraversalParent) anyStepRecursively(predicate,
((TraversalParent) step));
}
return false;
}
+/**
+ * Determine if any child step of a {@link TraversalParent} match the step
given the provided {@link Predicate}.
+ *
+ * @param predicate the match function
+ * @param step the step to perform the action on
+ * @return {@code true} if there is a match and {@code false} otherwise
+ */
public static boolean anyStepRecursively(final Predicate predicate,
final TraversalParent step) {
for (final Traversal.Admin localChild : step.getLocalChildren())
{
if (anyStepRecursively(predicate, localChild)) return true;
Repository: tinkerpop
Updated Branches:
refs/heads/TINKERPOP-1642 d13210f53 -> 103d7f9df
TINKERPOP-1642 Removed some extra iteration in Parameters.getTraversals()
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/103d7f9d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/103d7f9d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/103d7f9d
Branch: refs/heads/TINKERPOP-1642
Commit: 103d7f9df47e55c1a6d3e9d347ffdefc704fde39
Parents: d13210f
Author: Stephen Mallette
Authored: Fri Mar 10 12:31:38 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 12:31:38 2017 -0500
--
.../gremlin/process/traversal/step/util/Parameters.java | 8 ++--
1 file changed, 2 insertions(+), 6 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/103d7f9d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
--
diff --git
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 6640e87..93cf1f8 100644
---
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -54,7 +54,7 @@ public final class Parameters implements Cloneable,
Serializable {
* {@link #set(Object...)} because when the parameter map is large the
cost of iterating it repeatedly on the
* high number of calls to {@link #getTraversals()} and {@link
#integrateTraversals(TraversalParent)} is great.
*/
-private List traversals = new ArrayList<>();
+private List traversals = new ArrayList<>();
/**
* Checks for existence of key in parameter set.
@@ -203,11 +203,7 @@ public final class Parameters implements Cloneable,
Serializable {
*/
public List> getTraversals() {
// stupid generics - just need to return "traversals"
-final List> result = new ArrayList<>();
-for (Traversal.Admin t : traversals) {
-result.add(t);
-}
-return result;
+return (List>) (Object) traversals;
}
public Parameters clone() {
TINKERPOP-1644 Updated changelog
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b29ba121
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b29ba121
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b29ba121
Branch: refs/heads/TINKERPOP-1644
Commit: b29ba12109e7e88bc3465d08f6177e5ded17ca59
Parents: 4bdeac4
Author: Stephen Mallette
Authored: Wed Mar 8 16:15:27 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 11:12:36 2017 -0500
--
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b29ba121/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 24e5e9c..9c3313e 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~
+* Moved the `caffeine` dependency down to `gremlin-groovy` and out of
`gremlin-server`.
* Script compilation is synchronised.
* Script compilation times are placed in to logs.
* Failed scripts will not be recompiled.
TINKERPOP-1644 Provided configuration options for GremlinGroovyScriptEngine
Introduced new customizers to pass in configuration options to the
GremlinGroovyScriptEngine.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/4bdeac4b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/4bdeac4b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/4bdeac4b
Branch: refs/heads/TINKERPOP-1644
Commit: 4bdeac4b796b38fb14d1be763e03cc837b57d3d7
Parents: de1d58a
Author: Stephen Mallette
Authored: Wed Mar 8 16:13:06 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 11:12:36 2017 -0500
--
.../jsr223/CompilationOptionsCustomizer.java| 39 ++
.../jsr223/GremlinGroovyScriptEngine.java | 36 +++--
.../jsr223/GroovyCompilerGremlinPlugin.java | 13
.../CompilationOptionsCustomizerProvider.java | 48
...roovyScriptEngineCompilationOptionsTest.java | 80
.../jsr223/GroovyCompilerGremlinPluginTest.java | 24 --
6 files changed, 225 insertions(+), 15 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4bdeac4b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
--
diff --git
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
new file mode 100644
index 000..2a22eb3
--- /dev/null
+++
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/CompilationOptionsCustomizer.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.groovy.jsr223;
+
+import org.apache.tinkerpop.gremlin.jsr223.Customizer;
+
+/**
+ * Provides some custom compilation options to the {@link
GremlinGroovyScriptEngine}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+class CompilationOptionsCustomizer implements Customizer {
+
+private final int expectedCompilationTime;
+
+public CompilationOptionsCustomizer(final int expectedCompilationTime) {
+this.expectedCompilationTime = expectedCompilationTime;
+}
+
+public int getExpectedCompilationTime() {
+return expectedCompilationTime;
+}
+}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4bdeac4b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 42d954a..5168130 100644
---
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -35,6 +35,7 @@ import
org.apache.tinkerpop.gremlin.groovy.DefaultImportCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.EmptyImportCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.ImportCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.NoImportCustomizerProvider;
+import
org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompilationOptionsCustomizerProvider;
import
org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ConfigurationCustomizerProvider;
import
org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider;
import org.apache.tinkerpop.gremlin.groovy.loaders.GremlinLoader;
@@ -80,11 +81,11 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import
TINKERPOP-1644 Improve script compilation syncronisation
Script compilation is synchronised.
Script compilation times are placed in to logs.
Failed scripts will not be recompiled.
Scripts that take over 5 seconds to compile are logged as a warning.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/13c93cab
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/13c93cab
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/13c93cab
Branch: refs/heads/TINKERPOP-1644
Commit: 13c93cabac51112a73f592e0fba12e515f643522
Parents: 60a3fb3
Author: BrynCooke
Authored: Thu Mar 2 19:07:28 2017 +
Committer: Stephen Mallette
Committed: Fri Mar 10 11:12:36 2017 -0500
--
CHANGELOG.asciidoc | 4 ++
.../jsr223/GremlinGroovyScriptEngine.java | 57 ++--
2 files changed, 56 insertions(+), 5 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/13c93cab/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 6861d57..24e5e9c 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,10 @@
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~
+* Script compilation is synchronised.
+* Script compilation times are placed in to logs.
+* Failed scripts will not be recompiled.
+* Scripts that take over 5 seconds to compile are logged as a warning.
* Fixed an `NullPointerException` in `GraphMLReader` that occurred when an
`` didn't have an ID field and the base graph supported ID assignment.
* Split `ComputerVerificationStrategy` into two strategies:
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
* Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as
it makes too many assumptions about provider compilation.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/13c93cab/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 1fb2efc..a8365a2 100644
---
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -56,6 +56,8 @@ import org.codehaus.groovy.runtime.InvokerHelper;
import org.codehaus.groovy.runtime.MetaClassHelper;
import org.codehaus.groovy.runtime.MethodClosure;
import org.codehaus.groovy.util.ReferenceBundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import javax.script.Bindings;
import javax.script.CompiledScript;
@@ -93,6 +95,7 @@ import java.util.stream.Collectors;
public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
implements DependencyManager, AutoCloseable, GremlinScriptEngine {
+private static final Logger log =
LoggerFactory.getLogger(GremlinGroovyScriptEngine.class);
/**
* An "internal" key for sandboxing the script engine - technically not
for public use.
*/
@@ -153,6 +156,7 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
* Script to generated Class map.
*/
private ManagedConcurrentValueMap classMap = new
ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle());
+private ManagedConcurrentValueMap
failedClassMap = new
ManagedConcurrentValueMap<>(ReferenceBundle.getSoftBundle());
/**
* Global closures map - this is used to simulate a single global
functions namespace
@@ -529,13 +533,56 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
return makeInterface(thiz, clazz);
}
+private Class getScriptClassFromMap(String script) throws
CompilationFailedException {
+CompilationFailedException exception = failedClassMap.get(script);
+if(exception != null) {
+throw exception;
+}
+return classMap.get(script);
+
+}
+
Class getScriptClass(final String script) throws
CompilationFailedException {
-Class clazz = classMap.get(script);
-if (clazz != null) return clazz;
+Class clazz = getScriptClassFromMap(script);
+if (clazz != null) {
+return clazz;
+}
+
Updated changelog CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/60a3fb33
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/60a3fb33
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/60a3fb33
Branch: refs/heads/TINKERPOP-1644
Commit: 60a3fb33e33245f2ad9f3b1494d349c7ccf482b5
Parents: 61a3d12
Author: Stephen Mallette
Authored: Fri Mar 10 06:30:27 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 06:30:27 2017 -0500
--
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/60a3fb33/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 04541d6..6861d57 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~
+* Fixed an `NullPointerException` in `GraphMLReader` that occurred when an
`` didn't have an ID field and the base graph supported ID assignment.
* Split `ComputerVerificationStrategy` into two strategies:
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
* Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as
it makes too many assumptions about provider compilation.
* Deprecated `CustomizerProvider` infrastructure.
TINKERPOP-1644 Added metrics to GremlinGroovyScriptEngine
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8ffa5af6
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8ffa5af6
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8ffa5af6
Branch: refs/heads/TINKERPOP-1644
Commit: 8ffa5af6ff56933c1955e88e8aa42c06cb69162b
Parents: a06072b
Author: Stephen Mallette
Authored: Thu Mar 9 10:30:17 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 11:13:03 2017 -0500
--
CHANGELOG.asciidoc | 2 +
.../jsr223/GremlinGroovyScriptEngine.java | 122 ++-
...roovyScriptEngineCompilationOptionsTest.java | 8 +-
.../jsr223/GremlinGroovyScriptEngineTest.java | 70 ++-
4 files changed, 193 insertions(+), 9 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ffa5af6/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 9c3313e..3729271 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,7 +26,9 @@
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~
+* Added various metrics to the `GremlinGroovyScriptEngine` around script
compilation.
* Moved the `caffeine` dependency down to `gremlin-groovy` and out of
`gremlin-server`.
+* Improved script compilation in `GremlinGroovyScriptEngine to use better
caching, log long compile times and prevent failed compilations from
recompiling on future requests.
* Script compilation is synchronised.
* Script compilation times are placed in to logs.
* Failed scripts will not be recompiled.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ffa5af6/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 3bcb06c..0ed8d84 100644
---
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -164,7 +164,10 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
/**
* Script to generated Class map.
*/
-private final LoadingCache classMap =
Caffeine.newBuilder().softValues().build(new CacheLoader() {
+private final LoadingCache classMap =
Caffeine.newBuilder().
+softValues().
+recordStats().
+build(new CacheLoader() {
@Override
public Future load(final String script) throws Exception {
final long start = System.currentTimeMillis();
@@ -175,6 +178,7 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
} catch (CompilationFailedException e) {
final long finish = System.currentTimeMillis();
log.error("Script compilation FAILED {} took {}ms {}",
script, finish - start, e);
+failedCompilationCount.incrementAndGet();
throw e;
} finally {
final long time = System.currentTimeMillis() - start;
@@ -208,6 +212,13 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
private final AtomicLong longRunCompilationCount = new AtomicLong(0L);
/**
+ * A counter for the instance that tracks the number of failed
compilations. Note that the failures need to be
+ * tracked outside of cache failure load stats because the loading
mechanism will always successfully return
+ * a future and won't trigger a failure.
+ */
+private final AtomicLong failedCompilationCount = new AtomicLong(0L);
+
+/**
* The list of loaded plugins for the console.
*/
private final Set loadedPlugins = new HashSet<>();
@@ -589,10 +600,117 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
/**
* Gets the number of compilations that extended beyond the {@link
#expectedCompilationTime}.
*/
-public long getLongRunCompilationCount() {
+public long getClassCacheLongRunCompilationCount() {
return longRunCompilationCount.longValue();
}
+/**
+ * Gets
TINKERPOP-1644 Made the "counter" in GremlinGroovyScriptEngine static
It seems that this field should be static and shared across all instances as
the script name seems to share space with other GroovyClassLoaders. Not sure
what would happen in the case of collision, but there doesn't seem to be much
harm in ensuring better uniqueness. This counter wasn't used for tracking the
number of scripts actually processed or anything so it should be ok to make
this change without fear of breaking anything.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/a06072b0
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/a06072b0
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/a06072b0
Branch: refs/heads/TINKERPOP-1644
Commit: a06072b0502f9b42fee4c68dba554b4991406c36
Parents: b29ba12
Author: Stephen Mallette
Authored: Wed Mar 8 16:17:40 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 11:12:37 2017 -0500
--
.../groovy/jsr223/GremlinGroovyScriptEngine.java| 12 ++--
1 file changed, 10 insertions(+), 2 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a06072b0/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 5168130..3bcb06c 100644
---
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -196,7 +196,15 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
*/
private final ManagedConcurrentValueMap globalClosures =
new ManagedConcurrentValueMap<>(ReferenceBundle.getHardBundle());
-private final AtomicLong counter = new AtomicLong(0L);
+/**
+ * Ensures unique script names across all instances.
+ */
+private final static AtomicLong scriptNameCounter = new AtomicLong(0L);
+
+/**
+ * A counter for the instance that tracks the number of warnings issued
during script compilations that exceeded
+ * the {@link #expectedCompilationTime}.
+ */
private final AtomicLong longRunCompilationCount = new AtomicLong(0L);
/**
@@ -799,7 +807,7 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
}
private synchronized String generateScriptName() {
-return SCRIPT + counter.incrementAndGet() + DOT_GROOVY;
+return SCRIPT + scriptNameCounter.incrementAndGet() + DOT_GROOVY;
}
@SuppressWarnings("unchecked")
TINKERPOP-1644
Fix exception handling.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/17a72e0e
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/17a72e0e
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/17a72e0e
Branch: refs/heads/TINKERPOP-1644
Commit: 17a72e0e1db6fe52d3a0821ef2bfae1eb39be856
Parents: 18778e4
Author: BrynCooke
Authored: Wed Mar 8 13:23:30 2017 +
Committer: Stephen Mallette
Committed: Fri Mar 10 11:12:36 2017 -0500
--
.../jsr223/GremlinGroovyScriptEngine.java | 33 ++--
1 file changed, 16 insertions(+), 17 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/17a72e0e/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
--
diff --git
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 51850ad..2151a82 100644
---
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -168,26 +168,25 @@ public class GremlinGroovyScriptEngine extends
GroovyScriptEngineImpl
@Override
public Future load(String script) throws Exception {
long start = System.currentTimeMillis();
-try {
-return CompletableFuture.supplyAsync(() ->
loader.parseClass(script, generateScriptName()), command -> command.run());
-} catch (Exception e) {
-if (e.getCause() instanceof CompilationFailedException) {
+
+return CompletableFuture.supplyAsync(() -> {
+try {
+return loader.parseClass(script, generateScriptName());
+} catch (CompilationFailedException e) {
long finish = System.currentTimeMillis();
log.error("Script compilation FAILED {} took {}ms {}",
script, finish - start, e.getCause());
-throw (CompilationFailedException) e.getCause();
-} else {
-throw new AssertionError("Unexpected exception when
compiling script", e);
-}
-} finally {
-long time = System.currentTimeMillis() - start;
-if (time > 5000) {
-//We warn if a script took longer than a few seconds.
Repeatedly seeing these warnings is a sign that something is wrong.
-//Scripts with a large numbers of parameters often trigger
this and should be avoided.
-log.warn("Script compilation {} took {}ms", script, time);
-} else {
-log.debug("Script compilation {} took {}ms", script, time);
+throw e;
+} finally {
+long time = System.currentTimeMillis() - start;
+if (time > 5000) {
+//We warn if a script took longer than a few seconds.
Repeatedly seeing these warnings is a sign that something is wrong.
+//Scripts with a large numbers of parameters often
trigger this and should be avoided.
+log.warn("Script compilation {} took {}ms", script,
time);
+} else {
+log.debug("Script compilation {} took {}ms", script,
time);
+}
}
-}
+}, command -> command.run());
}
});
Repository: tinkerpop
Updated Branches:
refs/heads/master 1cd24031d -> b5bd36bf5
Fixed an NPE in GraphMLReader where if the doesn't have an ID field and
the base graph supports ids, then an NPE happens. Added a test case to verifiy
working behavior. Super simple fix. CTR.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/61a3d125
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/61a3d125
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/61a3d125
Branch: refs/heads/master
Commit: 61a3d125c48869c8e5fdaf195abbb46fbaaf0c30
Parents: 9ea319d
Author: Marko A. Rodriguez
Authored: Thu Mar 9 14:49:36 2017 -0700
Committer: Marko A. Rodriguez
Committed: Thu Mar 9 14:49:36 2017 -0700
--
.../structure/io/graphml/GraphMLReader.java | 19 +++--
.../tinkerpop/gremlin/structure/io/IoTest.java | 25 ++--
.../structure/io/graphml/graph-no-edge-ids.xml | 30
3 files changed, 62 insertions(+), 12 deletions(-)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/61a3d125/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
--
diff --git
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
index e161ba7..3289166 100644
---
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
+++
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphml/GraphMLReader.java
@@ -19,10 +19,10 @@
package org.apache.tinkerpop.gremlin.structure.io.graphml;
import org.apache.tinkerpop.gremlin.structure.Direction;
-import org.apache.tinkerpop.gremlin.structure.Property;
-import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Property;
+import org.apache.tinkerpop.gremlin.structure.T;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
@@ -72,7 +72,7 @@ public final class GraphMLReader implements GraphReader {
@Override
public void readGraph(final InputStream graphInputStream, final Graph
graphToWriteTo) throws IOException {
-final Map cache = new HashMap<>();
+final Map cache = new HashMap<>();
final AtomicLong counter = new AtomicLong(0);
final boolean supportsTx =
graphToWriteTo.features().graph().supportsTransactions();
final Graph.Features.EdgeFeatures edgeFeatures =
graphToWriteTo.features().edge();
@@ -186,9 +186,9 @@ public final class GraphMLReader implements GraphReader {
isInVertex = false;
} else if (elementName.equals(GraphMLTokens.EDGE)) {
final Object[] propsAsArray =
edgeProps.entrySet().stream().flatMap(e -> Stream.of(e.getKey(),
e.getValue())).toArray();
-final Object[] propsReady =
edgeFeatures.willAllowId(edgeId) ? ElementHelper.upsert(propsAsArray, T.id,
edgeId) : propsAsArray;
-
- edgeOutVertex.addEdge(null == edgeLabel ?
Edge.DEFAULT_LABEL : edgeLabel, edgeInVertex, propsReady);
+final Object[] propsReady = null != edgeId &&
edgeFeatures.willAllowId(edgeId) ? ElementHelper.upsert(propsAsArray, T.id,
edgeId) : propsAsArray;
+
+edgeOutVertex.addEdge(null == edgeLabel ?
Edge.DEFAULT_LABEL : edgeLabel, edgeInVertex, propsReady);
if (supportsTx && counter.incrementAndGet() %
batchSize == 0)
graphToWriteTo.tx().commit();
@@ -292,7 +292,7 @@ public final class GraphMLReader implements GraphReader {
private static Vertex findOrCreate(final Object id, final Graph
graphToWriteTo,
final Graph.Features.VertexFeatures
features,
- final Map cache, final
boolean asVertex, final Object... args) {
+ final Map cache, final
boolean asVertex, final Object... args) {
if (cache.containsKey(id)) {
// if the request to findOrCreate come from a vertex then AND the
vertex was already created, that means
// that the vertex was created by an edge that arrived first in
the stream (allowable via GraphML
Updated changelog CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/60a3fb33
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/60a3fb33
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/60a3fb33
Branch: refs/heads/master
Commit: 60a3fb33e33245f2ad9f3b1494d349c7ccf482b5
Parents: 61a3d12
Author: Stephen Mallette
Authored: Fri Mar 10 06:30:27 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 06:30:27 2017 -0500
--
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/60a3fb33/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 04541d6..6861d57 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~
+* Fixed an `NullPointerException` in `GraphMLReader` that occurred when an
`` didn't have an ID field and the base graph supported ID assignment.
* Split `ComputerVerificationStrategy` into two strategies:
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
* Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as
it makes too many assumptions about provider compilation.
* Deprecated `CustomizerProvider` infrastructure.
Repository: tinkerpop
Updated Branches:
refs/heads/tp32 61a3d125c -> 60a3fb33e
Updated changelog CTR
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/60a3fb33
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/60a3fb33
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/60a3fb33
Branch: refs/heads/tp32
Commit: 60a3fb33e33245f2ad9f3b1494d349c7ccf482b5
Parents: 61a3d12
Author: Stephen Mallette
Authored: Fri Mar 10 06:30:27 2017 -0500
Committer: Stephen Mallette
Committed: Fri Mar 10 06:30:27 2017 -0500
--
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
--
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/60a3fb33/CHANGELOG.asciidoc
--
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 04541d6..6861d57 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~
+* Fixed an `NullPointerException` in `GraphMLReader` that occurred when an
`` didn't have an ID field and the base graph supported ID assignment.
* Split `ComputerVerificationStrategy` into two strategies:
`ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
* Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as
it makes too many assumptions about provider compilation.
* Deprecated `CustomizerProvider` infrastructure.