From abed34db5a3c7f3b06c1aa8d309a68c87f63ac2d Mon Sep 17 00:00:00 2001 From: Allan Clements Date: Sun, 11 Feb 2024 15:54:59 -0600 Subject: [PATCH 1/2] Implemented large string write test failure --- .../tinkerpop/JanusGraphSerializerBaseIT.java | 16 ++++++++++++++++ .../janusgraph-server-with-serializers.yaml | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/janusgraph-server/src/test/java/org/janusgraph/graphdb/tinkerpop/JanusGraphSerializerBaseIT.java b/janusgraph-server/src/test/java/org/janusgraph/graphdb/tinkerpop/JanusGraphSerializerBaseIT.java index 2c45cbce52..c2a1a6e789 100644 --- a/janusgraph-server/src/test/java/org/janusgraph/graphdb/tinkerpop/JanusGraphSerializerBaseIT.java +++ b/janusgraph-server/src/test/java/org/janusgraph/graphdb/tinkerpop/JanusGraphSerializerBaseIT.java @@ -14,6 +14,7 @@ package org.janusgraph.graphdb.tinkerpop; +import org.apache.commons.lang3.RandomStringUtils; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; import org.apache.tinkerpop.gremlin.structure.T; @@ -70,6 +71,21 @@ public void testPropertiesWriteAndRead(boolean useCustomId) { assertEquals(4, g.V().properties().toList().size()); } + @ParameterizedTest + @ValueSource(ints = {500, 1_000, 1_000_000, 10_000_000, 20_000_000, 21_000_000}) + public void testWriteLargeString(int stringLength) throws Exception { + setUp(false); + try (GraphTraversalSource g = traversal()) { + GraphTraversal t = g.addV("largeStringTestLabel"); + String largeStringPropertyKey = "largeString"; + String largeStringValue = RandomStringUtils.random(stringLength, 'a', 'b', 'c', 'd', 'e', 'f'); + Vertex initialVertex = t.property(largeStringPropertyKey, largeStringValue).next(); + + Vertex recalledVertex = g.V().hasLabel("largeStringTestLabel").has(largeStringPropertyKey, largeStringValue).next(); + assertEquals(initialVertex.id(), recalledVertex.id()); + } + } + @ParameterizedTest @ValueSource(booleans = {true, false}) public void testGeoshapePointsWriteAndRead(boolean useCustomId, TestInfo testInfo) { diff --git a/janusgraph-server/src/test/resources/janusgraph-server-with-serializers.yaml b/janusgraph-server/src/test/resources/janusgraph-server-with-serializers.yaml index 9a105a8b8e..5a574918a0 100644 --- a/janusgraph-server/src/test/resources/janusgraph-server-with-serializers.yaml +++ b/janusgraph-server/src/test/resources/janusgraph-server-with-serializers.yaml @@ -29,9 +29,9 @@ scriptEngines: { serializers: - { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} - { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1, config: { serializeResultToString: true }} - - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV3, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} + - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV3, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry], maxStringLength: 25000000 }} # Older serialization versions for backwards compatibility: - - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} + - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry], maxStringLength: 25000000 }} - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV1, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }} - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONUntypedMessageSerializerV1, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }} processors: @@ -46,7 +46,7 @@ metrics: { maxInitialLineLength: 4096 maxHeaderSize: 8192 maxChunkSize: 8192 -maxContentLength: 65536 +maxContentLength: 25000000 maxAccumulationBufferComponents: 1024 resultIterationBatchSize: 64 writeBufferLowWaterMark: 32768 From aa1585537f0cd4d8d94fcc8965dfba64b5ea01cf Mon Sep 17 00:00:00 2001 From: Allan Clements Date: Sun, 11 Feb 2024 16:09:07 -0600 Subject: [PATCH 2/2] Removed uninvolved setting --- .../src/test/resources/janusgraph-server-with-serializers.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/janusgraph-server/src/test/resources/janusgraph-server-with-serializers.yaml b/janusgraph-server/src/test/resources/janusgraph-server-with-serializers.yaml index 5a574918a0..d7467a2baa 100644 --- a/janusgraph-server/src/test/resources/janusgraph-server-with-serializers.yaml +++ b/janusgraph-server/src/test/resources/janusgraph-server-with-serializers.yaml @@ -31,7 +31,7 @@ serializers: - { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1, config: { serializeResultToString: true }} - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV3, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry], maxStringLength: 25000000 }} # Older serialization versions for backwards compatibility: - - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry], maxStringLength: 25000000 }} + - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV1, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }} - { className: org.apache.tinkerpop.gremlin.util.ser.GraphSONUntypedMessageSerializerV1, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }} processors: