[GitHub] spmallette commented on issue #1042: TINKERPOP-2133 Implement index lookup for Text predicates
spmallette commented on issue #1042: TINKERPOP-2133 Implement index lookup for Text predicates URL: https://github.com/apache/tinkerpop/pull/1042#issuecomment-466455110 @skorikov is there any chance you're coming back to this PR any time soon? i'm not trying to rush you, of course, but i wanted you to be aware that we are likely doing a release of 3.4.1 in mid-march in case you'd like to see this change as part of that release. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[tinkerpop] branch TINKERPOP-1992 updated (d9d26e7 -> 44693d0)
This is an automated email from the ASF dual-hosted git repository. spmallette pushed a change to branch TINKERPOP-1992 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git. discard d9d26e7 TINKERPOP-1992 Prevented reset of barrier from happening more than once discard 6036075 TINKERPOP-1992 Added test to validate that durations are greater than zero. discard a2a4fc1 TINKERPOP-1992 Update changelog discard 6a1f644 TINKERPOP-1992 Fix negative time on profile() step new 33441fd TINKERPOP-2163 Improved performance of JavaTranslator method selection new d7d0989 Merge branch 'TINKERPOP-2163' into tp33 new a440e88 TINKERPOP-2164: Reduce chance of hash collisions in Bytecode and its inner classes new 016f8ca Merge branch 'pr-1067' into tp33 new baed0e5 Bump dependencies for httpclient, commons-codec, slf4j new ffee148 Merge branch 'bumps' into tp33 new f139b40 TINKERPOP-1992 Fix negative time on profile() step new f980886 TINKERPOP-1992 Update changelog new ee30283 TINKERPOP-1992 Added test to validate that durations are greater than zero. new 44693d0 TINKERPOP-1992 Prevented reset of barrier from happening more than once This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (d9d26e7) \ N -- N -- N refs/heads/TINKERPOP-1992 (44693d0) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 14033 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: CHANGELOG.asciidoc | 5 +++ gremlin-console/pom.xml| 5 +++ gremlin-console/src/main/static/LICENSE| 6 ++-- gremlin-console/src/main/static/NOTICE | 8 - gremlin-console/src/main/static/licenses/slf4j | 2 +- .../tinkerpop/gremlin/jsr223/JavaTranslator.java | 38 +++-- .../gremlin/process/traversal/Bytecode.java| 39 +- .../gremlin/process/traversal/BytecodeTest.java| 24 + gremlin-server/src/main/static/LICENSE | 6 ++-- gremlin-server/src/main/static/licenses/slf4j | 2 +- gremlin-test/pom.xml | 1 - hadoop-gremlin/pom.xml | 2 -- pom.xml| 21 ++-- 13 files changed, 120 insertions(+), 39 deletions(-)
[GitHub] spmallette commented on issue #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators
spmallette commented on issue #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators URL: https://github.com/apache/tinkerpop/pull/1065#issuecomment-466398823 Since there are minor API breaks I think that the upgrade docs could use a section to just describe what's changed and how to deal with the compilation issues that might be faced. I would think that it would be added as a sub-section to "Upgrading for Providers > Graph System Providers". Other than that - VOTE +1 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] spmallette commented on a change in pull request #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators
spmallette commented on a change in pull request #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators URL: https://github.com/apache/tinkerpop/pull/1065#discussion_r259342375 ## File path: CHANGELOG.asciidoc ## @@ -35,6 +35,10 @@ This release also includes changes from <>. * Added easier to understand exceptions for connection problems in the Gremlin.Net driver. * Support configuring the type registry builder for GraphBinary. * Release working buffers in case of failure for GraphBinary. +* GraphBinary: Use the same `ByteBuf` instance to write during serialization. Changed signature of write methods in type +serializers. Review comment: nit: no need to multi-line the changelog. it can just run on as needed on a single line. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[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 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 extends ReducingBarrierStep> // 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 extends SideEffectStep 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 extends AbstractStep implements MemoryCo return metrics; } -public void start() { -this.initializeIfNeeded(); -this.metrics.start(); -} - -public void stop() { -this.metrics.stop(); -} - @Override public Traverser.Admin next() { Traverser.Admin start = null; @@ -119,6 +110,21 @@ public final class ProfileStep extends AbstractStep 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, Serializable {
[GitHub] jorgebay commented on issue #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators
jorgebay commented on issue #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators URL: https://github.com/apache/tinkerpop/pull/1065#issuecomment-466349012 I've included more benchmarks in the project to compare GraphSON vs GraphBinary side by side, with more detail about different uses/types. The results from my machine are: ``` Benchmark Mode Cnt Score Error Units SerializationBenchmark.testReadMessage1Binary thrpt 20 4933443.595 ± 108335.893 ops/s SerializationBenchmark.testReadMessage1GraphSON thrpt 20 34318.763 ± 7782.995 ops/s SerializationBenchmark.testReadMessage2Binary thrpt 20974269.201 ± 27497.059 ops/s SerializationBenchmark.testReadMessage2GraphSON thrpt 20 29928.189 ± 1187.881 ops/s SerializationBenchmark.testWriteBytecodeBinarythrpt 20932400.254 ± 24727.644 ops/s SerializationBenchmark.testWriteBytecodeGraphSON thrpt 20690590.285 ± 19508.398 ops/s SerializationBenchmark.testWriteResponseBinarythrpt 20 2629038.176 ± 67510.162 ops/s SerializationBenchmark.testWriteResponseGraphSON thrpt 20652272.129 ± 20014.138 ops/s ``` These new results should be compared with the next group: ``` BenchmarkMode CntScoreError Units GraphBinaryReaderWriterBenchmark.readBytecode1 thrpt 20 1400024.496 ± 64637.425 ops/s GraphBinaryReaderWriterBenchmark.readBytecode2 thrpt 20 343833.159 ± 10609.128 ops/s GraphBinaryReaderWriterBenchmark.writeBytecode1 thrpt 20 1857617.437 ± 100685.512 ops/s GraphBinaryReaderWriterBenchmark.writeBytecode2 thrpt 20 431804.339 ± 24291.109 ops/s ``` ``` BenchmarkMode CntScoreError Units GraphSONMapperBenchmark.readBytecode1 thrpt 20 592331.268 ± 71423.780 ops/s GraphSONMapperBenchmark.readBytecode2 thrpt 20 123595.490 ± 9640.191 ops/s GraphSONMapperBenchmark.writeBytecode1 thrpt 20 1352647.895 ± 348521.676 ops/s GraphSONMapperBenchmark.writeBytecode2 thrpt 20 371473.035 ± 35986.231 ops/s ``` In the process, I've found that `P` deserialization can be optimized on both GraphSON and GraphBinary, I've filed TINKERPOP-2166 for it. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[tinkerpop] branch TINKERPOP-2161 updated: Fix: Uncomment tests
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a commit to branch TINKERPOP-2161 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/TINKERPOP-2161 by this push: new 31f536f Fix: Uncomment tests 31f536f is described below commit 31f536f41305d2b6fc4977280f6545f0aa592ff1 Author: Jorge Bay Gondra AuthorDate: Fri Feb 22 11:19:00 2019 +0100 Fix: Uncomment tests --- .../ser/binary/TypeSerializerFailureTests.java | 236 +++ .../ser/binary/TypeSerializerRegistryTest.java | 321 ++--- 2 files changed, 280 insertions(+), 277 deletions(-) diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java index a721750..38296e4 100644 --- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java +++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java @@ -1,116 +1,120 @@ -///* -// * 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.driver.ser.binary; -// -//import io.netty.buffer.UnpooledByteBufAllocator; -//import org.apache.tinkerpop.gremlin.driver.ser.SerializationException; -//import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser; -//import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; -//import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet; -//import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyPath; -//import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; -//import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics; -//import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics; -//import org.apache.tinkerpop.gremlin.structure.Vertex; -//import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge; -//import org.apache.tinkerpop.gremlin.structure.util.reference.ReferencePath; -//import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex; -//import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProperty; -//import org.apache.tinkerpop.gremlin.util.function.Lambda; -//import org.junit.Test; -//import org.junit.runner.RunWith; -//import org.junit.runners.Parameterized; -// -//import java.util.Arrays; -//import java.util.Collection; -//import java.util.Collections; -//import java.util.List; -// -//import static org.junit.Assert.assertEquals; -//import static org.junit.Assert.fail; -// -//@RunWith(Parameterized.class) -//public class TypeSerializerFailureTests { -// -//private final GraphBinaryWriter writer = new GraphBinaryWriter(); -//private final UnpooledByteBufAllocator allocator = new UnpooledByteBufAllocator(false); -// -//@Parameterized.Parameters(name = "Value={0}") -//public static Collection input() { -//final Bytecode.Binding b = new Bytecode.Binding(null, "b"); -// -//final ReferenceVertex vertex = new ReferenceVertex("a vertex", null); -// -//final Bytecode bytecode = new Bytecode(); -//bytecode.addStep(null); -// -//final BulkSet bulkSet = new BulkSet<>(); -//bulkSet.add(vertex, 1L); -// -//final MutableMetrics metrics = new MutableMetrics("a metric", null); -// -//final Tree tree = new Tree<>(); -//tree.put(vertex, null); -// -//// Provide instances that are malformed for serialization to fail -//return Arrays.asList( -//b, -//vertex, -//Collections.singletonMap("one", b), -//bulkSet, -//bytecode, -//Collections.singletonList(vertex), -//new ReferenceEdge("an edge", null, vertex, vertex), -//Lambda.supplier(null), -//metrics, -//new DefaultTraversalMetrics(1L, Collections.singletonList(metrics)), -//
[tinkerpop] branch TINKERPOP-2161 updated: Remove P serialization from benchmarks
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a commit to branch TINKERPOP-2161 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/TINKERPOP-2161 by this push: new 859e30f Remove P serialization from benchmarks 859e30f is described below commit 859e30ff8afa36279e81c7c7d8be2a28e7ef5f37 Author: Jorge Bay Gondra AuthorDate: Fri Feb 22 11:13:39 2019 +0100 Remove P serialization from benchmarks --- .../tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java | 3 --- .../org/apache/tinkerpop/gremlin/driver/GraphSONMapperBenchmark.java | 2 -- 2 files changed, 5 deletions(-) diff --git a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java index 761089d..1cc509a 100644 --- a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java +++ b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphBinaryReaderWriterBenchmark.java @@ -25,12 +25,10 @@ import org.apache.tinkerpop.gremlin.driver.ser.SerializationException; import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryReader; import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryWriter; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; -import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Level; -import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; import org.openjdk.jmh.annotations.State; @@ -77,7 +75,6 @@ public class GraphBinaryReaderWriterBenchmark extends AbstractBenchmarkBase { .property("name4", BigInteger.valueOf(33343455342245L)) .property("name5", "kjlkdnvlkdrnvldnvndlrkvnlhkjdkgkrtnlkndblknlknonboirnlkbnrtbonrobinokbnrklnbkrnblktengotrngotkrnglkt") .property("name6", Instant.now()) -.property("name9", P.between(12, 15)) .asAdmin().getBytecode(); writer.writeValue(bytecode1, bytecodeBuffer1, false); diff --git a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphSONMapperBenchmark.java b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphSONMapperBenchmark.java index 7a87db7..e787ca7 100644 --- a/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphSONMapperBenchmark.java +++ b/gremlin-tools/gremlin-benchmark/src/main/java/org/apache/tinkerpop/gremlin/driver/GraphSONMapperBenchmark.java @@ -20,7 +20,6 @@ package org.apache.tinkerpop.gremlin.driver; import org.apache.tinkerpop.benchmark.util.AbstractBenchmarkBase; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; -import org.apache.tinkerpop.gremlin.process.traversal.P; import org.apache.tinkerpop.gremlin.structure.Graph; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper; import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion; @@ -74,7 +73,6 @@ public class GraphSONMapperBenchmark extends AbstractBenchmarkBase { .property("name4", BigInteger.valueOf(33343455342245L)) .property("name5", "kjlkdnvlkdrnvldnvndlrkvnlhkjdkgkrtnlkndblknlknonboirnlkbnrtbonrobinokbnrklnbkrnblktengotrngotkrnglkt") .property("name6", Instant.now()) -.property("name9", P.between(12, 15)) .asAdmin().getBytecode();
[GitHub] nastra commented on a change in pull request #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators
nastra commented on a change in pull request #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators URL: https://github.com/apache/tinkerpop/pull/1065#discussion_r259275938 ## File path: gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerRegistryTest.java ## @@ -1,161 +1,161 @@ -/* - * 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.driver.ser.binary; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; -import org.apache.tinkerpop.gremlin.driver.ser.SerializationException; -import org.apache.tinkerpop.gremlin.driver.ser.binary.types.sample.SamplePerson; -import org.apache.tinkerpop.gremlin.driver.ser.binary.types.sample.SamplePersonSerializer; -import org.apache.tinkerpop.gremlin.structure.Property; -import org.apache.tinkerpop.gremlin.structure.VertexProperty; -import org.junit.Test; - -import java.util.UUID; - -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertSame; - -public class TypeSerializerRegistryTest { - -@Test -public void shouldResolveToUserProvidedForInterfaces_1() throws SerializationException { -final TypeSerializer expected = new TestVertexPropertySerializer(); -final TypeSerializerRegistry registry = TypeSerializerRegistry.build() -.add(VertexProperty.class, expected).create(); - -assertSame(expected, registry.getSerializer(VertexProperty.class)); -assertSame(expected, registry.getSerializer(DataType.VERTEXPROPERTY)); -} - -@Test -public void shouldResolveToUserProvidedForInterfaces_2() throws SerializationException { -final TypeSerializer expected = new TestPropertySerializer(); -final TypeSerializerRegistry registry = TypeSerializerRegistry.build() -.add(Property.class, expected).create(); - -assertSame(expected, registry.getSerializer(Property.class)); -assertSame(expected, registry.getSerializer(DataType.PROPERTY)); -} - -@Test -public void shouldResolveToUserProvidedForClasses() throws SerializationException { -final TypeSerializer expected = new TestUUIDSerializer(); -final TypeSerializerRegistry registry = TypeSerializerRegistry.build() -.add(UUID.class, expected).create(); - -assertSame(expected, registry.getSerializer(UUID.class)); -assertSame(expected, registry.getSerializer(DataType.UUID)); -} - -@Test -public void shouldResolveToTheFirstSerializerForInterfaces() throws SerializationException { -final TypeSerializer expectedForVertexProperty = new TestVertexPropertySerializer(); -final TypeSerializer expectedForProperty = new TestPropertySerializer(); -final TypeSerializerRegistry registry = TypeSerializerRegistry.build() -.add(VertexProperty.class, expectedForVertexProperty) -.add(Property.class, expectedForProperty).create(); - -assertSame(expectedForVertexProperty, registry.getSerializer(VertexProperty.class)); -assertSame(expectedForProperty, registry.getSerializer(Property.class)); -assertSame(expectedForVertexProperty, registry.getSerializer(DataType.VERTEXPROPERTY)); -assertSame(expectedForProperty, registry.getSerializer(DataType.PROPERTY)); -} - -@Test -public void shouldUseFallbackResolverWhenThereIsNoMatch() { -final int[] called = {0}; -final TypeSerializerRegistry registry = TypeSerializerRegistry.build() -.withFallbackResolver(t -> { -called[0]++; -return null; -}).create(); - -String message = null; -try { -registry.getSerializer(SamplePerson.class); -} catch (SerializationException ex) { -message = ex.getMessage(); -} - -assertEquals("Serializer for type org.apache.tinkerpop.gremlin.driver.ser.binary.types.sample.SamplePerson not found", message); -assertEquals(1, called[0]); -} - -@Test -public void shouldUseFallbackResolverReturnValue() throws
[GitHub] nastra commented on a change in pull request #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators
nastra commented on a change in pull request #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators URL: https://github.com/apache/tinkerpop/pull/1065#discussion_r259275799 ## File path: gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/TypeSerializerFailureTests.java ## @@ -1,116 +1,116 @@ -/* - * 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.driver.ser.binary; - -import io.netty.buffer.UnpooledByteBufAllocator; -import org.apache.tinkerpop.gremlin.driver.ser.SerializationException; -import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser; -import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; -import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet; -import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyPath; -import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree; -import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics; -import org.apache.tinkerpop.gremlin.process.traversal.util.MutableMetrics; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge; -import org.apache.tinkerpop.gremlin.structure.util.reference.ReferencePath; -import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertex; -import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceVertexProperty; -import org.apache.tinkerpop.gremlin.util.function.Lambda; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -@RunWith(Parameterized.class) -public class TypeSerializerFailureTests { - -private final GraphBinaryWriter writer = new GraphBinaryWriter(); -private final UnpooledByteBufAllocator allocator = new UnpooledByteBufAllocator(false); - -@Parameterized.Parameters(name = "Value={0}") -public static Collection input() { -final Bytecode.Binding b = new Bytecode.Binding(null, "b"); - -final ReferenceVertex vertex = new ReferenceVertex("a vertex", null); - -final Bytecode bytecode = new Bytecode(); -bytecode.addStep(null); - -final BulkSet bulkSet = new BulkSet<>(); -bulkSet.add(vertex, 1L); - -final MutableMetrics metrics = new MutableMetrics("a metric", null); - -final Tree tree = new Tree<>(); -tree.put(vertex, null); - -// Provide instances that are malformed for serialization to fail -return Arrays.asList( -b, -vertex, -Collections.singletonMap("one", b), -bulkSet, -bytecode, -Collections.singletonList(vertex), -new ReferenceEdge("an edge", null, vertex, vertex), -Lambda.supplier(null), -metrics, -new DefaultTraversalMetrics(1L, Collections.singletonList(metrics)), -new DefaultRemoteTraverser<>(new Object(), 1L), -tree, -new ReferenceVertexProperty<>("a prop", null, "value"), -new InvalidPath() -); -} - -@Parameterized.Parameter(value = 0) -public Object value; - -@Test -public void shouldReleaseMemoryWhenFails() { -try { -writer.write(value, allocator); -fail("Should throw exception"); -} catch (SerializationException | RuntimeException e) { -// Do nothing -} - -assertEquals(0, allocator.metric().usedHeapMemory()); -} - -public static class InvalidPath extends ReferencePath { -public InvalidPath() { -super(EmptyPath.instance()); -} - -@Override -public List objects() { -return Collections.singletonList(new Object()); -} -} -} +///* +// * Licensed to the Apache Software Foundation (ASF) under one +// * or more contributor
[GitHub] jorgebay commented on issue #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators
jorgebay commented on issue #1065: TINKERPOP-2161 - GraphBinary: use a single buffer instead of allocators URL: https://github.com/apache/tinkerpop/pull/1065#issuecomment-466329380 I've added the CHANGELOG entries and removed the unused parameter from `ResponseMessageSerializer` (TINKERPOP-2153). I think this is ready to be reviewed. VOTE +1 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[tinkerpop] branch TINKERPOP-2161 updated: Remove unused param from ResponseMessageSerializer and CHANGELOG entry
This is an automated email from the ASF dual-hosted git repository. jorgebg pushed a commit to branch TINKERPOP-2161 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/TINKERPOP-2161 by this push: new 70637df Remove unused param from ResponseMessageSerializer and CHANGELOG entry 70637df is described below commit 70637dfb86836d28eeb162ef89fd7a77f1ec5ae0 Author: Jorge Bay Gondra AuthorDate: Fri Feb 22 10:14:30 2019 +0100 Remove unused param from ResponseMessageSerializer and CHANGELOG entry --- CHANGELOG.asciidoc | 4 .../gremlin/driver/ser/GraphBinaryMessageSerializerV1.java | 5 ++--- .../tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java | 1 + .../gremlin/driver/ser/binary/RequestMessageSerializer.java| 3 +-- .../gremlin/driver/ser/binary/ResponseMessageSerializer.java | 7 +++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index b75a3db..f60c48e 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -35,6 +35,10 @@ This release also includes changes from <>. * Added easier to understand exceptions for connection problems in the Gremlin.Net driver. * Support configuring the type registry builder for GraphBinary. * Release working buffers in case of failure for GraphBinary. +* GraphBinary: Use the same `ByteBuf` instance to write during serialization. Changed signature of write methods in type +serializers. +* Remove unused parameter in GraphBinary's `ResponseMessageSerializer`. + [[release-3-4-0]] === TinkerPop 3.4.0 (Release Date: January 2, 2019) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphBinaryMessageSerializerV1.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphBinaryMessageSerializerV1.java index 0d9b59c..c368562 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphBinaryMessageSerializerV1.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/GraphBinaryMessageSerializerV1.java @@ -20,7 +20,6 @@ package org.apache.tinkerpop.gremlin.driver.ser; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import io.netty.buffer.CompositeByteBuf; import org.apache.tinkerpop.gremlin.driver.message.RequestMessage; import org.apache.tinkerpop.gremlin.driver.message.ResponseMessage; import org.apache.tinkerpop.gremlin.driver.ser.binary.GraphBinaryIo; @@ -123,7 +122,7 @@ public class GraphBinaryMessageSerializerV1 extends AbstractMessageSerializer { final ByteBuf buffer = allocator.buffer(); try { -responseSerializer.writeValue(responseMessage, buffer, writer, false); +responseSerializer.writeValue(responseMessage, buffer, writer); } catch (Exception ex) { buffer.release(); throw ex; @@ -153,7 +152,7 @@ public class GraphBinaryMessageSerializerV1 extends AbstractMessageSerializer { @Override public ResponseMessage deserializeResponse(final ByteBuf msg) throws SerializationException { -return responseSerializer.readValue(msg, reader, false); +return responseSerializer.readValue(msg, reader); } @Override diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java index 46fb05a..68ccc7a 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/GraphBinaryWriter.java @@ -28,6 +28,7 @@ public class GraphBinaryWriter { private final TypeSerializerRegistry registry; private final static byte VALUE_FLAG_NULL = 1; private final static byte VALUE_FLAG_NONE = 0; +public final static byte VERSION_BYTE = (byte)0x81; private final static byte[] unspecifiedNullBytes = new byte[] { DataType.UNSPECIFIED_NULL.getCodeByte(), 0x01}; private final static byte[] customTypeCodeBytes = new byte[] { DataType.CUSTOM.getCodeByte() }; diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/RequestMessageSerializer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/RequestMessageSerializer.java index b7373a3..42f70cd 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/RequestMessageSerializer.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ser/binary/RequestMessageSerializer.java @@ -19,7 +19,6 @@ package org.apache.tinkerpop.gremlin.driver.ser.binary; import io.netty.buffer.ByteBuf; -import io.netty.buffer.ByteBufAllocator; import