(tinkerpop) branch chunked-http created (now 22495eb533)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch chunked-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 22495eb533 Add chunked transfer encoding to HTTP Channelizer. This branch includes the following new commits: new 22495eb533 Add chunked transfer encoding to HTTP Channelizer. The 1 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.
(tinkerpop) 01/01: Add chunked transfer encoding to HTTP Channelizer.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch chunked-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 22495eb533d71ca6ff73252051297977999c33d2 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Mar 7 21:33:35 2024 -0800 Add chunked transfer encoding to HTTP Channelizer. The HttpGremlinEndpointHandler will now chunk responses for both script and bytecode traversals. Much of the implementation is taken from the StandardOpProcessor/TraversalOpProcessor/UnifiedHandler. --- .../server/handler/HttpGremlinEndpointHandler.java | 789 - .../gremlin/server/handler/HttpHandlerUtil.java| 28 +- .../server/GremlinServerHttpIntegrateTest.java | 199 +- 3 files changed, 823 insertions(+), 193 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 665cf1ef3c..428036d562 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -20,74 +20,102 @@ package org.apache.tinkerpop.gremlin.server.handler; import com.codahale.metrics.Timer; import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.channel.ChannelPromise; import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.http.DefaultFullHttpResponse; +import io.netty.handler.codec.http.DefaultHttpContent; +import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.FullHttpRequest; -import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpHeaderNames; -import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.HttpUtil; import io.netty.util.ReferenceCountUtil; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor; -import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptChecker; -import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser; +import org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException; +import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine; +import org.apache.tinkerpop.gremlin.jsr223.JavaTranslator; +import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; +import org.apache.tinkerpop.gremlin.process.traversal.Failure; +import org.apache.tinkerpop.gremlin.process.traversal.Operator; +import org.apache.tinkerpop.gremlin.process.traversal.Order; +import org.apache.tinkerpop.gremlin.process.traversal.Pop; +import org.apache.tinkerpop.gremlin.process.traversal.Scope; +import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; -import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.AbstractTraverser; +import org.apache.tinkerpop.gremlin.process.traversal.util.BytecodeHelper; +import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalInterruptedException; +import org.apache.tinkerpop.gremlin.server.Context; import org.apache.tinkerpop.gremlin.server.GraphManager; import org.apache.tinkerpop.gremlin.server.GremlinServer; import org.apache.tinkerpop.gremlin.server.Settings; import org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser; +import org.apache.tinkerpop.gremlin.server.op.OpProcessorException; import org.apache.tinkerpop.gremlin.server.util.MetricManager; import org.apache.tinkerpop.gremlin.server.util.TextPlainMessageSerializer; -import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.server.util.TraverserIterator; +import org.apache.tinkerpop.gremlin.structure.Column; import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.util.TemporaryException; import org.apache.tinkerpop.gremlin.util.ExceptionHelper; import org.apache.tinkerpop.gremlin.util.MessageSerializer; import org.apache.tinkerpop.gremlin.util.Tokens; -import org.apache.tinkerpop.gremlin.util.function.FunctionUtils; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import org.apache.tinkerpop.gremlin.util.message.RequestMessage; import org.apache.tinkerpop.gremlin.util.message.ResponseMessage;
(tinkerpop) branch master-http created (now 6c01291d06)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 6c01291d06 Merge branch '3.7-dev' No new revisions were added by this update.
(tinkerpop) branch chunked-http updated (22495eb533 -> 0aa311c035)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch chunked-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard 22495eb533 Add chunked transfer encoding to HTTP Channelizer. new 0aa311c035 Add chunked transfer encoding to HTTP Channelizer. 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 (22495eb533) \ N -- N -- N refs/heads/chunked-http (0aa311c035) 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 1 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: .../gremlin/server/handler/HttpGremlinEndpointHandler.java| 8 .../tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java | 1 - 2 files changed, 9 deletions(-)
(tinkerpop) 01/01: Add chunked transfer encoding to HTTP Channelizer.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch chunked-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 0aa311c0352a28f4706c43adfdf782f9ae4c0604 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Mar 7 21:33:35 2024 -0800 Add chunked transfer encoding to HTTP Channelizer. The HttpGremlinEndpointHandler will now chunk responses for both script and bytecode traversals. Much of the implementation is taken from the StandardOpProcessor/TraversalOpProcessor/UnifiedHandler. --- .../server/handler/HttpGremlinEndpointHandler.java | 781 - .../gremlin/server/handler/HttpHandlerUtil.java| 28 +- .../server/GremlinServerHttpIntegrateTest.java | 198 +- 3 files changed, 814 insertions(+), 193 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 665cf1ef3c..d2d8e8619a 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -20,74 +20,101 @@ package org.apache.tinkerpop.gremlin.server.handler; import com.codahale.metrics.Timer; import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.channel.ChannelPromise; import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.http.DefaultFullHttpResponse; +import io.netty.handler.codec.http.DefaultHttpContent; +import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.FullHttpRequest; -import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpHeaderNames; -import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.HttpUtil; import io.netty.util.ReferenceCountUtil; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor; -import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptChecker; -import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser; +import org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException; +import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine; +import org.apache.tinkerpop.gremlin.jsr223.JavaTranslator; +import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; +import org.apache.tinkerpop.gremlin.process.traversal.Failure; +import org.apache.tinkerpop.gremlin.process.traversal.Operator; +import org.apache.tinkerpop.gremlin.process.traversal.Order; +import org.apache.tinkerpop.gremlin.process.traversal.Pop; +import org.apache.tinkerpop.gremlin.process.traversal.Scope; +import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; -import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.AbstractTraverser; +import org.apache.tinkerpop.gremlin.process.traversal.util.BytecodeHelper; +import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalInterruptedException; +import org.apache.tinkerpop.gremlin.server.Context; import org.apache.tinkerpop.gremlin.server.GraphManager; import org.apache.tinkerpop.gremlin.server.GremlinServer; import org.apache.tinkerpop.gremlin.server.Settings; import org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser; +import org.apache.tinkerpop.gremlin.server.op.OpProcessorException; import org.apache.tinkerpop.gremlin.server.util.MetricManager; import org.apache.tinkerpop.gremlin.server.util.TextPlainMessageSerializer; -import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.server.util.TraverserIterator; +import org.apache.tinkerpop.gremlin.structure.Column; import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.util.TemporaryException; import org.apache.tinkerpop.gremlin.util.ExceptionHelper; import org.apache.tinkerpop.gremlin.util.MessageSerializer; import org.apache.tinkerpop.gremlin.util.Tokens; -import org.apache.tinkerpop.gremlin.util.function.FunctionUtils; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import org.apache.tinkerpop.gremlin.util.message.RequestMessage; import org.apache.tinkerpop.gremlin.util.message.ResponseMessage;
(tinkerpop) branch chunked-http deleted (was 0aa311c035)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch chunked-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was 0aa311c035 Add chunked transfer encoding to HTTP Channelizer. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch master-http updated: Add chunked transfer encoding to HTTP Channelizer.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 2b7fc247ea Add chunked transfer encoding to HTTP Channelizer. 2b7fc247ea is described below commit 2b7fc247ea5b99473043d96dc5f3042ee83c6aed Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Mar 7 21:33:35 2024 -0800 Add chunked transfer encoding to HTTP Channelizer. The HttpGremlinEndpointHandler will now chunk responses for both script and bytecode traversals. Much of the implementation is taken from the StandardOpProcessor/TraversalOpProcessor/UnifiedHandler. --- .../server/handler/HttpGremlinEndpointHandler.java | 781 - .../gremlin/server/handler/HttpHandlerUtil.java| 28 +- .../server/GremlinServerHttpIntegrateTest.java | 198 +- 3 files changed, 814 insertions(+), 193 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 665cf1ef3c..d2d8e8619a 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -20,74 +20,101 @@ package org.apache.tinkerpop.gremlin.server.handler; import com.codahale.metrics.Timer; import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; -import io.netty.channel.ChannelPromise; import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.http.DefaultFullHttpResponse; +import io.netty.handler.codec.http.DefaultHttpContent; +import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.FullHttpRequest; -import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpHeaderNames; -import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.HttpUtil; import io.netty.util.ReferenceCountUtil; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor; -import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptChecker; -import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser; +import org.apache.tinkerpop.gremlin.groovy.jsr223.TimedInterruptTimeoutException; +import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine; +import org.apache.tinkerpop.gremlin.jsr223.JavaTranslator; +import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; +import org.apache.tinkerpop.gremlin.process.traversal.Failure; +import org.apache.tinkerpop.gremlin.process.traversal.Operator; +import org.apache.tinkerpop.gremlin.process.traversal.Order; +import org.apache.tinkerpop.gremlin.process.traversal.Pop; +import org.apache.tinkerpop.gremlin.process.traversal.Scope; +import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; -import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.AbstractTraverser; +import org.apache.tinkerpop.gremlin.process.traversal.util.BytecodeHelper; +import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalInterruptedException; +import org.apache.tinkerpop.gremlin.server.Context; import org.apache.tinkerpop.gremlin.server.GraphManager; import org.apache.tinkerpop.gremlin.server.GremlinServer; import org.apache.tinkerpop.gremlin.server.Settings; import org.apache.tinkerpop.gremlin.server.auth.AuthenticatedUser; +import org.apache.tinkerpop.gremlin.server.op.OpProcessorException; import org.apache.tinkerpop.gremlin.server.util.MetricManager; import org.apache.tinkerpop.gremlin.server.util.TextPlainMessageSerializer; -import org.apache.tinkerpop.gremlin.structure.Element; +import org.apache.tinkerpop.gremlin.server.util.TraverserIterator; +import org.apache.tinkerpop.gremlin.structure.Column; import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceFactory; +import org.apache.tinkerpop.gremlin.structure.T; +import org.apache.tinkerpop.gremlin.structure.util.TemporaryException; import org.apache.tinkerpop.gremlin.util.ExceptionHelper; import org.apache.tinkerpop.gremlin.util.MessageSerializer; import org.apache.tinkerpop.gremlin.util.Tokens; -import org.apache.tinkerpop.gremlin.util.function.FunctionUtils; import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
(tinkerpop) branch remove-sessions-unifiedchannelizer created (now 91a2ded428)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch remove-sessions-unifiedchannelizer in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 91a2ded428 Remove the UnifiedChannelizer/UnifiedHandler and associated classes. This branch includes the following new commits: new 91a2ded428 Remove the UnifiedChannelizer/UnifiedHandler and associated classes. The 1 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.
(tinkerpop) branch remove-sessions-unifiedchannelizer deleted (was 91a2ded428)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch remove-sessions-unifiedchannelizer in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was 91a2ded428 Remove the UnifiedChannelizer/UnifiedHandler and associated classes. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch valentyn/streaming-serializers updated (ebb81678d1 -> 915703f19c)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch valentyn/streaming-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard ebb81678d1 cleanup discard 427171970e tests and cleanup discard caee19ebd7 test cleanup discard 090ef4c5ea GraphBinary streaming draft discard b56b2c0c4a draft for GraphSON4 omit 0aa311c035 Add chunked transfer encoding to HTTP Channelizer. add 2b7fc247ea Add chunked transfer encoding to HTTP Channelizer. add 9a55450d61 Remove the UnifiedChannelizer/UnifiedHandler and associated classes. add 645caef7c4 draft for GraphSON4 add 2568d2f9b7 GraphBinary streaming draft add 2e5109d791 test cleanup add 2f5dd687c6 tests and cleanup add 915703f19c cleanup 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 (ebb81678d1) \ N -- N -- N refs/heads/valentyn/streaming-serializers (915703f19c) 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. No new revisions were added by this update. Summary of changes: docs/src/reference/gremlin-applications.asciidoc | 34 +- .../apache/tinkerpop/gremlin/driver/Client.java| 21 - .../apache/tinkerpop/gremlin/server/Settings.java | 44 +- .../gremlin/server/channel/UnifiedChannelizer.java | 86 -- .../gremlin/server/handler/AbstractSession.java| 863 - .../gremlin/server/handler/MultiTaskSession.java | 316 .../tinkerpop/gremlin/server/handler/Session.java | 84 -- .../gremlin/server/handler/SessionException.java | 43 - .../gremlin/server/handler/SessionTask.java| 42 - .../gremlin/server/handler/SingleTaskSession.java | 99 --- .../gremlin/server/handler/UnifiedHandler.java | 356 - .../server/op/traversal/TraversalOpProcessor.java | 1 - .../AbstractGremlinServerIntegrationTest.java | 22 - .../gremlin/server/GremlinDriverIntegrateTest.java | 2 +- .../server/GremlinServerHttpIntegrateTest.java | 2 +- .../gremlin/server/GremlinServerIntegrateTest.java | 97 +-- .../server/GremlinServerSessionIntegrateTest.java | 203 + ...SessionIntegrateWithUnifiedChannelizerTest.java | 61 -- .../server/GremlinSessionTxIntegrateTest.java | 5 +- .../channel/UnifiedChannelizerIntegrateTest.java | 57 -- .../server/channel/UnifiedTestChannelizer.java | 48 -- .../server/channel/WsAndHttpTestChannelizer.java | 2 +- gremlin-server/src/test/resources/logback-test.xml | 2 - .../org/apache/tinkerpop/gremlin/util/Tokens.java | 7 - 24 files changed, 19 insertions(+), 2478 deletions(-) delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/UnifiedChannelizer.java delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/AbstractSession.java delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/MultiTaskSession.java delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/Session.java delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SessionException.java delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SessionTask.java delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SingleTaskSession.java delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/UnifiedHandler.java delete mode 100644 gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerSessionIntegrateWithUnifiedChannelizerTest.java delete mode 100644 gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/UnifiedChannelizerIntegrateTest.java delete mode 100644 gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/channel/UnifiedTestChannelizer.java
(tinkerpop) branch valentyn/streaming-serializers updated (915703f19c -> d2cd239a0b)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch valentyn/streaming-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard 915703f19c cleanup discard 2f5dd687c6 tests and cleanup discard 2e5109d791 test cleanup discard 2568d2f9b7 GraphBinary streaming draft discard 645caef7c4 draft for GraphSON4 add d2cd239a0b draft for GraphSON4 and GraphBinary streaming draft 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 (915703f19c) \ N -- N -- N refs/heads/valentyn/streaming-serializers (d2cd239a0b) 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. No new revisions were added by this update. Summary of changes: .../apache/tinkerpop/gremlin/server/handler/OpSelectorHandler.java| 4 ++-- .../test/java/org/apache/tinkerpop/gremlin/server/ContextTest.java| 1 - .../gremlin/util/ser/GraphSONUntypedMessageSerializerV3.java | 1 - 3 files changed, 2 insertions(+), 4 deletions(-)
(tinkerpop) branch master-http updated: draft for GraphSON4 and GraphBinary streaming draft (#2531)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 443ca07987 draft for GraphSON4 and GraphBinary streaming draft (#2531) 443ca07987 is described below commit 443ca079878a6a687d8ec6d34d7c22aea7a2bec2 Author: Valentyn Kahamlyk AuthorDate: Thu Mar 28 21:14:27 2024 -0700 draft for GraphSON4 and GraphBinary streaming draft (#2531) --- .../gremlin/structure/io/binary/DataType.java | 1 + .../GraphSONVersion.java => binary/Marker.java}| 33 +- .../io/binary/TypeSerializerRegistry.java | 1 + .../io/binary/types/SingleTypeSerializer.java | 3 + .../structure/io/graphson/GraphSONMapper.java | 14 +- .../structure/io/graphson/GraphSONModule.java | 253 .../structure/io/graphson/GraphSONVersion.java | 3 +- .../apache/tinkerpop/gremlin/server/Context.java | 19 ++ .../server/handler/HttpGremlinEndpointHandler.java | 100 +- .../gremlin/server/handler/HttpHandlerUtil.java| 44 ++- .../server/GremlinServerHttpIntegrateTest.java | 135 - .../gremlin/util/message/ResponseMessage.java | 39 +++ .../ser/AbstractGraphSONMessageSerializerV2.java | 20 +- .../util/ser/GraphBinaryMessageSerializerV1.java | 12 +- .../util/ser/GraphBinaryMessageSerializerV4.java | 213 + .../util/ser/GraphSONMessageSerializerV4.java | 335 + .../gremlin/util/ser/MessageChunkSerializer.java | 36 +++ .../tinkerpop/gremlin/util/ser/SerTokens.java | 2 + .../tinkerpop/gremlin/util/ser/Serializers.java| 7 +- .../util/ser/GraphSONMessageSerializerV3Test.java | 10 +- .../util/ser/GraphSONMessageSerializerV4Test.java | 102 +++ .../binary/GraphBinaryMessageSerializerV4Test.java | 192 22 files changed, 1495 insertions(+), 79 deletions(-) diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java index e3fd09f16a..246a266fbe 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/DataType.java @@ -90,6 +90,7 @@ public enum DataType { ZONEOFFSET(0X8E), CUSTOM(0), +MARKER(0XFD), UNSPECIFIED_NULL(0XFE); private final int code; diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVersion.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/Marker.java similarity index 50% copy from gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVersion.java copy to gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/Marker.java index 9738496171..8f7beaab63 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONVersion.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/Marker.java @@ -16,31 +16,26 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.tinkerpop.gremlin.structure.io.graphson; -/** - * The set of available GraphSON versions. - * - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public enum GraphSONVersion { -V1_0(GraphSONModule.GraphSONModuleV1.build(), "1.0"), -V2_0(GraphSONModule.GraphSONModuleV2.build(), "2.0"), -V3_0(GraphSONModule.GraphSONModuleV3.build(), "3.0"); +package org.apache.tinkerpop.gremlin.structure.io.binary; + +public class Marker { +private final byte value; -private final GraphSONModule.GraphSONModuleBuilder builder; -private final String versionNumber; +public static Marker END_OF_STREAM = new Marker((byte)0); -GraphSONVersion(final GraphSONModule.GraphSONModuleBuilder builder, final String versionNumber) { -this.builder = builder; -this.versionNumber = versionNumber; +private Marker(final byte value) { +this.value = value; } -public GraphSONModule.GraphSONModuleBuilder getBuilder() { -return builder; +public byte getValue() { +return value; } -public String getVersion() { -return versionNumber; +public static Marker of(final byte value) { +if (value != 0) { +throw new IllegalArgumentException(); +} +return END_OF_STREAM; } } diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/TypeSerializerRegistry.java index 9958179318.
(tinkerpop) branch valentyn/streaming-serializers deleted (was d2cd239a0b)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch valentyn/streaming-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was d2cd239a0b draft for GraphSON4 and GraphBinary streaming draft The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) 01/02: Add HTTP request checker and return error for non-POST requests
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch request-message-serde in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 67deb40fbfd60e71104ea037857533bf8e4ef4bf Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Mar 21 23:25:58 2024 -0700 Add HTTP request checker and return error for non-POST requests --- .../gremlin/server/channel/HttpChannelizer.java| 5 + .../server/handler/HttpGremlinEndpointHandler.java | 15 +- .../server/handler/HttpRequestCheckingHandler.java | 61 +++ .../server/GremlinServerHttpIntegrateTest.java | 200 - 4 files changed, 106 insertions(+), 175 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java index 0a9842ba9d..5d5b3c97b5 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java @@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.server.auth.AllowAllAuthenticator; import org.apache.tinkerpop.gremlin.server.handler.AbstractAuthenticationHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthenticationHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthorizationHandler; +import org.apache.tinkerpop.gremlin.server.handler.HttpRequestCheckingHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpUserAgentHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler; import io.netty.channel.ChannelPipeline; @@ -47,6 +48,8 @@ public class HttpChannelizer extends AbstractChannelizer { private HttpGremlinEndpointHandler httpGremlinEndpointHandler; +private HttpRequestCheckingHandler httpRequestCheckingHandler = new HttpRequestCheckingHandler(); + @Override public void init(final ServerGremlinExecutor serverGremlinExecutor) { super.init(serverGremlinExecutor); @@ -67,6 +70,8 @@ public class HttpChannelizer extends AbstractChannelizer { aggregator.setMaxCumulationBufferComponents(settings.maxAccumulationBufferComponents); pipeline.addLast(PIPELINE_HTTP_AGGREGATOR, aggregator); +pipeline.addLast("http-request-checker", httpRequestCheckingHandler); + if (authenticator != null) { // Cannot add the same handler instance multiple times unless // it is marked as @Sharable, indicating a race condition will diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 3b990599db..1ccfac4837 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -199,24 +199,11 @@ public class HttpGremlinEndpointHandler extends ChannelInboundHandlerAdapter { final FullHttpRequest req = (FullHttpRequest) msg; final boolean keepAlive = HttpUtil.isKeepAlive(req); -// Chunked transfer encoding is used to stream back results so only accept HTTP/1.1 requests. -if (req.protocolVersion() != HTTP_1_1) { -HttpHandlerUtil.sendError(ctx, HTTP_VERSION_NOT_SUPPORTED, "Only HTTP/1.1 is supported.", keepAlive); -ReferenceCountUtil.release(msg); -return; -} - -if ("/favicon.ico".equals(req.uri())) { -HttpHandlerUtil.sendError(ctx, NOT_FOUND, "Gremlin Server doesn't have a favicon.ico", keepAlive); -ReferenceCountUtil.release(msg); -return; -} - if (HttpUtil.is100ContinueExpected(req)) { ctx.write(new DefaultFullHttpResponse(HTTP_1_1, CONTINUE)); } -if (req.method() != GET && req.method() != POST) { +if (req.method() != POST) { HttpHandlerUtil.sendError(ctx, METHOD_NOT_ALLOWED, METHOD_NOT_ALLOWED.toString(), keepAlive); ReferenceCountUtil.release(msg); return; diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestCheckingHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestCheckingHandler.java new file mode 100644 index 00..c118dddf56 --- /dev/null +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestCheckingHandler.java @@ -0,0 +1,61 @@ +/* + * Licensed to
(tinkerpop) 02/02: requestmessage serde with graphson/graphbinary
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch request-message-serde in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 169a9d002a50b62a3179a7703cce65cc89be3e5e Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon Mar 25 23:33:45 2024 -0700 requestmessage serde with graphson/graphbinary --- .../gremlin/server/handler/HttpHandlerUtil.java| 140 +- .../server/GremlinServerHttpIntegrateTest.java | 101 ++ .../server/handler/HttpHandlerUtilTest.java| 123 ++-- .../gremlin/server/gremlin-server-integration.yaml | 2 + .../org/apache/tinkerpop/gremlin/util/Tokens.java | 7 + .../gremlin/util/message/RequestMessageV4.java | 214 + ...=> AbstractGraphBinaryMessageSerializerV1.java} | 31 +-- .../util/ser/GraphBinaryMessageSerializerV1.java | 214 + .../util/ser/GraphBinaryMessageSerializerV4.java | 28 ++- .../util/ser/GraphSONMessageSerializerV4.java | 136 +++-- .../gremlin/util/ser/MessageTextSerializerV4.java | 44 + .../tinkerpop/gremlin/util/ser/SerTokens.java | 4 + .../tinkerpop/gremlin/util/ser/Serializers.java| 9 + .../ser/binary/RequestMessageSerializerV4.java | 130 + .../gremlin/util/message/RequestMessageV4Test.java | 120 15 files changed, 906 insertions(+), 397 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java index 5be5dd2b90..8dee72fec3 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java @@ -32,18 +32,18 @@ import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpUtil; -import io.netty.handler.codec.http.QueryStringDecoder; import io.netty.util.CharsetUtil; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.server.Context; import org.apache.tinkerpop.gremlin.server.GremlinServer; -import org.apache.tinkerpop.gremlin.server.op.standard.StandardOpProcessor; import org.apache.tinkerpop.gremlin.server.util.MetricManager; import org.apache.tinkerpop.gremlin.util.MessageSerializer; import org.apache.tinkerpop.gremlin.util.Tokens; import org.apache.tinkerpop.gremlin.util.message.RequestMessage; +import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4; import org.apache.tinkerpop.gremlin.util.message.ResponseMessage; import org.apache.tinkerpop.gremlin.util.ser.MessageChunkSerializer; +import org.apache.tinkerpop.gremlin.util.ser.MessageTextSerializerV4; import org.apache.tinkerpop.gremlin.util.ser.SerTokens; import org.apache.tinkerpop.gremlin.util.ser.SerializationException; import org.apache.tinkerpop.shaded.jackson.databind.JsonNode; @@ -59,14 +59,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; import static com.codahale.metrics.MetricRegistry.name; import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE; -import static io.netty.handler.codec.http.HttpMethod.GET; import static io.netty.handler.codec.http.HttpMethod.POST; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; import static io.netty.handler.codec.http.LastHttpContent.EMPTY_LAST_CONTENT; @@ -111,26 +109,31 @@ public class HttpHandlerUtil { if (request.method() == POST && contentType != null && !contentType.equals("application/json") && serializers.containsKey(contentType)) { final MessageSerializer serializer = serializers.get(contentType); - -final ByteBuf buffer = request.content(); - -// additional validation for header -final int first = buffer.readByte(); -// payload can be plain json or can start with additional header with content type. -// if first character is not "{" (0x7b) then need to verify is correct serializer selected. -if (first != 0x7b) { -final byte[] bytes = new byte[first]; -buffer.readBytes(bytes); -final String mimeType = new String(bytes, StandardCharsets.UTF_8); - -if (Arrays.stream(serializer.mimeTypesSupported()).noneMatch(t -> t.equals(mimeType))) -throw new IllegalArgumentException("Mime type mismatch. Value in content-type header is not equal payload header.&qu
(tinkerpop) branch request-message-serde created (now 169a9d002a)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch request-message-serde in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 169a9d002a requestmessage serde with graphson/graphbinary This branch includes the following new commits: new 67deb40fbf Add HTTP request checker and return error for non-POST requests new 169a9d002a requestmessage serde with graphson/graphbinary The 2 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.
(tinkerpop) branch request-message-serde updated (169a9d002a -> bc6db0d60e)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch request-message-serde in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard 169a9d002a requestmessage serde with graphson/graphbinary add bc6db0d60e requestmessage serde with graphson/graphbinary 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 (169a9d002a) \ N -- N -- N refs/heads/request-message-serde (bc6db0d60e) 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. No new revisions were added by this update. Summary of changes: .../gremlin/util/message/RequestMessageV4Test.java | 18 ++ 1 file changed, 18 insertions(+)
(tinkerpop) branch master-http updated (443ca07987 -> 85f3fc4b5b)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git from 443ca07987 draft for GraphSON4 and GraphBinary streaming draft (#2531) new 924f6bfb89 Add HTTP request checker and return error for non-POST requests new 85f3fc4b5b requestmessage serde with graphson/graphbinary The 2 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: .../gremlin/server/channel/HttpChannelizer.java| 5 + .../server/handler/HttpGremlinEndpointHandler.java | 15 +- .../gremlin/server/handler/HttpHandlerUtil.java| 140 -- .../server/handler/HttpRequestCheckingHandler.java | 61 + .../server/GremlinServerHttpIntegrateTest.java | 301 +++-- .../server/handler/HttpHandlerUtilTest.java| 123 +++-- .../gremlin/server/gremlin-server-integration.yaml | 2 + .../org/apache/tinkerpop/gremlin/util/Tokens.java | 7 + .../gremlin/util/message/RequestMessageV4.java | 214 +++ ...=> AbstractGraphBinaryMessageSerializerV1.java} | 31 ++- .../util/ser/GraphBinaryMessageSerializerV1.java | 214 +-- .../util/ser/GraphBinaryMessageSerializerV4.java | 28 +- .../util/ser/GraphSONMessageSerializerV4.java | 136 -- ...erializer.java => MessageTextSerializerV4.java} | 26 +- .../tinkerpop/gremlin/util/ser/SerTokens.java | 4 + .../tinkerpop/gremlin/util/ser/Serializers.java| 9 + .../ser/binary/RequestMessageSerializerV4.java | 130 + .../gremlin/util/message/RequestMessageV4Test.java | 138 ++ 18 files changed, 1003 insertions(+), 581 deletions(-) create mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestCheckingHandler.java create mode 100644 gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java copy gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/{GraphBinaryMessageSerializerV1.java => AbstractGraphBinaryMessageSerializerV1.java} (91%) copy gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/{MessageChunkSerializer.java => MessageTextSerializerV4.java} (53%) create mode 100644 gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/binary/RequestMessageSerializerV4.java create mode 100644 gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4Test.java
(tinkerpop) 02/02: requestmessage serde with graphson/graphbinary
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 85f3fc4b5be9a7ea27e9647dc520580938200cd4 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon Mar 25 23:33:45 2024 -0700 requestmessage serde with graphson/graphbinary --- .../gremlin/server/handler/HttpHandlerUtil.java| 140 +- .../server/GremlinServerHttpIntegrateTest.java | 101 ++ .../server/handler/HttpHandlerUtilTest.java| 123 ++-- .../gremlin/server/gremlin-server-integration.yaml | 2 + .../org/apache/tinkerpop/gremlin/util/Tokens.java | 7 + .../gremlin/util/message/RequestMessageV4.java | 214 + ...=> AbstractGraphBinaryMessageSerializerV1.java} | 31 +-- .../util/ser/GraphBinaryMessageSerializerV1.java | 214 + .../util/ser/GraphBinaryMessageSerializerV4.java | 28 ++- .../util/ser/GraphSONMessageSerializerV4.java | 136 +++-- .../gremlin/util/ser/MessageTextSerializerV4.java | 44 + .../tinkerpop/gremlin/util/ser/SerTokens.java | 4 + .../tinkerpop/gremlin/util/ser/Serializers.java| 9 + .../ser/binary/RequestMessageSerializerV4.java | 130 + .../gremlin/util/message/RequestMessageV4Test.java | 138 + 15 files changed, 924 insertions(+), 397 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java index 5be5dd2b90..8dee72fec3 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java @@ -32,18 +32,18 @@ import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpUtil; -import io.netty.handler.codec.http.QueryStringDecoder; import io.netty.util.CharsetUtil; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.server.Context; import org.apache.tinkerpop.gremlin.server.GremlinServer; -import org.apache.tinkerpop.gremlin.server.op.standard.StandardOpProcessor; import org.apache.tinkerpop.gremlin.server.util.MetricManager; import org.apache.tinkerpop.gremlin.util.MessageSerializer; import org.apache.tinkerpop.gremlin.util.Tokens; import org.apache.tinkerpop.gremlin.util.message.RequestMessage; +import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4; import org.apache.tinkerpop.gremlin.util.message.ResponseMessage; import org.apache.tinkerpop.gremlin.util.ser.MessageChunkSerializer; +import org.apache.tinkerpop.gremlin.util.ser.MessageTextSerializerV4; import org.apache.tinkerpop.gremlin.util.ser.SerTokens; import org.apache.tinkerpop.gremlin.util.ser.SerializationException; import org.apache.tinkerpop.shaded.jackson.databind.JsonNode; @@ -59,14 +59,12 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; import static com.codahale.metrics.MetricRegistry.name; import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE; -import static io.netty.handler.codec.http.HttpMethod.GET; import static io.netty.handler.codec.http.HttpMethod.POST; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; import static io.netty.handler.codec.http.LastHttpContent.EMPTY_LAST_CONTENT; @@ -111,26 +109,31 @@ public class HttpHandlerUtil { if (request.method() == POST && contentType != null && !contentType.equals("application/json") && serializers.containsKey(contentType)) { final MessageSerializer serializer = serializers.get(contentType); - -final ByteBuf buffer = request.content(); - -// additional validation for header -final int first = buffer.readByte(); -// payload can be plain json or can start with additional header with content type. -// if first character is not "{" (0x7b) then need to verify is correct serializer selected. -if (first != 0x7b) { -final byte[] bytes = new byte[first]; -buffer.readBytes(bytes); -final String mimeType = new String(bytes, StandardCharsets.UTF_8); - -if (Arrays.stream(serializer.mimeTypesSupported()).noneMatch(t -> t.equals(mimeType))) -throw new IllegalArgumentException("Mime type mismatch. Value in content-type header is not equal payload header."); -} else
(tinkerpop) branch request-message-serde deleted (was bc6db0d60e)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch request-message-serde in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was bc6db0d60e requestmessage serde with graphson/graphbinary The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) 01/02: Add HTTP request checker and return error for non-POST requests
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 924f6bfb89b012c9d453de645146399be9a58fff Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Mar 21 23:25:58 2024 -0700 Add HTTP request checker and return error for non-POST requests --- .../gremlin/server/channel/HttpChannelizer.java| 5 + .../server/handler/HttpGremlinEndpointHandler.java | 15 +- .../server/handler/HttpRequestCheckingHandler.java | 61 +++ .../server/GremlinServerHttpIntegrateTest.java | 200 - 4 files changed, 106 insertions(+), 175 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java index 0a9842ba9d..5d5b3c97b5 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java @@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.server.auth.AllowAllAuthenticator; import org.apache.tinkerpop.gremlin.server.handler.AbstractAuthenticationHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthenticationHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthorizationHandler; +import org.apache.tinkerpop.gremlin.server.handler.HttpRequestCheckingHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpUserAgentHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler; import io.netty.channel.ChannelPipeline; @@ -47,6 +48,8 @@ public class HttpChannelizer extends AbstractChannelizer { private HttpGremlinEndpointHandler httpGremlinEndpointHandler; +private HttpRequestCheckingHandler httpRequestCheckingHandler = new HttpRequestCheckingHandler(); + @Override public void init(final ServerGremlinExecutor serverGremlinExecutor) { super.init(serverGremlinExecutor); @@ -67,6 +70,8 @@ public class HttpChannelizer extends AbstractChannelizer { aggregator.setMaxCumulationBufferComponents(settings.maxAccumulationBufferComponents); pipeline.addLast(PIPELINE_HTTP_AGGREGATOR, aggregator); +pipeline.addLast("http-request-checker", httpRequestCheckingHandler); + if (authenticator != null) { // Cannot add the same handler instance multiple times unless // it is marked as @Sharable, indicating a race condition will diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 3b990599db..1ccfac4837 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -199,24 +199,11 @@ public class HttpGremlinEndpointHandler extends ChannelInboundHandlerAdapter { final FullHttpRequest req = (FullHttpRequest) msg; final boolean keepAlive = HttpUtil.isKeepAlive(req); -// Chunked transfer encoding is used to stream back results so only accept HTTP/1.1 requests. -if (req.protocolVersion() != HTTP_1_1) { -HttpHandlerUtil.sendError(ctx, HTTP_VERSION_NOT_SUPPORTED, "Only HTTP/1.1 is supported.", keepAlive); -ReferenceCountUtil.release(msg); -return; -} - -if ("/favicon.ico".equals(req.uri())) { -HttpHandlerUtil.sendError(ctx, NOT_FOUND, "Gremlin Server doesn't have a favicon.ico", keepAlive); -ReferenceCountUtil.release(msg); -return; -} - if (HttpUtil.is100ContinueExpected(req)) { ctx.write(new DefaultFullHttpResponse(HTTP_1_1, CONTINUE)); } -if (req.method() != GET && req.method() != POST) { +if (req.method() != POST) { HttpHandlerUtil.sendError(ctx, METHOD_NOT_ALLOWED, METHOD_NOT_ALLOWED.toString(), keepAlive); ReferenceCountUtil.release(msg); return; diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestCheckingHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestCheckingHandler.java new file mode 100644 index 00..c118dddf56 --- /dev/null +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestCheckingHandler.java @@ -0,0 +1,61 @@ +/* + * Licensed to
(tinkerpop) branch master-http updated: Fixes for g when not present, test issues, incorrect streaming.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 2f24cf98b1 Fixes for g when not present, test issues, incorrect streaming. 2f24cf98b1 is described below commit 2f24cf98b1eb1ad401b32c7634550e879a2a1112 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Fri Mar 29 14:32:41 2024 -0700 Fixes for g when not present, test issues, incorrect streaming. --- .../server/handler/HttpGremlinEndpointHandler.java | 11 - .../gremlin/server/handler/HttpHandlerUtil.java| 52 -- .../server/GremlinServerHttpIntegrateTest.java | 23 +++--- .../gremlin/util/message/RequestMessageV4.java | 5 +++ .../util/ser/GraphSONMessageSerializerV4.java | 13 +++--- 5 files changed, 58 insertions(+), 46 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 1ccfac4837..d615c5787a 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -212,7 +212,7 @@ public class HttpGremlinEndpointHandler extends ChannelInboundHandlerAdapter { final RequestMessage requestMessage; try { requestMessage = HttpHandlerUtil.getRequestMessageFromHttpRequest(req, serializers); -} catch (IllegalArgumentException|SerializationException ex) { +} catch (IllegalArgumentException|SerializationException|NullPointerException ex) { HttpHandlerUtil.sendError(ctx, BAD_REQUEST, ex.getMessage(), keepAlive); ReferenceCountUtil.release(msg); return; @@ -819,7 +819,14 @@ public class HttpGremlinEndpointHandler extends ChannelInboundHandlerAdapter { case NOT_STARTED: if (code == ResponseStatusCode.SUCCESS) { ctx.setRequestState(FINISHED); -return new Frame(chunkSerializer.writeHeader(responseMessage, nettyContext.alloc())); + +return new Frame(serializer.serializeResponseAsBinary(ResponseMessage.buildV4(msg.getRequestId()) +.statusAttributes(statusAttributes) +.responseMetaData(responseMetaData) +.result(aggregate) +.code(ResponseStatusCode.SUCCESS) +.statusMessage("OK") +.create(), nettyContext.alloc())); } ctx.setRequestState(STREAMING); diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java index 8dee72fec3..39fb04e9f8 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpHandlerUtil.java @@ -109,29 +109,33 @@ public class HttpHandlerUtil { if (request.method() == POST && contentType != null && !contentType.equals("application/json") && serializers.containsKey(contentType)) { final MessageSerializer serializer = serializers.get(contentType); -if (serializer instanceof MessageTextSerializerV4) { -final MessageTextSerializerV4 serializerV4 = (MessageTextSerializerV4) serializer; - -final ByteBuf buffer = request.content(); - -// additional validation for header -final int first = buffer.readByte(); -// payload can be plain json or can start with additional header with content type. -// if first character is not "{" (0x7b) then need to verify is correct serializer selected. -if (first != 0x7b) { -final byte[] bytes = new byte[first]; -buffer.readBytes(bytes); -final String mimeType = new String(bytes, StandardCharsets.UTF_8); - -if (Arrays.stream(serializer.mimeTypesSupported()).noneMatch(t -> t.equals(mimeType))) -throw new IllegalArgumentException("Mime type mismatch. Value in content-type header is not equal payload header."); -} else { -buffer.resetR
(tinkerpop) branch remove-opprocessor created (now cba0a2e79c)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch remove-opprocessor in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at cba0a2e79c Remove WebSockets from the server. This branch includes the following new commits: new f3597e1c4e Remove the OpProcessors and related classes. new cba0a2e79c Remove WebSockets from the server. The 2 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.
(tinkerpop) 02/02: Remove WebSockets from the server.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch remove-opprocessor in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit cba0a2e79cd688952015c4e47d332c005cbc6edd Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon Apr 1 23:32:03 2024 -0700 Remove WebSockets from the server. --- .../gremlin-server/gremlin-server-integration.yaml | 2 +- .../console/jsr223/gremlin-server-integration.yaml | 2 +- gremlin-server/conf/gremlin-server-neo4j.yaml | 2 +- gremlin-server/conf/gremlin-server-secure.yaml | 2 +- gremlin-server/conf/gremlin-server-spark.yaml | 2 +- .../conf/gremlin-server-transaction.yaml | 2 +- gremlin-server/conf/gremlin-server.yaml| 2 +- .../apache/tinkerpop/gremlin/server/Context.java | 10 -- .../apache/tinkerpop/gremlin/server/Settings.java | 4 +- .../server/channel/WebSocketChannelizer.java | 151 - .../server/channel/WsAndHttpChannelizer.java | 59 .../handler/GremlinResponseFrameEncoder.java | 100 -- .../server/handler/HttpUserAgentHandler.java | 5 +- .../SaslAndHttpBasicAuthenticationHandler.java | 67 - .../server/handler/SaslAuthenticationHandler.java | 3 +- .../handler/WebSocketAuthorizationHandler.java | 109 --- .../server/handler/WebSocketHandlerUtil.java | 39 -- .../handler/WsAndHttpChannelizerHandler.java | 107 --- .../handler/WsGremlinBinaryRequestDecoder.java | 93 - .../handler/WsGremlinCloseRequestDecoder.java | 91 - .../handler/WsGremlinResponseFrameEncoder.java | 44 -- .../handler/WsGremlinTextRequestDecoder.java | 77 --- .../gremlin/server/handler/WsUserAgentHandler.java | 75 -- .../server/GremlinServerAuditLogIntegrateTest.java | 4 +- .../server/GremlinServerAuthzIntegrateTest.java| 6 +- .../server/GremlinServerHttpIntegrateTest.java | 6 +- .../gremlin/server/GremlinServerIntegrateTest.java | 119 .../channel/HttpChannelizerIntegrateTest.java | 4 +- .../channel/WebSocketChannelizerIntegrateTest.java | 56 .../server/channel/WebSocketTestChannelizer.java | 48 --- .../channel/WsAndHttpChannelizerIntegrateTest.java | 58 .../server/channel/WsAndHttpTestChannelizer.java | 49 --- 32 files changed, 23 insertions(+), 1375 deletions(-) diff --git a/docker/gremlin-server/gremlin-server-integration.yaml b/docker/gremlin-server/gremlin-server-integration.yaml index 528e6bcaad..9a277cdaa3 100644 --- a/docker/gremlin-server/gremlin-server-integration.yaml +++ b/docker/gremlin-server/gremlin-server-integration.yaml @@ -18,7 +18,7 @@ host: 0.0.0.0 port: 45940 evaluationTimeout: 3 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer graphs: { graph: conf/tinkergraph-service.properties, immutable: conf/tinkergraph-service.properties, diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml index d422281e41..ca83f1ebe5 100644 --- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml +++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml @@ -18,7 +18,7 @@ host: localhost port: 45940 evaluationTimeout: 3 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer +channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer scriptEngines: { gremlin-groovy: { plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, diff --git a/gremlin-server/conf/gremlin-server-neo4j.yaml b/gremlin-server/conf/gremlin-server-neo4j.yaml index d2065a7919..7082b999d0 100644 --- a/gremlin-server/conf/gremlin-server-neo4j.yaml +++ b/gremlin-server/conf/gremlin-server-neo4j.yaml @@ -28,7 +28,7 @@ host: localhost port: 8182 evaluationTimeout: 3 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer +channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer graphs: { graph: conf/neo4j-empty.properties} scriptEngines: { diff --git a/gremlin-server/conf/gremlin-server-secure.yaml b/gremlin-server/conf/gremlin-server-secure.yaml index 388df5226c..6f16eb67ba 100644 --- a/gremlin-server/conf/gremlin-server-secure.yaml +++ b/gremlin-server/conf/gremlin-server-secure.yaml @@ -26,7 +26,7 @@ host: localhost port: 8182 evaluationTimeout: 3 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer +chann
(tinkerpop) branch master-http updated (7a0753327e -> de73622249)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git from 7a0753327e streaming untyped graphson (#2535) new 363815b5e2 Remove the OpProcessors and related classes. new de73622249 Remove WebSockets from the server. The 2 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: .../gremlin-server-integration-krb5.yaml | 3 - .../gremlin-server-integration-secure.yaml | 3 - .../gremlin-server/gremlin-server-integration.yaml | 5 +- .../console/jsr223/DriverRemoteAcceptor.java | 26 +- .../jsr223/DriverRemoteAcceptorIntegrateTest.java | 34 - .../console/jsr223/gremlin-server-integration.yaml | 5 +- gremlin-server/conf/gremlin-server-neo4j.yaml | 5 +- .../conf/gremlin-server-rest-secure.yaml | 3 - gremlin-server/conf/gremlin-server-secure.yaml | 5 +- gremlin-server/conf/gremlin-server-spark.yaml | 5 +- .../conf/gremlin-server-transaction.yaml | 5 +- gremlin-server/conf/gremlin-server.yaml| 5 +- .../gremlin/server/AbstractChannelizer.java| 22 - .../apache/tinkerpop/gremlin/server/Context.java | 10 - .../tinkerpop/gremlin/server/GremlinServer.java| 14 - .../tinkerpop/gremlin/server/OpProcessor.java | 52 -- ...ssorException.java => ProcessingException.java} | 6 +- .../apache/tinkerpop/gremlin/server/Settings.java | 38 +- .../gremlin/server/channel/HttpChannelizer.java| 6 - .../server/channel/WebSocketChannelizer.java | 151 - .../server/channel/WsAndHttpChannelizer.java | 59 -- .../handler/GremlinResponseFrameEncoder.java | 108 --- .../server/handler/HttpGremlinEndpointHandler.java | 41 +- .../server/handler/HttpUserAgentHandler.java | 5 +- .../gremlin/server/handler/OpExecutorHandler.java | 85 --- .../gremlin/server/handler/OpSelectorHandler.java | 113 .../SaslAndHttpBasicAuthenticationHandler.java | 67 -- .../server/handler/SaslAuthenticationHandler.java | 3 +- .../tinkerpop/gremlin/server/handler/StateKey.java | 6 - .../handler/WebSocketAuthorizationHandler.java | 109 --- .../server/handler/WebSocketHandlerUtil.java | 39 -- .../handler/WsAndHttpChannelizerHandler.java | 107 --- .../handler/WsGremlinBinaryRequestDecoder.java | 94 --- .../handler/WsGremlinCloseRequestDecoder.java | 92 --- .../handler/WsGremlinResponseFrameEncoder.java | 44 -- .../handler/WsGremlinTextRequestDecoder.java | 78 --- .../gremlin/server/handler/WsUserAgentHandler.java | 75 --- .../gremlin/server/op/AbstractEvalOpProcessor.java | 364 -- .../gremlin/server/op/AbstractOpProcessor.java | 341 -- .../tinkerpop/gremlin/server/op/OpLoader.java | 89 --- .../gremlin/server/op/session/Session.java | 273 .../server/op/session/SessionOpProcessor.java | 743 - .../server/op/standard/StandardOpProcessor.java| 163 - .../server/op/traversal/TraversalOpProcessor.java | 478 - ...org.apache.tinkerpop.gremlin.server.OpProcessor | 3 - .../AbstractGremlinServerIntegrationTest.java | 5 - .../gremlin/server/GremlinDriverIntegrateTest.java | 8 - .../server/GremlinServerAuditLogIntegrateTest.java | 4 +- .../server/GremlinServerAuthzIntegrateTest.java| 6 +- .../server/GremlinServerHttpIntegrateTest.java | 6 +- .../gremlin/server/GremlinServerIntegrateTest.java | 192 +- .../server/GremlinServerSessionIntegrateTest.java | 537 --- .../server/GremlinSessionTxIntegrateTest.java | 403 --- .../channel/HttpChannelizerIntegrateTest.java | 4 +- .../channel/WebSocketChannelizerIntegrateTest.java | 56 -- .../server/channel/WebSocketTestChannelizer.java | 48 -- .../channel/WsAndHttpChannelizerIntegrateTest.java | 58 -- .../server/channel/WsAndHttpTestChannelizer.java | 49 -- .../server/op/AbstractEvalOpProcessorTest.java | 70 -- .../gremlin/server/op/AbstractOpProcessorTest.java | 54 -- gremlin-server/src/test/resources/logback-test.xml | 2 - .../gremlin/server/gremlin-server-integration.yaml | 3 - 62 files changed, 51 insertions(+), 5436 deletions(-) delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/OpProcessor.java rename gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/{op/OpProcessorException.java => ProcessingException.java} (85%) delete mode 100644 gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/WebSocketChannelizer.java delete mode 100644 gremlin-server/src/main/java/org/apache/tinker
(tinkerpop) 02/02: Remove WebSockets from the server.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit de73622249fa0a1de3359d00778b227e1e9a7278 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon Apr 1 23:32:03 2024 -0700 Remove WebSockets from the server. --- .../gremlin-server/gremlin-server-integration.yaml | 2 +- .../console/jsr223/gremlin-server-integration.yaml | 2 +- gremlin-server/conf/gremlin-server-neo4j.yaml | 2 +- gremlin-server/conf/gremlin-server-secure.yaml | 2 +- gremlin-server/conf/gremlin-server-spark.yaml | 2 +- .../conf/gremlin-server-transaction.yaml | 2 +- gremlin-server/conf/gremlin-server.yaml| 2 +- .../apache/tinkerpop/gremlin/server/Context.java | 10 -- .../apache/tinkerpop/gremlin/server/Settings.java | 4 +- .../server/channel/WebSocketChannelizer.java | 151 - .../server/channel/WsAndHttpChannelizer.java | 59 .../handler/GremlinResponseFrameEncoder.java | 100 -- .../server/handler/HttpUserAgentHandler.java | 5 +- .../SaslAndHttpBasicAuthenticationHandler.java | 67 - .../server/handler/SaslAuthenticationHandler.java | 3 +- .../handler/WebSocketAuthorizationHandler.java | 109 --- .../server/handler/WebSocketHandlerUtil.java | 39 -- .../handler/WsAndHttpChannelizerHandler.java | 107 --- .../handler/WsGremlinBinaryRequestDecoder.java | 93 - .../handler/WsGremlinCloseRequestDecoder.java | 91 - .../handler/WsGremlinResponseFrameEncoder.java | 44 -- .../handler/WsGremlinTextRequestDecoder.java | 77 --- .../gremlin/server/handler/WsUserAgentHandler.java | 75 -- .../server/GremlinServerAuditLogIntegrateTest.java | 4 +- .../server/GremlinServerAuthzIntegrateTest.java| 6 +- .../server/GremlinServerHttpIntegrateTest.java | 6 +- .../gremlin/server/GremlinServerIntegrateTest.java | 119 .../channel/HttpChannelizerIntegrateTest.java | 4 +- .../channel/WebSocketChannelizerIntegrateTest.java | 56 .../server/channel/WebSocketTestChannelizer.java | 48 --- .../channel/WsAndHttpChannelizerIntegrateTest.java | 58 .../server/channel/WsAndHttpTestChannelizer.java | 49 --- 32 files changed, 23 insertions(+), 1375 deletions(-) diff --git a/docker/gremlin-server/gremlin-server-integration.yaml b/docker/gremlin-server/gremlin-server-integration.yaml index 528e6bcaad..9a277cdaa3 100644 --- a/docker/gremlin-server/gremlin-server-integration.yaml +++ b/docker/gremlin-server/gremlin-server-integration.yaml @@ -18,7 +18,7 @@ host: 0.0.0.0 port: 45940 evaluationTimeout: 3 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WsAndHttpChannelizer +channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer graphs: { graph: conf/tinkergraph-service.properties, immutable: conf/tinkergraph-service.properties, diff --git a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml index d422281e41..ca83f1ebe5 100644 --- a/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml +++ b/gremlin-console/src/test/resources/org/apache/tinkerpop/gremlin/console/jsr223/gremlin-server-integration.yaml @@ -18,7 +18,7 @@ host: localhost port: 45940 evaluationTimeout: 3 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer +channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer scriptEngines: { gremlin-groovy: { plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {}, diff --git a/gremlin-server/conf/gremlin-server-neo4j.yaml b/gremlin-server/conf/gremlin-server-neo4j.yaml index d2065a7919..7082b999d0 100644 --- a/gremlin-server/conf/gremlin-server-neo4j.yaml +++ b/gremlin-server/conf/gremlin-server-neo4j.yaml @@ -28,7 +28,7 @@ host: localhost port: 8182 evaluationTimeout: 3 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer +channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer graphs: { graph: conf/neo4j-empty.properties} scriptEngines: { diff --git a/gremlin-server/conf/gremlin-server-secure.yaml b/gremlin-server/conf/gremlin-server-secure.yaml index 388df5226c..6f16eb67ba 100644 --- a/gremlin-server/conf/gremlin-server-secure.yaml +++ b/gremlin-server/conf/gremlin-server-secure.yaml @@ -26,7 +26,7 @@ host: localhost port: 8182 evaluationTimeout: 3 -channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer +chann
(tinkerpop) branch remove-opprocessor deleted (was cba0a2e79c)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch remove-opprocessor in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was cba0a2e79c Remove WebSockets from the server. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) 01/01: Minimal changes to get gremlin-driver working with integration tests
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch java-driver-minimal-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 40994aea004c846cc73d51958114f0ddf0c1d132 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Apr 4 12:07:01 2024 -0700 Minimal changes to get gremlin-driver working with integration tests --- .../apache/tinkerpop/gremlin/driver/Client.java| 107 ++--- .../apache/tinkerpop/gremlin/driver/Cluster.java | 12 +- .../tinkerpop/gremlin/driver/Connection.java | 17 ++- .../tinkerpop/gremlin/driver/ConnectionPool.java | 8 +- .../gremlin/driver/LoadBalancingStrategy.java | 10 +- .../tinkerpop/gremlin/driver/RequestOptions.java | 6 +- .../apache/tinkerpop/gremlin/driver/ResultSet.java | 8 +- .../apache/tinkerpop/gremlin/driver/Settings.java | 10 +- .../driver/handler/HttpGremlinRequestEncoder.java | 11 +- .../gremlin/driver/simple/AbstractClient.java | 10 +- .../gremlin/driver/simple/SimpleClient.java| 14 +- ...{WebSocketClient.java => SimpleHttpClient.java} | 46 +++--- .../gremlin/driver/simple/WebSocketClient.java | 170 ++--- .../tinkerpop/gremlin/driver/ResultSetTest.java| 4 +- 14 files changed, 221 insertions(+), 212 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index 303269c5b4..88f935fd20 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -20,11 +20,11 @@ package org.apache.tinkerpop.gremlin.driver; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.util.Tokens; +import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.tinkerpop.gremlin.driver.exception.ConnectionException; import org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException; -import org.apache.tinkerpop.gremlin.util.message.RequestMessage; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; @@ -81,11 +81,11 @@ public abstract class Client { } /** - * Makes any initial changes to the builder and returns the constructed {@link RequestMessage}. Implementers + * Makes any initial changes to the builder and returns the constructed {@link RequestMessageV4}. Implementers * may choose to override this message to append data to the request before sending. By default, this method * will simply return the {@code builder} passed in by the caller. */ -public RequestMessage.Builder buildMessage(final RequestMessage.Builder builder) { +public RequestMessageV4.Builder buildMessage(final RequestMessageV4.Builder builder) { return builder; } @@ -97,7 +97,7 @@ public abstract class Client { /** * Chooses a {@link Connection} to write the message to. */ -protected abstract Connection chooseConnection(final RequestMessage msg) throws TimeoutException, ConnectionException; +protected abstract Connection chooseConnection(final RequestMessageV4 msg) throws TimeoutException, ConnectionException; /** * Asynchronous close of the {@code Client}. @@ -352,26 +352,25 @@ public abstract class Client { // need to call buildMessage() right away to get client specific configurations, that way request specific // ones can override as needed -final RequestMessage.Builder request = buildMessage(RequestMessage.build(Tokens.OPS_EVAL)) -.add(Tokens.ARGS_GREMLIN, gremlin) -.add(Tokens.ARGS_BATCH_SIZE, batchSize); +final RequestMessageV4.Builder request = buildMessage(RequestMessageV4.build(gremlin)) +.addChunkSize(batchSize); // apply settings if they were made available -options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); -options.getParameters().ifPresent(params -> request.addArg(Tokens.ARGS_BINDINGS, params)); -options.getAliases().ifPresent(aliases -> request.addArg(Tokens.ARGS_ALIASES, aliases)); +//options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); +options.getParameters().ifPresent(params -> request.addBindings(params)); +options.getAliases().ifPresent(aliases -> {if (aliases.get("g") != null) request.addG(aliases.get("g")); }); options.getOverrideRequestId().ifPresent(request::overrideRequestId); -
(tinkerpop) branch java-driver-minimal-http created (now 40994aea00)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch java-driver-minimal-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 40994aea00 Minimal changes to get gremlin-driver working with integration tests This branch includes the following new commits: new 40994aea00 Minimal changes to get gremlin-driver working with integration tests The 1 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.
(tinkerpop) branch java-driver-minimal-http updated (40994aea00 -> d1bbe2600b)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch java-driver-minimal-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard 40994aea00 Minimal changes to get gremlin-driver working with integration tests add d1bbe2600b Minimal changes to get gremlin-driver working with integration tests 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 (40994aea00) \ N -- N -- N refs/heads/java-driver-minimal-http (d1bbe2600b) 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. No new revisions were added by this update. Summary of changes: .../gremlin/util/message/RequestMessageV4.java | 26 +- 1 file changed, 10 insertions(+), 16 deletions(-)
(tinkerpop) branch java-driver-minimal-http updated (d1bbe2600b -> 26a7bd64b9)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch java-driver-minimal-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard d1bbe2600b Minimal changes to get gremlin-driver working with integration tests add 26a7bd64b9 Minimal changes to get gremlin-driver working with integration tests 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 (d1bbe2600b) \ N -- N -- N refs/heads/java-driver-minimal-http (26a7bd64b9) 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. No new revisions were added by this update. Summary of changes: .../server/handler/HttpGremlinEndpointHandler.java | 217 ++--- .../gremlin/server/handler/HttpHandlerUtil.java| 5 + .../driver/ClientConnectionIntegrateTest.java | 8 +- .../gremlin/server/GremlinDriverIntegrateTest.java | 72 ++--- .../gremlin/server/GremlinServerIntegrateTest.java | 342 ++--- .../server/GremlinServerSslIntegrateTest.java | 11 +- .../gremlin/server/TestClientFactory.java | 14 +- .../server/handler/HttpHandlerUtilTest.java| 4 +- 8 files changed, 315 insertions(+), 358 deletions(-)
(tinkerpop) branch java-driver-minimal-http deleted (was 26a7bd64b9)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch java-driver-minimal-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was 26a7bd64b9 Minimal changes to get gremlin-driver working with integration tests The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch master-http updated: Minimal changes to get gremlin-driver working with integration tests (#2543)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 88048316d6 Minimal changes to get gremlin-driver working with integration tests (#2543) 88048316d6 is described below commit 88048316d6ae916320a1a9dc4f09d18f24577ee2 Author: kenhuuu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Apr 4 13:56:40 2024 -0700 Minimal changes to get gremlin-driver working with integration tests (#2543) --- .../apache/tinkerpop/gremlin/driver/Client.java| 107 +++ .../apache/tinkerpop/gremlin/driver/Cluster.java | 12 +- .../tinkerpop/gremlin/driver/Connection.java | 17 +- .../tinkerpop/gremlin/driver/ConnectionPool.java | 8 +- .../gremlin/driver/LoadBalancingStrategy.java | 10 +- .../tinkerpop/gremlin/driver/RequestOptions.java | 6 +- .../apache/tinkerpop/gremlin/driver/ResultSet.java | 8 +- .../apache/tinkerpop/gremlin/driver/Settings.java | 10 +- .../driver/handler/HttpGremlinRequestEncoder.java | 11 +- .../gremlin/driver/simple/AbstractClient.java | 10 +- .../gremlin/driver/simple/SimpleClient.java| 14 +- ...{WebSocketClient.java => SimpleHttpClient.java} | 46 +-- .../gremlin/driver/simple/WebSocketClient.java | 170 +- .../tinkerpop/gremlin/driver/ResultSetTest.java| 4 +- .../server/handler/HttpGremlinEndpointHandler.java | 217 ++--- .../gremlin/server/handler/HttpHandlerUtil.java| 5 + .../driver/ClientConnectionIntegrateTest.java | 8 +- .../gremlin/server/GremlinDriverIntegrateTest.java | 72 ++--- .../gremlin/server/GremlinServerIntegrateTest.java | 342 ++--- .../server/GremlinServerSslIntegrateTest.java | 11 +- .../gremlin/server/TestClientFactory.java | 14 +- .../server/handler/HttpHandlerUtilTest.java| 4 +- .../gremlin/util/message/RequestMessageV4.java | 26 +- 23 files changed, 546 insertions(+), 586 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index 303269c5b4..88f935fd20 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -20,11 +20,11 @@ package org.apache.tinkerpop.gremlin.driver; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.util.Tokens; +import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.tinkerpop.gremlin.driver.exception.ConnectionException; import org.apache.tinkerpop.gremlin.driver.exception.NoHostAvailableException; -import org.apache.tinkerpop.gremlin.util.message.RequestMessage; import org.apache.tinkerpop.gremlin.process.traversal.Bytecode; import org.apache.tinkerpop.gremlin.process.traversal.Traversal; import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource; @@ -81,11 +81,11 @@ public abstract class Client { } /** - * Makes any initial changes to the builder and returns the constructed {@link RequestMessage}. Implementers + * Makes any initial changes to the builder and returns the constructed {@link RequestMessageV4}. Implementers * may choose to override this message to append data to the request before sending. By default, this method * will simply return the {@code builder} passed in by the caller. */ -public RequestMessage.Builder buildMessage(final RequestMessage.Builder builder) { +public RequestMessageV4.Builder buildMessage(final RequestMessageV4.Builder builder) { return builder; } @@ -97,7 +97,7 @@ public abstract class Client { /** * Chooses a {@link Connection} to write the message to. */ -protected abstract Connection chooseConnection(final RequestMessage msg) throws TimeoutException, ConnectionException; +protected abstract Connection chooseConnection(final RequestMessageV4 msg) throws TimeoutException, ConnectionException; /** * Asynchronous close of the {@code Client}. @@ -352,26 +352,25 @@ public abstract class Client { // need to call buildMessage() right away to get client specific configurations, that way request specific // ones can override as needed -final RequestMessage.Builder request = buildMessage(RequestMessage.build(Tokens.OPS_EVAL)) -.add(Tokens.ARGS_GREMLIN, gremlin) -.add(Tokens.ARGS_BATCH_SIZE, batchSize); +final RequestMessageV4.Builder request = buildMessage(RequestMessageV4.build(gremlin)) +.addChunkSize(batchSize); // apply settings if they
(tinkerpop) branch migrate-integrationtests-http created (now f47084c432)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch migrate-integrationtests-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at f47084c432 Split HTTP endpoint into several handlers and update to use RequestMessageV4 This branch includes the following new commits: new f47084c432 Split HTTP endpoint into several handlers and update to use RequestMessageV4 The 1 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.
(tinkerpop) branch migrate-integrationtests-http deleted (was f47084c432)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch migrate-integrationtests-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was f47084c432 Split HTTP endpoint into several handlers and update to use RequestMessageV4 The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch sasl-initial-authn created (now f1f39dca56)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch sasl-initial-authn in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at f1f39dca56 Fix nits in PR for TINKERPOP-3061 regarding sasl authentication. This branch includes the following new commits: new 543eee70b3 fix: failing authentication when multiple initially requests are executed concurrently new f1f39dca56 Fix nits in PR for TINKERPOP-3061 regarding sasl authentication. The 2 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.
(tinkerpop) 02/02: Fix nits in PR for TINKERPOP-3061 regarding sasl authentication.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch sasl-initial-authn in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit f1f39dca56964d03d3cfef0c21cd0ab7bcb4c407 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon Apr 8 14:28:11 2024 -0700 Fix nits in PR for TINKERPOP-3061 regarding sasl authentication. --- .../gremlin/driver/simple/AbstractClient.java | 15 +++-- .../server/handler/SaslAuthenticationHandler.java | 56 +- .../server/GremlinServerAuthIntegrateTest.java | 69 +- 3 files changed, 78 insertions(+), 62 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java index dfbbcef60a..c353f45c07 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java @@ -25,9 +25,12 @@ import io.netty.channel.nio.NioEventLoopGroup; import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.apache.tinkerpop.gremlin.util.message.RequestMessage; import org.apache.tinkerpop.gremlin.util.message.ResponseMessage; -import org.apache.tinkerpop.gremlin.util.message.ResponseStatusCode; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; @@ -48,7 +51,7 @@ public abstract class AbstractClient implements SimpleClient { @Override public void submit(final RequestMessage requestMessage, final Consumer callback) throws Exception { -callbackResponseHandler.callback.put(requestMessage.getRequestId(), callback); + callbackResponseHandler.callbackByRequestId.put(requestMessage.getRequestId(), callback); writeAndFlush(requestMessage); } @@ -64,7 +67,7 @@ public abstract class AbstractClient implements SimpleClient { public CompletableFuture> submitAsync(final RequestMessage requestMessage) throws Exception { final List results = new ArrayList<>(); final CompletableFuture> f = new CompletableFuture<>(); -callbackResponseHandler.callback.put(requestMessage.getRequestId(), response -> { + callbackResponseHandler.callbackByRequestId.put(requestMessage.getRequestId(), response -> { if (f.isDone()) throw new RuntimeException("A terminating message was already encountered - no more messages should have been received"); @@ -82,11 +85,11 @@ public abstract class AbstractClient implements SimpleClient { } static class CallbackResponseHandler extends SimpleChannelInboundHandler { -public Map> callback = new HashMap<>(); +public Map> callbackByRequestId = new HashMap<>(); @Override protected void channelRead0(final ChannelHandlerContext channelHandlerContext, final ResponseMessage response) throws Exception { -callback.get(response.getRequestId()).accept(response); +callbackByRequestId.get(response.getRequestId()).accept(response); } } } diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java index 4e4fdd8af6..34345ecf5e 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/SaslAuthenticationHandler.java @@ -108,16 +108,14 @@ public class SaslAuthenticationHandler extends AbstractAuthenticationHandler { authenticator.getClass().getSimpleName()), ex); respondWithError( -requestMessage, -builder -> builder.statusMessage("Authenticator is not ready to handle requests").code(ResponseStatusCode.SERVER_ERROR), -ctx); +requestMessage, +builder -> builder.statusMessage("Authenticator is not ready to handle requests").code(ResponseStatusCode.SERVER_ERROR), +ctx); } return; -} - -// If authentication negotiation is pending, store subsequent non-authentication requests for later processing -if (negotiator.get() != null && !requestMessage.getOp().equals(Tokens.OPS_AUTHENTICATION)) { +} else if (!requestMessage.getOp().equals(T
(tinkerpop) 01/02: fix: failing authentication when multiple initially requests are executed concurrently
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch sasl-initial-authn in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 543eee70b32bf5778f31cc8138caee0165540703 Author: Tiến Nguyễn Khắc AuthorDate: Sun Mar 17 00:00:07 2024 +1300 fix: failing authentication when multiple initially requests are executed concurrently --- CHANGELOG.asciidoc | 1 + .../gremlin/driver/simple/AbstractClient.java | 13 +- .../test/integration/sasl-authentication-tests.js | 13 ++ .../server/handler/SaslAuthenticationHandler.java | 259 + .../tinkerpop/gremlin/server/handler/StateKey.java | 9 + .../server/GremlinServerAuthIntegrateTest.java | 72 +- 6 files changed, 252 insertions(+), 115 deletions(-) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index ec23b0fc92..652a0d7215 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima * Deprecated `ltrim()` and `rTrim()` in favor of `l_trim()` and `r_trim` in Python. * Fixed bug in `onCreate` for `mergeV()` where use of the `Cardinality` functions was not properly handled. +* Fixed multiple concurrent initially requests caused authentication to fail. [[release-3-7-1]] === TinkerPop 3.7.1 (November 20, 2023) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java index 00a67b42eb..dfbbcef60a 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/AbstractClient.java @@ -27,8 +27,7 @@ import org.apache.tinkerpop.gremlin.util.message.RequestMessage; import org.apache.tinkerpop.gremlin.util.message.ResponseMessage; import org.apache.tinkerpop.gremlin.util.message.ResponseStatusCode; -import java.util.ArrayList; -import java.util.List; +import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; @@ -49,7 +48,7 @@ public abstract class AbstractClient implements SimpleClient { @Override public void submit(final RequestMessage requestMessage, final Consumer callback) throws Exception { -callbackResponseHandler.callback = callback; +callbackResponseHandler.callback.put(requestMessage.getRequestId(), callback); writeAndFlush(requestMessage); } @@ -65,7 +64,7 @@ public abstract class AbstractClient implements SimpleClient { public CompletableFuture> submitAsync(final RequestMessage requestMessage) throws Exception { final List results = new ArrayList<>(); final CompletableFuture> f = new CompletableFuture<>(); -callbackResponseHandler.callback = response -> { +callbackResponseHandler.callback.put(requestMessage.getRequestId(), response -> { if (f.isDone()) throw new RuntimeException("A terminating message was already encountered - no more messages should have been received"); @@ -75,7 +74,7 @@ public abstract class AbstractClient implements SimpleClient { if (response.getStatus().getCode().isFinalResponse()) { f.complete(results); } -}; +}); writeAndFlush(requestMessage); @@ -83,11 +82,11 @@ public abstract class AbstractClient implements SimpleClient { } static class CallbackResponseHandler extends SimpleChannelInboundHandler { -public Consumer callback; +public Map> callback = new HashMap<>(); @Override protected void channelRead0(final ChannelHandlerContext channelHandlerContext, final ResponseMessage response) throws Exception { -callback.accept(response); +callback.get(response.getRequestId()).accept(response); } } } diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js index 1fa5850cc2..3d2b937666 100644 --- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js +++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/integration/sasl-authentication-tests.js @@ -54,6 +54,19 @@ describe('DriverRemoteConnection', function () { }); }); + it('should be able to send multiple requests concurrently with valid credentials and parse the response', async function () { +connection = helper.getSecureConnectionWithPlainTextSaslAuthenticator(null, 'step
(tinkerpop) branch valentyn/update-response-format deleted (was 5c4d374099)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch valentyn/update-response-format in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was 5c4d374099 ... The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch master-http updated: update response format (#2564)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 5343b685d5 update response format (#2564) 5343b685d5 is described below commit 5343b685d5aaec03a359f69b6693865d5170d7a8 Author: Valentyn Kahamlyk AuthorDate: Wed Apr 17 16:42:03 2024 -0700 update response format (#2564) - Co-authored-by: Valentyn Kahamlyk --- .../server/handler/HttpGremlinEndpointHandler.java | 4 +- .../gremlin/util/message/ResponseMessage.java | 31 +-- .../gremlin/util/message/ResponseStatus.java | 19 +- .../ser/AbstractGraphSONMessageSerializerV4.java | 7 ++-- .../util/ser/GraphBinaryMessageSerializerV4.java | 33 +++- .../tinkerpop/gremlin/util/ser/SerTokens.java | 1 + .../util/ser/GraphSONMessageSerializerV4Test.java | 44 -- .../GraphSONUntypedMessageSerializerV4Test.java| 37 ++ .../binary/GraphBinaryMessageSerializerV4Test.java | 27 +++-- 9 files changed, 101 insertions(+), 102 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 2fc63afcc2..a6909e908a 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -617,7 +617,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler attributes = Collections.emptyMap(); private Map metaData = Collections.emptyMap(); +private Builder() { +requestId = null; +} + private Builder(final RequestMessage requestMessage) { this.requestId = requestMessage.getRequestId(); } @@ -140,13 +149,6 @@ public final class ResponseMessage { this.requestId = requestId; } -// builder for TP4 -private Builder(final UUID requestId, final boolean v4) { -this.requestId = requestId; -this.code = null; -this.statusMessage = null; -} - public Builder code(final ResponseStatusCode code) { this.code = code; return this; @@ -157,6 +159,11 @@ public final class ResponseMessage { return this; } +public Builder exception(final String exception) { +this.exception = exception; +return this; +} + public Builder statusAttributes(final Map attributes) { this.attributes = attributes; return this; @@ -192,7 +199,7 @@ public final class ResponseMessage { if (code == null && statusMessage == null) { return new ResponseMessage(requestId, null, responseResult); } -final ResponseStatus responseStatus = new ResponseStatus(code, statusMessage, attributes); +final ResponseStatus responseStatus = new ResponseStatus(code, statusMessage, exception); return new ResponseMessage(requestId, responseStatus, responseResult); } } diff --git a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseStatus.java b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseStatus.java index dbc2995085..4bc2ca6ecb 100644 --- a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseStatus.java +++ b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/ResponseStatus.java @@ -18,6 +18,7 @@ */ package org.apache.tinkerpop.gremlin.util.message; +import java.util.Collections; import java.util.Map; /** @@ -26,12 +27,21 @@ import java.util.Map; public final class ResponseStatus { private final ResponseStatusCode code; private final String message; +private final String exception; private final Map attributes; public ResponseStatus(final ResponseStatusCode code, final String message, final Map attributes) { this.code = code; this.message = message; this.attributes = attributes; +this.exception = null; +} + +public ResponseStatus(final ResponseStatusCode code, final String message, final String exception) { +this.code = code; +this.message = message; +this.exception = exception; +this.attributes = Collections.emptyMap(); } /** @@ -48,6 +58,13 @@ public final class ResponseStatus { return message; } +/** + * Gets the exception in case of error. + */ +public String getException() { +return e
(tinkerpop) 01/01: Introduce Netty handler for managing request IDs.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-req-id-header in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 66109d536cfe7cf06d782191adb53044aa74d46a Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Wed Apr 17 16:44:24 2024 -0700 Introduce Netty handler for managing request IDs. Request IDs are now generated by the server and returned as a header. This handler handles both of these operations to centralize the implementation. --- .../apache/tinkerpop/gremlin/driver/Client.java| 4 +- .../gremlin/server/channel/HttpChannelizer.java| 4 ++ .../server/handler/HttpGremlinEndpointHandler.java | 41 +-- .../gremlin/server/handler/HttpHandlerUtil.java| 3 +- .../server/handler/HttpRequestIdHandler.java | 50 + .../server/handler/HttpRequestMessageDecoder.java | 5 +- .../tinkerpop/gremlin/server/handler/StateKey.java | 7 ++ .../server/GremlinServerHttpIntegrateTest.java | 35 + .../server/handler/HttpRequestIdHandlerTest.java | 82 ++ .../handler/HttpRequestMessageDecoderTest.java | 8 +-- .../org/apache/tinkerpop/gremlin/util/Tokens.java | 3 +- .../gremlin/util/message/RequestMessageV4.java | 12 +--- .../gremlin/util/message/ResponseMessage.java | 4 -- .../ser/AbstractGraphSONMessageSerializerV4.java | 3 - .../ser/binary/RequestMessageSerializerV4.java | 3 - .../gremlin/util/message/RequestMessageV4Test.java | 11 +-- 16 files changed, 196 insertions(+), 79 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index 88f935fd20..bc718945c0 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -359,7 +359,7 @@ public abstract class Client { //options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); options.getParameters().ifPresent(params -> request.addBindings(params)); options.getAliases().ifPresent(aliases -> {if (aliases.get("g") != null) request.addG(aliases.get("g")); }); -options.getOverrideRequestId().ifPresent(request::overrideRequestId); +//options.getOverrideRequestId().ifPresent(request::overrideRequestId); //options.getUserAgent().ifPresent(userAgent -> request.addArg(Tokens.ARGS_USER_AGENT, userAgent)); options.getLanguage().ifPresent(lang -> request.addLanguage(lang)); //options.getMaterializeProperties().ifPresent(mp -> request.addArg(Tokens.ARGS_MATERIALIZE_PROPERTIES, mp)); @@ -656,7 +656,7 @@ public abstract class Client { // apply settings if they were made available options.getBatchSize().ifPresent(batchSize -> request.addChunkSize(batchSize)); //options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); - options.getOverrideRequestId().ifPresent(request::overrideRequestId); +// options.getOverrideRequestId().ifPresent(request::overrideRequestId); //options.getUserAgent().ifPresent(userAgent -> request.add(Tokens.ARGS_USER_AGENT, userAgent)); //options.getMaterializeProperties().ifPresent(mp -> request.addArg(Tokens.ARGS_MATERIALIZE_PROPERTIES, mp)); diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java index 4d631bfdd0..e512e993fa 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java @@ -30,6 +30,7 @@ import org.apache.tinkerpop.gremlin.server.handler.AbstractAuthenticationHandler import org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthenticationHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthorizationHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpRequestCheckingHandler; +import org.apache.tinkerpop.gremlin.server.handler.HttpRequestIdHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpRequestMessageDecoder; import org.apache.tinkerpop.gremlin.server.handler.HttpUserAgentHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler; @@ -55,6 +56,8 @@ public class HttpChannelizer extends AbstractChannelizer { private HttpRequestCheckingHandler httpRequestCheckingHandler = new HttpRequestCheckingHandler(); private HttpRequestMessageDecoder httpRequestMessageDecoder = new
(tinkerpop) branch http-req-id-header created (now 66109d536c)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-req-id-header in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 66109d536c Introduce Netty handler for managing request IDs. This branch includes the following new commits: new 66109d536c Introduce Netty handler for managing request IDs. The 1 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.
(tinkerpop) branch http-req-id-header deleted (was 66109d536c)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-req-id-header in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was 66109d536c Introduce Netty handler for managing request IDs. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch master-http updated: Introduce Netty handler for managing request IDs.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new fe6fd0dba6 Introduce Netty handler for managing request IDs. fe6fd0dba6 is described below commit fe6fd0dba6514134079f72ad1fedcde0fad23584 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Wed Apr 17 16:44:24 2024 -0700 Introduce Netty handler for managing request IDs. Request IDs are now generated by the server and returned as a header. This handler handles both of these operations to centralize the implementation. --- .../apache/tinkerpop/gremlin/driver/Client.java| 4 +- .../gremlin/server/channel/HttpChannelizer.java| 4 ++ .../server/handler/HttpGremlinEndpointHandler.java | 41 +-- .../gremlin/server/handler/HttpHandlerUtil.java| 3 +- .../server/handler/HttpRequestIdHandler.java | 50 + .../server/handler/HttpRequestMessageDecoder.java | 5 +- .../tinkerpop/gremlin/server/handler/StateKey.java | 7 ++ .../server/GremlinServerHttpIntegrateTest.java | 35 + .../server/handler/HttpRequestIdHandlerTest.java | 82 ++ .../handler/HttpRequestMessageDecoderTest.java | 8 +-- .../org/apache/tinkerpop/gremlin/util/Tokens.java | 3 +- .../gremlin/util/message/RequestMessageV4.java | 12 +--- .../gremlin/util/message/ResponseMessage.java | 4 -- .../ser/AbstractGraphSONMessageSerializerV4.java | 3 - .../ser/binary/RequestMessageSerializerV4.java | 3 - .../gremlin/util/message/RequestMessageV4Test.java | 11 +-- 16 files changed, 196 insertions(+), 79 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index 88f935fd20..bc718945c0 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -359,7 +359,7 @@ public abstract class Client { //options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); options.getParameters().ifPresent(params -> request.addBindings(params)); options.getAliases().ifPresent(aliases -> {if (aliases.get("g") != null) request.addG(aliases.get("g")); }); -options.getOverrideRequestId().ifPresent(request::overrideRequestId); +//options.getOverrideRequestId().ifPresent(request::overrideRequestId); //options.getUserAgent().ifPresent(userAgent -> request.addArg(Tokens.ARGS_USER_AGENT, userAgent)); options.getLanguage().ifPresent(lang -> request.addLanguage(lang)); //options.getMaterializeProperties().ifPresent(mp -> request.addArg(Tokens.ARGS_MATERIALIZE_PROPERTIES, mp)); @@ -656,7 +656,7 @@ public abstract class Client { // apply settings if they were made available options.getBatchSize().ifPresent(batchSize -> request.addChunkSize(batchSize)); //options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); - options.getOverrideRequestId().ifPresent(request::overrideRequestId); +// options.getOverrideRequestId().ifPresent(request::overrideRequestId); //options.getUserAgent().ifPresent(userAgent -> request.add(Tokens.ARGS_USER_AGENT, userAgent)); //options.getMaterializeProperties().ifPresent(mp -> request.addArg(Tokens.ARGS_MATERIALIZE_PROPERTIES, mp)); diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java index 4d631bfdd0..e512e993fa 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java @@ -30,6 +30,7 @@ import org.apache.tinkerpop.gremlin.server.handler.AbstractAuthenticationHandler import org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthenticationHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpBasicAuthorizationHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpRequestCheckingHandler; +import org.apache.tinkerpop.gremlin.server.handler.HttpRequestIdHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpRequestMessageDecoder; import org.apache.tinkerpop.gremlin.server.handler.HttpUserAgentHandler; import org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler; @@ -55,6 +56,8 @@ public class HttpChannelizer extends AbstractChannelizer { private Htt
(tinkerpop) branch http-update-req-3 created (now d41b5666fc)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-update-req-3 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at d41b5666fc Add back evaluationTimeout and materializeProperties This branch includes the following new commits: new d41b5666fc Add back evaluationTimeout and materializeProperties The 1 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.
(tinkerpop) 01/01: Add back evaluationTimeout and materializeProperties
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-update-req-3 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit d41b5666fc3ceec31c7b0c030721660abd6184cd Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Apr 18 08:59:10 2024 -0700 Add back evaluationTimeout and materializeProperties evaluationTimeout and materializeProperties should be allowed to be set from the request body as it affects how the server should execute the query. --- .../apache/tinkerpop/gremlin/driver/Client.java| 8 +- .../tinkerpop/gremlin/driver/RequestOptions.java | 6 +- .../apache/tinkerpop/gremlin/server/Context.java | 11 +- .../server/handler/HttpGremlinEndpointHandler.java | 3 +- .../server/handler/HttpRequestMessageDecoder.java | 19 +- .../server/GremlinServerHttpIntegrateTest.java | 68 ++- .../gremlin/server/GremlinServerIntegrateTest.java | 224 ++--- .../gremlin/util/message/RequestMessageV4.java | 18 ++ .../gremlin/util/message/RequestMessageV4Test.java | 26 +++ 9 files changed, 250 insertions(+), 133 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index bc718945c0..1bf3c1dbb8 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -356,13 +356,13 @@ public abstract class Client { .addChunkSize(batchSize); // apply settings if they were made available -//options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); +options.getTimeout().ifPresent(timeout -> request.addTimeoutMillis(timeout)); options.getParameters().ifPresent(params -> request.addBindings(params)); options.getAliases().ifPresent(aliases -> {if (aliases.get("g") != null) request.addG(aliases.get("g")); }); //options.getOverrideRequestId().ifPresent(request::overrideRequestId); //options.getUserAgent().ifPresent(userAgent -> request.addArg(Tokens.ARGS_USER_AGENT, userAgent)); options.getLanguage().ifPresent(lang -> request.addLanguage(lang)); -//options.getMaterializeProperties().ifPresent(mp -> request.addArg(Tokens.ARGS_MATERIALIZE_PROPERTIES, mp)); +options.getMaterializeProperties().ifPresent(mp -> request.addMaterializeProperties(mp)); return submitAsync(request.create()); } @@ -655,10 +655,10 @@ public abstract class Client { // apply settings if they were made available options.getBatchSize().ifPresent(batchSize -> request.addChunkSize(batchSize)); -//options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); +options.getTimeout().ifPresent(timeout -> request.addTimeoutMillis(timeout)); // options.getOverrideRequestId().ifPresent(request::overrideRequestId); //options.getUserAgent().ifPresent(userAgent -> request.add(Tokens.ARGS_USER_AGENT, userAgent)); -//options.getMaterializeProperties().ifPresent(mp -> request.addArg(Tokens.ARGS_MATERIALIZE_PROPERTIES, mp)); +options.getMaterializeProperties().ifPresent(mp -> request.addMaterializeProperties(mp)); return submitAsync(request.create()); } catch (RuntimeException re) { diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java index 3f66e2fbb0..63d7dad91a 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java @@ -41,7 +41,7 @@ public final class RequestOptions { private final UUID overrideRequestId; private final String userAgent; private final String language; -//private final String materializeProperties; +private final String materializeProperties; private RequestOptions(final Builder builder) { this.aliases = builder.aliases; @@ -51,7 +51,7 @@ public final class RequestOptions { this.overrideRequestId = builder.overrideRequestId; this.userAgent = builder.userAgent; this.language = builder.language; -//this.materializeProperties = builder.materializeProperties; +this.materializeProperties = builder.materializeProperties; } public Optional getOverrideRequestId() { @@ -82,7 +82,7 @@ public final class RequestOptions { return Optional.ofNullable(language); } -//publ
(tinkerpop) branch http-update-req-3 updated (d41b5666fc -> e7f31ab796)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-update-req-3 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git omit d41b5666fc Add back evaluationTimeout and materializeProperties add e7f31ab796 Add back evaluationTimeout and materializeProperties 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 (d41b5666fc) \ N -- N -- N refs/heads/http-update-req-3 (e7f31ab796) 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. No new revisions were added by this update. Summary of changes: .../src/main/java/org/apache/tinkerpop/gremlin/server/Context.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
(tinkerpop) branch master-http updated: Add back evaluationTimeout and materializeProperties
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 5ebc359e90 Add back evaluationTimeout and materializeProperties 5ebc359e90 is described below commit 5ebc359e908bc80da803927d04af1130a053aa76 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Apr 18 08:59:10 2024 -0700 Add back evaluationTimeout and materializeProperties evaluationTimeout and materializeProperties should be allowed to be set from the request body as it affects how the server should execute the query. --- .../apache/tinkerpop/gremlin/driver/Client.java| 8 +- .../tinkerpop/gremlin/driver/RequestOptions.java | 6 +- .../apache/tinkerpop/gremlin/server/Context.java | 11 +- .../server/handler/HttpGremlinEndpointHandler.java | 3 +- .../server/handler/HttpRequestMessageDecoder.java | 19 +- .../server/GremlinServerHttpIntegrateTest.java | 68 ++- .../gremlin/server/GremlinServerIntegrateTest.java | 224 ++--- .../gremlin/util/message/RequestMessageV4.java | 18 ++ .../gremlin/util/message/RequestMessageV4Test.java | 26 +++ 9 files changed, 250 insertions(+), 133 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index bc718945c0..1bf3c1dbb8 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -356,13 +356,13 @@ public abstract class Client { .addChunkSize(batchSize); // apply settings if they were made available -//options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); +options.getTimeout().ifPresent(timeout -> request.addTimeoutMillis(timeout)); options.getParameters().ifPresent(params -> request.addBindings(params)); options.getAliases().ifPresent(aliases -> {if (aliases.get("g") != null) request.addG(aliases.get("g")); }); //options.getOverrideRequestId().ifPresent(request::overrideRequestId); //options.getUserAgent().ifPresent(userAgent -> request.addArg(Tokens.ARGS_USER_AGENT, userAgent)); options.getLanguage().ifPresent(lang -> request.addLanguage(lang)); -//options.getMaterializeProperties().ifPresent(mp -> request.addArg(Tokens.ARGS_MATERIALIZE_PROPERTIES, mp)); +options.getMaterializeProperties().ifPresent(mp -> request.addMaterializeProperties(mp)); return submitAsync(request.create()); } @@ -655,10 +655,10 @@ public abstract class Client { // apply settings if they were made available options.getBatchSize().ifPresent(batchSize -> request.addChunkSize(batchSize)); -//options.getTimeout().ifPresent(timeout -> request.add(Tokens.ARGS_EVAL_TIMEOUT, timeout)); +options.getTimeout().ifPresent(timeout -> request.addTimeoutMillis(timeout)); // options.getOverrideRequestId().ifPresent(request::overrideRequestId); //options.getUserAgent().ifPresent(userAgent -> request.add(Tokens.ARGS_USER_AGENT, userAgent)); -//options.getMaterializeProperties().ifPresent(mp -> request.addArg(Tokens.ARGS_MATERIALIZE_PROPERTIES, mp)); +options.getMaterializeProperties().ifPresent(mp -> request.addMaterializeProperties(mp)); return submitAsync(request.create()); } catch (RuntimeException re) { diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java index 3f66e2fbb0..63d7dad91a 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java @@ -41,7 +41,7 @@ public final class RequestOptions { private final UUID overrideRequestId; private final String userAgent; private final String language; -//private final String materializeProperties; +private final String materializeProperties; private RequestOptions(final Builder builder) { this.aliases = builder.aliases; @@ -51,7 +51,7 @@ public final class RequestOptions { this.overrideRequestId = builder.overrideRequestId; this.userAgent = builder.userAgent; this.language = builder.language; -//this.materializeProperties = builder.materializeProperties; +this.materializeProperties = builder.materializeProperties; }
(tinkerpop) branch http-update-req-3 deleted (was e7f31ab796)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-update-req-3 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was e7f31ab796 Add back evaluationTimeout and materializeProperties The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) 01/02: Remove RequestId from RequestMessageV4 CTR
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit c0612dd806b6d6cdc98ed6f66c617bb5fff7e137 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Fri Apr 19 15:24:32 2024 -0700 Remove RequestId from RequestMessageV4 CTR --- .../gremlin/server/handler/HttpRequestMessageDecoderTest.java | 1 - .../apache/tinkerpop/gremlin/util/message/RequestMessageV4.java| 7 --- .../tinkerpop/gremlin/util/message/RequestMessageV4Test.java | 6 ++ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestMessageDecoderTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestMessageDecoderTest.java index f3c421c28e..5b23fa634e 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestMessageDecoderTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestMessageDecoderTest.java @@ -368,6 +368,5 @@ public class HttpRequestMessageDecoderTest { assertEquals("gmodern", decodedRequest.getField(Tokens.ARGS_G)); assertEquals("1", ((Map) decodedRequest.getField(Tokens.ARGS_BINDINGS)).get("x")); assertEquals(1, ((Map) decodedRequest.getField(Tokens.ARGS_BINDINGS)).size()); -assertEquals(rid, decodedRequest.getField(Tokens.REQUEST_ID)); } } diff --git a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java index a0afeb5779..101f32e22b 100644 --- a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java +++ b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java @@ -49,12 +49,6 @@ public final class RequestMessageV4 { throw new IllegalArgumentException("gremlin argument for RequestMessage must be either String or Bytecode"); } -Object requestId = fields.get(Tokens.REQUEST_ID); -if (null == requestId) throw new IllegalArgumentException("RequestMessage requires a requestId"); -if (!(requestId instanceof UUID)) { -throw new IllegalArgumentException("requestId argument for RequestMessage must be a UUID"); -} - this.gremlin = gremlin; this.fields = fields; @@ -149,7 +143,6 @@ public final class RequestMessageV4 { private Builder(final Object gremlin) { this.gremlin = gremlin; -this.fields.put(Tokens.REQUEST_ID, UUID.randomUUID()); } public Builder addLanguage(final String language) { diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4Test.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4Test.java index d121524f72..7e46afbc2f 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4Test.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/message/RequestMessageV4Test.java @@ -152,4 +152,10 @@ public class RequestMessageV4Test { final RequestMessageV4 msg = RequestMessageV4.build(query).create(); assertTrue(null == msg.getField(Tokens.ARGS_GREMLIN)); } + +@Test +public void shouldNotContainRequestId() { +final RequestMessageV4 msg = RequestMessageV4.build("g.V()").create(); +assertTrue(null == msg.getField(Tokens.REQUEST_ID)); +} }
(tinkerpop) 02/02: Renamed "evaluationTimeout" to "timeoutMs" in RequestMessageV4.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit b15809b8755c074af7401783eae1d7546845e716 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Fri Apr 19 15:38:43 2024 -0700 Renamed "evaluationTimeout" to "timeoutMs" in RequestMessageV4. This only affects the request message. The server still recognizes the timeout setting as being evaluationTimeout. Only the per request name has been updated. --- .../src/main/java/org/apache/tinkerpop/gremlin/server/Context.java | 4 ++-- .../tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java | 2 +- .../tinkerpop/gremlin/server/handler/HttpRequestMessageDecoder.java | 2 +- .../tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java | 4 ++-- .../gremlin/server/handler/HttpRequestMessageDecoderTest.java| 5 - .../src/main/java/org/apache/tinkerpop/gremlin/util/Tokens.java | 5 + .../org/apache/tinkerpop/gremlin/util/message/RequestMessageV4.java | 2 +- .../apache/tinkerpop/gremlin/util/message/RequestMessageV4Test.java | 2 +- 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Context.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Context.java index 88bd88e690..ff9e2e4d56 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Context.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Context.java @@ -127,7 +127,7 @@ public class Context { /** * The timeout for the request. If the request is a script it examines the script for a timeout setting using * {@code with()}. If that is not found then it examines the request itself to see if the timeout is provided by - * {@link Tokens#ARGS_EVAL_TIMEOUT}. If that is not provided then the {@link Settings#evaluationTimeout} is + * {@link Tokens#TIMEOUT_MS}. If that is not provided then the {@link Settings#evaluationTimeout} is * utilized as the default. */ public long getRequestTimeout() { @@ -200,7 +200,7 @@ public class Context { private long determineTimeout() { // timeout override - handle both deprecated and newly named configuration. earlier logic should prevent // both configurations from being submitted at the same time -final Long timeoutMs = requestMessage.getField(Tokens.ARGS_EVAL_TIMEOUT); +final Long timeoutMs = requestMessage.getField(Tokens.TIMEOUT_MS); final long seto = (null != timeoutMs) ? timeoutMs : settings.getEvaluationTimeout(); // override the timeout if the lifecycle has a value assigned. if the script contains with(timeout) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 906792f414..e85efcdb0e 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -180,7 +180,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler evalFuture = new FutureTask<>(() -> { diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestMessageDecoder.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestMessageDecoder.java index 1b261c3152..d1c9b1ad94 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestMessageDecoder.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestMessageDecoder.java @@ -224,7 +224,7 @@ public class HttpRequestMessageDecoder extends MessageToMessageDecoder
(tinkerpop) branch master-http updated (5ebc359e90 -> b15809b875)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git from 5ebc359e90 Add back evaluationTimeout and materializeProperties new c0612dd806 Remove RequestId from RequestMessageV4 CTR new b15809b875 Renamed "evaluationTimeout" to "timeoutMs" in RequestMessageV4. The 2 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: .../main/java/org/apache/tinkerpop/gremlin/server/Context.java | 4 ++-- .../gremlin/server/handler/HttpGremlinEndpointHandler.java | 2 +- .../gremlin/server/handler/HttpRequestMessageDecoder.java| 2 +- .../tinkerpop/gremlin/server/GremlinServerHttpIntegrateTest.java | 4 ++-- .../gremlin/server/handler/HttpRequestMessageDecoderTest.java| 6 -- .../src/main/java/org/apache/tinkerpop/gremlin/util/Tokens.java | 5 + .../apache/tinkerpop/gremlin/util/message/RequestMessageV4.java | 9 + .../tinkerpop/gremlin/util/message/RequestMessageV4Test.java | 8 +++- 8 files changed, 23 insertions(+), 17 deletions(-)
(tinkerpop) branch http-remove-serializers created (now 9622bd6dde)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-remove-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 9622bd6dde Create MessageSerializerV4s and remove MessageSerializer. This branch includes the following new commits: new 9622bd6dde Create MessageSerializerV4s and remove MessageSerializer. The 1 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.
(tinkerpop) branch http-remove-serializers updated (9622bd6dde -> f4c5d1b56d)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-remove-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard 9622bd6dde Create MessageSerializerV4s and remove MessageSerializer. new f4c5d1b56d Create MessageSerializerV4s and remove MessageSerializer. 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 (9622bd6dde) \ N -- N -- N refs/heads/http-remove-serializers (f4c5d1b56d) 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 1 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: .../server/util/TextPlainMessageSerializerV4Test.java | 18 ++ .../ser/GraphSONMessageSerializerV4RoundTripTest.java | 18 ++ .../util/ser/binary/MessageSerializerV4Test.java | 18 ++ 3 files changed, 54 insertions(+)
(tinkerpop) branch http-remove-serializers updated (f4c5d1b56d -> 7e683b1b4c)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-remove-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard f4c5d1b56d Create MessageSerializerV4s and remove MessageSerializer. new 7e683b1b4c Create MessageSerializerV4s and remove MessageSerializer. 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 (f4c5d1b56d) \ N -- N -- N refs/heads/http-remove-serializers (7e683b1b4c) 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 1 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: .../WebSocketClientBehaviorIntegrateTest.java | 525 - .../gremlin/socket/server/SocketServerRunner.java | 9 +- .../gremlin/socket/server/TestChannelizers.java| 105 - .../socket/server/TestWSGremlinInitializer.java| 195 4 files changed, 5 insertions(+), 829 deletions(-) delete mode 100644 gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/WebSocketClientBehaviorIntegrateTest.java delete mode 100644 gremlin-tools/gremlin-socket-server/src/main/java/org/apache/tinkerpop/gremlin/socket/server/TestChannelizers.java delete mode 100644 gremlin-tools/gremlin-socket-server/src/main/java/org/apache/tinkerpop/gremlin/socket/server/TestWSGremlinInitializer.java
(tinkerpop) branch http-remove-serializers updated (7e683b1b4c -> 2f7c34db0f)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-remove-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard 7e683b1b4c Create MessageSerializerV4s and remove MessageSerializer. new 2f7c34db0f Create MessageSerializerV4s and remove MessageSerializer. 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 (7e683b1b4c) \ N -- N -- N refs/heads/http-remove-serializers (2f7c34db0f) 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 1 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: .../console/jsr223/DriverGremlinPlugin.java| 38 +++ .../gremlin/driver/SerializationBenchmark.java | 41 --- .../ser/AbstractGraphSONMessageSerializerV4.java | 34 -- .../util/ser/GraphBinaryMessageSerializerV4.java | 125 - 4 files changed, 36 insertions(+), 202 deletions(-)
(tinkerpop) branch http-remove-serializers updated (2f7c34db0f -> 0ecfb2239f)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-remove-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git omit 2f7c34db0f Create MessageSerializerV4s and remove MessageSerializer. add 0ecfb2239f Create MessageSerializerV4s and remove MessageSerializer. 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 (2f7c34db0f) \ N -- N -- N refs/heads/http-remove-serializers (0ecfb2239f) 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. No new revisions were added by this update. Summary of changes: .../org/apache/tinkerpop/gremlin/driver/ClusterConfigTest.java | 4 ++-- .../gremlin/server/handler/HttpRequestMessageDecoder.java| 9 ++--- .../org/apache/tinkerpop/gremlin/util/ser/SerializersV4.java | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-)
(tinkerpop) branch http-remove-serializers deleted (was 0ecfb2239f)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-remove-serializers in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was 0ecfb2239f Create MessageSerializerV4s and remove MessageSerializer. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch serializerv4-io-test created (now 918148be11)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch serializerv4-io-test in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 918148be11 Update IO tests to test MessageSerializerV4. This branch includes the following new commits: new 918148be11 Update IO tests to test MessageSerializerV4. The 1 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.
(tinkerpop) branch serializerv4-io-test deleted (was 918148be11)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch serializerv4-io-test in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was 918148be11 Update IO tests to test MessageSerializerV4. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch master-http updated: Minor cleanup of items related to HTTP CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 4f3508dcef Minor cleanup of items related to HTTP CTR. 4f3508dcef is described below commit 4f3508dcef5240449cd736fcbddae4d65f820298 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu May 2 14:44:21 2024 -0700 Minor cleanup of items related to HTTP CTR. Added finals, removed unused variables/classes, updated comments, small refactorings. --- .../gremlin/driver/simple/SimpleHttpClient.java| 2 - .../gremlin/server/AbstractChannelizer.java| 5 +- .../gremlin/server/auth/Authenticator.java | 8 +- .../gremlin/server/channel/HttpChannelizer.java| 4 +- .../server/handler/HttpGremlinEndpointHandler.java | 20 +- .../gremlin/server/handler/HttpHandlerUtil.java| 24 +++ .../server/handler/HttpRequestMessageDecoder.java | 5 - .../gremlin/server/handler/ServerSerializers.java | 46 .../tinkerpop/gremlin/server/handler/StateKey.java | 17 -- .../gremlin/server/util/GremlinError.java | 5 +- .../gremlin/server/GremlinDriverIntegrateTest.java | 35 --- .../server/GremlinServerHttpIntegrateTest.java | 237 ++--- .../gremlin/util/message/RequestMessageV4.java | 11 +- .../gremlin/util/message/ResponseMessageV4.java| 21 +- .../ser/AbstractGraphSONMessageSerializerV4.java | 12 +- .../util/ser/GraphBinaryMessageSerializerV4.java | 6 - .../util/ser/GraphSONMessageSerializerV4.java | 10 +- .../ser/GraphSONUntypedMessageSerializerV4.java| 8 +- .../tinkerpop/gremlin/util/ser/SerTokens.java | 7 - .../tinkerpop/gremlin/util/ser/SerializersV4.java | 2 +- .../util/ser/binary/MessageSerializerV4Test.java | 1 - 21 files changed, 79 insertions(+), 407 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/SimpleHttpClient.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/SimpleHttpClient.java index 504d4e2f0f..e7e462ff4f 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/SimpleHttpClient.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/simple/SimpleHttpClient.java @@ -98,11 +98,9 @@ public class SimpleHttpClient extends AbstractClient { } p.addLast( new HttpClientCodec(), -// new HttpObjectAggregator(65536), new HttpGremlinResponseStreamDecoder(serializer), new HttpGremlinRequestEncoder(serializer, HandshakeInterceptor.NO_OP, false), // new HttpGremlinResponseDebugStreamDecoder(), - callbackResponseHandler); } }); diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java index 27457f0c33..368800d6c4 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/AbstractChannelizer.java @@ -70,7 +70,7 @@ import java.util.stream.Stream; * Gremlin scripts). * * Implementers need only worry about determining how incoming data is converted to a - * {@link RequestMessageV4} and outgoing data is converted from a {@link ResponseMessageV4} to whatever expected format is + * {@link RequestMessageV4} and outgoing data is converted from a {@link ResponseMessageV4} to whatever expected format is * needed by the pipeline. * * @author Stephen Mallette (http://stephen.genoprime.com) @@ -95,12 +95,9 @@ public abstract class AbstractChannelizer extends ChannelInitializerhttp://stephen.genoprime.com) */ @@ -65,6 +64,9 @@ public interface Authenticator { * Performs the actual SASL negotiation for a single authentication attempt. * SASL is stateful, so a new instance should be used for each attempt. * Non-trivial implementations may delegate to an instance of {@link javax.security.sasl.SaslServer} + * + * NOTE: This interface is no longer used by default in the Gremlin Server. It remains here for use with custom + * server implementations. */ public interface SaslNegotiator { diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/channel/HttpChannelizer.java index e512e993fa..93bc5aa826 100644 --- a/gremlin-serv
(tinkerpop) branch master-http updated: Remove user agent from HTTP request body.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 14382d438d Remove user agent from HTTP request body. 14382d438d is described below commit 14382d438d817c6e87b694412fd8ba6ca81193cc Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Fri May 3 14:46:18 2024 -0700 Remove user agent from HTTP request body. This has been replaced by the user agent HTTP header. https://lists.apache.org/thread/clyxxp8t6mg3y7y8nj1z48l19j7pk2v8 --- .../gremlin/console/jsr223/DriverRemoteAcceptor.java | 4 +--- .../java/org/apache/tinkerpop/gremlin/driver/Client.java | 1 - .../apache/tinkerpop/gremlin/driver/RequestOptions.java | 15 --- .../gremlin/driver/remote/DriverRemoteConnection.java | 3 --- .../gremlin/driver/remote/DriverRemoteConnectionTest.java | 1 - 5 files changed, 1 insertion(+), 23 deletions(-) diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java index 54d6508fc5..86f920097d 100644 --- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java +++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverRemoteAcceptor.java @@ -31,7 +31,6 @@ import org.apache.tinkerpop.gremlin.jsr223.console.GremlinShellEnvironment; import org.apache.tinkerpop.gremlin.jsr223.console.RemoteAcceptor; import org.apache.tinkerpop.gremlin.jsr223.console.RemoteException; import org.apache.tinkerpop.gremlin.structure.util.ElementHelper; -import org.apache.tinkerpop.gremlin.util.Gremlin; import org.apache.tinkerpop.gremlin.util.Tokens; import javax.security.sasl.SaslException; @@ -55,7 +54,6 @@ import java.util.stream.Stream; */ public class DriverRemoteAcceptor implements RemoteAcceptor { public static final int NO_TIMEOUT = 0; -public static final String USER_AGENT = "Gremlin Console/" + Gremlin.version(); private Cluster currentCluster; private Client currentClient; @@ -208,7 +206,7 @@ public class DriverRemoteAcceptor implements RemoteAcceptor { if (timeout > NO_TIMEOUT) options.timeout(timeout); -options.userAgent(USER_AGENT); +// TODO: console-specific user agent that isn't the one sent from gremlin-driver. final ResultSet rs = this.currentClient.submit(gremlin, options.create()); final List results = rs.all().get(); diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java index f47d529d18..e43127f9db 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Client.java @@ -359,7 +359,6 @@ public abstract class Client { options.getTimeout().ifPresent(timeout -> request.addTimeoutMillis(timeout)); options.getParameters().ifPresent(params -> request.addBindings(params)); options.getAliases().ifPresent(aliases -> {if (aliases.get("g") != null) request.addG(aliases.get("g")); }); -//options.getUserAgent().ifPresent(userAgent -> request.addArg(Tokens.ARGS_USER_AGENT, userAgent)); options.getLanguage().ifPresent(lang -> request.addLanguage(lang)); options.getMaterializeProperties().ifPresent(mp -> request.addMaterializeProperties(mp)); diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java index cb8a37306b..27d2562017 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/RequestOptions.java @@ -39,7 +39,6 @@ public final class RequestOptions { private final Integer batchSize; private final Long timeout; private final UUID overrideRequestId; -private final String userAgent; private final String language; private final String materializeProperties; @@ -49,7 +48,6 @@ public final class RequestOptions { this.batchSize = builder.batchSize; this.timeout = builder.timeout; this.overrideRequestId = builder.overrideRequestId; -this.userAgent = builder.userAgent; this.language = builder.language; this.materializeProperties = builder.materializeProperties; } @@ -74,10 +72,6 @@ public final class RequestOptions { return Optional.o
(tinkerpop) branch master-http updated: Replace message in trailers with exception CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new e784e7ca24 Replace message in trailers with exception CTR. e784e7ca24 is described below commit e784e7ca24f03c914fee2df145dd1c7ea51beacf Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Fri May 3 15:11:39 2024 -0700 Replace message in trailers with exception CTR. --- .../server/handler/HttpGremlinEndpointHandler.java | 4 ++-- .../gremlin/server/handler/HttpHandlerUtil.java | 19 ++- .../server/GremlinServerHttpIntegrateTest.java | 20 +++- 3 files changed, 15 insertions(+), 28 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index f517a14e78..8a503d9134 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -428,7 +428,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler
(tinkerpop) branch master-http updated: Remove CHUNKING_NOT_SUPPORTED state CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 6bf36bf7fc Remove CHUNKING_NOT_SUPPORTED state CTR. 6bf36bf7fc is described below commit 6bf36bf7fc1c44f264b713550978502707b84194 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Fri May 3 15:30:54 2024 -0700 Remove CHUNKING_NOT_SUPPORTED state CTR. --- .../main/java/org/apache/tinkerpop/gremlin/server/Context.java| 2 +- .../gremlin/server/handler/HttpGremlinEndpointHandler.java| 8 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Context.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Context.java index ff9e2e4d56..c7584daf94 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Context.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/Context.java @@ -83,7 +83,7 @@ public class Context { final Settings settings, final GraphManager graphManager, final GremlinExecutor gremlinExecutor, final ScheduledExecutorService scheduledExecutorService) { this(requestMessage, ctx, settings, graphManager, gremlinExecutor, scheduledExecutorService, - HttpGremlinEndpointHandler.RequestState.CHUNKING_NOT_SUPPORTED); +HttpGremlinEndpointHandler.RequestState.NOT_STARTED); } public Context(final RequestMessageV4 requestMessage, final ChannelHandlerContext ctx, diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 8a503d9134..2346f5e217 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -95,7 +95,6 @@ import static io.netty.handler.codec.http.HttpHeaderValues.CHUNKED; import static io.netty.handler.codec.http.HttpResponseStatus.INTERNAL_SERVER_ERROR; import static io.netty.handler.codec.http.HttpResponseStatus.OK; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; -import static org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.RequestState.CHUNKING_NOT_SUPPORTED; import static org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.RequestState.FINISHED; import static org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.RequestState.FINISHING; import static org.apache.tinkerpop.gremlin.server.handler.HttpGremlinEndpointHandler.RequestState.NOT_STARTED; @@ -554,17 +553,13 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler
(tinkerpop) branch master-http updated: Revert GraphManager changes added in TINKERPOP-2806 CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new ec3c264ebb Revert GraphManager changes added in TINKERPOP-2806 CTR. ec3c264ebb is described below commit ec3c264ebb6edfe0aa7d8f485c5c5277a98660c5 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Fri May 3 16:04:41 2024 -0700 Revert GraphManager changes added in TINKERPOP-2806 CTR. Left the changes to afterTimeout to prevent breaking any implementations that might make use of it. https://lists.apache.org/thread/n926nmt6lg8860ywgdx5qj9l2xjj8q89 --- .../tinkerpop/gremlin/server/GraphManager.java | 30 --- .../GraphManagerNotificationsTest.java | 93 -- .../notifications/ProviderGraphManagerHelper.java | 78 -- 3 files changed, 201 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java index 9982bf67a8..7a219b08b7 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/GraphManager.java @@ -125,34 +125,4 @@ public interface GraphManager { return graph.features().graph().supportsTransactions() && graph.tx().isOpen(); }); } - -/** - * This method will be called before a script or query is processed by the - * gremlin-server. - * - * @param msg the {@link RequestMessageV4} received by the gremlin-server. - */ -default void beforeQueryStart(final RequestMessageV4 msg) { - -} - -/** - * This method will be called before a script or query is processed by the - * gremlin-server. - * - * @param msg the {@link RequestMessageV4} received by the gremlin-server. - * @param error the exception encountered during processing from the gremlin-server. - */ -default void onQueryError(final RequestMessageV4 msg, final Throwable error) { - -} - -/** - * When a script or query successfully completes this method will be called. - * - * @param msg the {@link RequestMessageV4} received by the gremlin-server. - */ -default void onQuerySuccess(final RequestMessageV4 msg) { - -} } diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/notifications/GraphManagerNotificationsTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/notifications/GraphManagerNotificationsTest.java deleted file mode 100644 index 34fbd99c1a..00 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/notifications/GraphManagerNotificationsTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.server.notifications; - -import org.apache.tinkerpop.gremlin.TestHelper; -import org.apache.tinkerpop.gremlin.driver.Client; -import org.apache.tinkerpop.gremlin.driver.Cluster; -import org.apache.tinkerpop.gremlin.driver.RequestOptions; -import org.apache.tinkerpop.gremlin.util.Tokens; -import org.apache.tinkerpop.gremlin.server.AbstractGremlinServerIntegrationTest; -import org.apache.tinkerpop.gremlin.server.Settings; -import org.apache.tinkerpop.gremlin.server.TestClientFactory; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import java.util.Map; -import java.util.Random; -import java.util.UUID; - -public class GraphManagerNotificationsTest extends AbstractGremlinServerIntegrationTest { - - @Override - public Settings overrideSettings(final Settings settings) { -settings.graphManager = "org.apache.tinkerpop.gremlin.server.notifications.ProviderGraphManagerHelper"; -return settings; - } - - @Test - publi
(tinkerpop) branch master-http updated: Change GraphSONv4 response to have message and exception for error responses only CTR
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new e0f6994f4a Change GraphSONv4 response to have message and exception for error responses only CTR e0f6994f4a is described below commit e0f6994f4aa65fd84b9e55e6c91e7aeb542282b5 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Fri May 3 22:07:32 2024 -0700 Change GraphSONv4 response to have message and exception for error responses only CTR --- .../server/handler/HttpGremlinEndpointHandler.java | 3 +-- .../server/GremlinServerHttpIntegrateTest.java | 22 ++ .../ser/AbstractGraphSONMessageSerializerV4.java | 16 +++- .../util/ser/GraphBinaryMessageSerializerV4.java | 2 +- .../GraphSONUntypedMessageSerializerV4Test.java| 10 -- .../binary/GraphBinaryMessageSerializerV4Test.java | 1 - 6 files changed, 39 insertions(+), 15 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 2346f5e217..5698321dcc 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -554,7 +554,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler status = (Map) data.get(SerTokens.TOKEN_STATUS); ResponseMessageV4.Builder response = ResponseMessageV4.build() .code(HttpResponseStatus.valueOf((Integer) status.get(SerTokens.TOKEN_CODE))) - .statusMessage(String.valueOf(status.get(SerTokens.TOKEN_MESSAGE))) .result(data.get(SerTokens.TOKEN_RESULT)); if (null != status.get(SerTokens.TOKEN_EXCEPTION)) { response.exception(String.valueOf(status.get(SerTokens.TOKEN_EXCEPTION))); } +if (null != status.get(SerTokens.TOKEN_MESSAGE)) { + response.statusMessage(String.valueOf(status.get(SerTokens.TOKEN_MESSAGE))); +} return response.create(); } diff --git a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java index efabd352bb..b87e3290ef 100644 --- a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java +++ b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java @@ -134,7 +134,7 @@ public class GraphBinaryMessageSerializerV4 extends AbstractMessageSerializerV4< @Override public String[] mimeTypesSupported() { -return new String[] {/*serializeToString ? obtainStringdMimeType() : obtainMimeType()*/MIME_TYPE}; +return new String[] {MIME_TYPE}; } private void addCustomClasses(final Map config, final TypeSerializerRegistry.Builder builder) { diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONUntypedMessageSerializerV4Test.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONUntypedMessageSerializerV4Test.java index c36c69c2be..483bd10c6f 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONUntypedMessageSerializerV4Test.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONUntypedMessageSerializerV4Test.java @@ -52,7 +52,6 @@ public class GraphSONUntypedMessageSerializerV4Test { final ResponseMessageV4 footer = ResponseMessageV4.build() .result(Arrays.asList("footer", 3)) .code(HttpResponseStatus.OK) -.statusMessage("OK") .create(); final ByteBuf bb0 = serializer.writeHeader(header, allocator); @@ -69,14 +68,14 @@ public class GraphSONUntypedMessageSerializerV4Test { assertEquals("header", node.get("result").get(0).textValue()); assertEquals("footer", node.get("result").get(6).textValue()); assertEquals(8, node.get("result").size()); -assertEquals("OK", node.get("status").get("message").asText()); +assertNull(node.get("status").get("message")); assertEquals(200, node.get("status").get("code").asInt()); // a message composed of all chunks must be deserialized bbCombined.resetReaderIndex(); final R
(tinkerpop) 01/01: Replace ResponseResult with ResponseResultV4.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch responseresultv4 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 6f5df4845785d2f3a436bab6fd66b5f609f8ad89 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue May 7 14:16:50 2024 -0700 Replace ResponseResult with ResponseResultV4. The V4 version changes the data to be List rather than just a plain Object since the server will always wrap the result in a List anyway. The GraphSON representation will now contain an empty array instead of a null when there are no results. --- .../gremlin/console/jsr223/DriverGremlinPlugin.java | 4 ++-- .../java/org/apache/tinkerpop/gremlin/driver/Result.java| 4 ++-- .../gremlin/server/GremlinServerIntegrateTest.java | 8 .../tinkerpop/gremlin/driver/SerializationBenchmark.java| 3 ++- .../tinkerpop/gremlin/util/message/ResponseMessageV4.java | 13 +++-- .../message/{ResponseResult.java => ResponseResultV4.java} | 11 ++- .../util/ser/AbstractGraphSONMessageSerializerV4.java | 4 ++-- .../util/ser/binary/ResponseMessageSerializerV4.java| 4 ++-- .../gremlin/util/ser/GraphSONMessageSerializerV4Test.java | 10 +- .../ser/binary/types/sample/SamplePersonSerializerTest.java | 2 +- 10 files changed, 33 insertions(+), 30 deletions(-) diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java index 81fd12154e..5b53f859f3 100644 --- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java +++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java @@ -39,7 +39,7 @@ import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; import org.apache.tinkerpop.gremlin.util.Tokens; import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4; import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; -import org.apache.tinkerpop.gremlin.util.message.ResponseResult; +import org.apache.tinkerpop.gremlin.util.message.ResponseResultV4; import org.apache.tinkerpop.gremlin.util.message.ResponseStatusV4; import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4; import org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4; @@ -69,7 +69,7 @@ public class DriverGremlinPlugin extends AbstractGremlinPlugin { ResponseException.class, RequestMessageV4.class, ResponseMessageV4.class, -ResponseResult.class, +ResponseResultV4.class, ResponseStatusV4.class, GraphSONMessageSerializerV4.class, GraphSONUntypedMessageSerializerV4.class, diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Result.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Result.java index 4c34aad551..6b1545b05e 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Result.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Result.java @@ -18,13 +18,13 @@ */ package org.apache.tinkerpop.gremlin.driver; -import org.apache.tinkerpop.gremlin.util.message.ResponseResult; import org.apache.tinkerpop.gremlin.process.traversal.Path; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.apache.tinkerpop.gremlin.util.message.ResponseResultV4; import java.util.Iterator; @@ -39,7 +39,7 @@ public final class Result { final Object resultObject; /** - * Constructs a "result" from data found in {@link ResponseResult#getData()}. + * Constructs a "result" from data found in {@link ResponseResultV4#getData()}. */ public Result(final Object responseData) { this.resultObject = responseData; diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 0db3c3f9ee..0b9c24ebf4 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java @@ -708,7 +708,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration assertTrue(responses.get(0).getStatus().getMessage(
(tinkerpop) branch responseresultv4 created (now 6f5df48457)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch responseresultv4 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at 6f5df48457 Replace ResponseResult with ResponseResultV4. This branch includes the following new commits: new 6f5df48457 Replace ResponseResult with ResponseResultV4. The 1 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.
(tinkerpop) branch responseresultv4 deleted (was 6f5df48457)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch responseresultv4 in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was 6f5df48457 Replace ResponseResult with ResponseResultV4. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch master-http updated: Replace ResponseResult with ResponseResultV4. (#2595)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 46b6ed0f33 Replace ResponseResult with ResponseResultV4. (#2595) 46b6ed0f33 is described below commit 46b6ed0f3334f2202e6ae4ab4dbe7a8861b62321 Author: kenhuuu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue May 7 14:50:18 2024 -0700 Replace ResponseResult with ResponseResultV4. (#2595) The V4 version changes the data to be List rather than just a plain Object since the server will always wrap the result in a List anyway. The GraphSON representation will now contain an empty array instead of a null when there are no results. --- .../gremlin/console/jsr223/DriverGremlinPlugin.java | 4 ++-- .../java/org/apache/tinkerpop/gremlin/driver/Result.java| 4 ++-- .../gremlin/server/GremlinServerIntegrateTest.java | 8 .../tinkerpop/gremlin/driver/SerializationBenchmark.java| 3 ++- .../tinkerpop/gremlin/util/message/ResponseMessageV4.java | 13 +++-- .../message/{ResponseResult.java => ResponseResultV4.java} | 11 ++- .../util/ser/AbstractGraphSONMessageSerializerV4.java | 4 ++-- .../util/ser/binary/ResponseMessageSerializerV4.java| 4 ++-- .../gremlin/util/ser/GraphSONMessageSerializerV4Test.java | 10 +- .../ser/binary/types/sample/SamplePersonSerializerTest.java | 2 +- 10 files changed, 33 insertions(+), 30 deletions(-) diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java index 81fd12154e..5b53f859f3 100644 --- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java +++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/jsr223/DriverGremlinPlugin.java @@ -39,7 +39,7 @@ import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; import org.apache.tinkerpop.gremlin.util.Tokens; import org.apache.tinkerpop.gremlin.util.message.RequestMessageV4; import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; -import org.apache.tinkerpop.gremlin.util.message.ResponseResult; +import org.apache.tinkerpop.gremlin.util.message.ResponseResultV4; import org.apache.tinkerpop.gremlin.util.message.ResponseStatusV4; import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV4; import org.apache.tinkerpop.gremlin.util.ser.GraphSONMessageSerializerV4; @@ -69,7 +69,7 @@ public class DriverGremlinPlugin extends AbstractGremlinPlugin { ResponseException.class, RequestMessageV4.class, ResponseMessageV4.class, -ResponseResult.class, +ResponseResultV4.class, ResponseStatusV4.class, GraphSONMessageSerializerV4.class, GraphSONUntypedMessageSerializerV4.class, diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Result.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Result.java index 4c34aad551..6b1545b05e 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Result.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Result.java @@ -18,13 +18,13 @@ */ package org.apache.tinkerpop.gremlin.driver; -import org.apache.tinkerpop.gremlin.util.message.ResponseResult; import org.apache.tinkerpop.gremlin.process.traversal.Path; import org.apache.tinkerpop.gremlin.structure.Edge; import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Property; import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.structure.VertexProperty; +import org.apache.tinkerpop.gremlin.util.message.ResponseResultV4; import java.util.Iterator; @@ -39,7 +39,7 @@ public final class Result { final Object resultObject; /** - * Constructs a "result" from data found in {@link ResponseResult#getData()}. + * Constructs a "result" from data found in {@link ResponseResultV4#getData()}. */ public Result(final Object responseData) { this.resultObject = responseData; diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 0db3c3f9ee..0b9c24ebf4 100644 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java +++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java @@
(tinkerpop) branch master-http updated: Remove RequestId from RequestMessageV4 CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 102e76d665 Remove RequestId from RequestMessageV4 CTR. 102e76d665 is described below commit 102e76d665a5bc0c97a2f4f858e15b0c1e5ac9db Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue May 14 20:51:34 2024 -0700 Remove RequestId from RequestMessageV4 CTR. The user is no longer allowed to set a custom UUID per request and the request ID is always generated by the server so remove it from the RequestMessageV4. --- .../server/handler/HttpGremlinEndpointHandler.java | 8 ++-- .../handler/HttpRequestMessageDecoderTest.java | 44 ++ .../gremlin/util/message/RequestMessageV4.java | 11 -- 3 files changed, 9 insertions(+), 54 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java index 5698321dcc..bcb93ffc6a 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpGremlinEndpointHandler.java @@ -81,6 +81,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.Set; +import java.util.UUID; import java.util.concurrent.Future; import java.util.concurrent.FutureTask; import java.util.concurrent.RejectedExecutionException; @@ -402,8 +403,8 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler serializer, Traversal.Admin traversal) throws InterruptedException { -final RequestMessageV4 msg = context.getRequestMessage(); -logger.debug("Traversal request {} for in thread {}", msg.getRequestId(), Thread.currentThread().getName()); +final UUID requestId = context.getChannelHandlerContext().attr(StateKey.REQUEST_ID).get(); +logger.debug("Traversal request {} for in thread {}", requestId, Thread.currentThread().getName()); // compile the traversal - without it getEndStep() has nothing in it traversal.applyStrategies(); @@ -583,7 +584,8 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler fields; -private UUID requestId; private RequestMessageV4(final Object gremlin, final Map fields) { if (null == gremlin) throw new IllegalArgumentException("RequestMessage requires gremlin argument"); @@ -61,8 +60,6 @@ public final class RequestMessageV4 { } this.fields.put("gremlinType", gremlinType); - -requestId = UUID.randomUUID(); } /** @@ -70,14 +67,6 @@ public final class RequestMessageV4 { */ private RequestMessageV4() { } -/** - * The id of the current request. - * Used only in GLV, not transmitted to the server. - */ -public UUID getRequestId() { -return requestId; -} - public Optional optionalField(final String key) { final Object o = fields.get(key); return o == null ? Optional.empty() : Optional.of((T) o);
(tinkerpop) branch master-http updated: Fix incorrect ResponseMessage in TextPlainMessageSerializerV4Test CTR
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 9efc323f7e Fix incorrect ResponseMessage in TextPlainMessageSerializerV4Test CTR 9efc323f7e is described below commit 9efc323f7eadfdc24b6c2c78af7e6e2d30d092b2 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue May 14 21:35:28 2024 -0700 Fix incorrect ResponseMessage in TextPlainMessageSerializerV4Test CTR --- .../server/util/TextPlainMessageSerializerV4.java | 29 +++--- .../util/TextPlainMessageSerializerV4Test.java | 2 ++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TextPlainMessageSerializerV4.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TextPlainMessageSerializerV4.java index 6bdfbf0e54..dadd1eb468 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TextPlainMessageSerializerV4.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/TextPlainMessageSerializerV4.java @@ -27,7 +27,6 @@ import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; import org.apache.tinkerpop.gremlin.util.ser.AbstractMessageSerializerV4; import org.apache.tinkerpop.gremlin.util.ser.SerializationException; -import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -44,49 +43,49 @@ public class TextPlainMessageSerializerV4 extends AbstractMessageSerializerV4) responseMessage.getResult().getData(), false, allocator) +? convertStringData(responseMessage.getResult().getData(), false, allocator) : convertErrorString(responseMessage.getStatus().getMessage(), allocator); } @Override -public ByteBuf writeHeader(ResponseMessageV4 responseMessage, ByteBufAllocator allocator) throws SerializationException { -return convertStringData((List) responseMessage.getResult().getData(), false, allocator); +public ByteBuf writeHeader(ResponseMessageV4 responseMessage, ByteBufAllocator allocator) { +return convertStringData(responseMessage.getResult().getData(), false, allocator); } @Override -public ByteBuf writeChunk(Object aggregate, ByteBufAllocator allocator) throws SerializationException { +public ByteBuf writeChunk(Object aggregate, ByteBufAllocator allocator) { return convertStringData((List) aggregate, true, allocator); } @Override -public ByteBuf writeFooter(ResponseMessageV4 responseMessage, ByteBufAllocator allocator) throws SerializationException { -return convertStringData((List) responseMessage.getResult().getData(), true, allocator); +public ByteBuf writeFooter(ResponseMessageV4 responseMessage, ByteBufAllocator allocator) { +return convertStringData(responseMessage.getResult().getData(), true, allocator); } @Override -public ByteBuf writeErrorFooter(ResponseMessageV4 responseMessage, ByteBufAllocator allocator) throws SerializationException { +public ByteBuf writeErrorFooter(ResponseMessageV4 responseMessage, ByteBufAllocator allocator) { return convertErrorString(System.lineSeparator() + responseMessage.getStatus().getMessage(), allocator); } @Override -public ResponseMessageV4 readChunk(ByteBuf byteBuf, boolean isFirstChunk) throws SerializationException { +public ResponseMessageV4 readChunk(ByteBuf byteBuf, boolean isFirstChunk) { throw new UnsupportedOperationException("text/plain does not have deserialization functions"); } @Override -public ByteBuf serializeRequestAsBinary(final RequestMessageV4 requestMessage, final ByteBufAllocator allocator) throws SerializationException { +public ByteBuf serializeRequestAsBinary(final RequestMessageV4 requestMessage, final ByteBufAllocator allocator) { throw new UnsupportedOperationException("text/plain does not produce binary"); } @Override -public RequestMessageV4 deserializeBinaryRequest(final ByteBuf msg) throws SerializationException { +public RequestMessageV4 deserializeBinaryRequest(final ByteBuf msg) { throw new UnsupportedOperationException("text/plain does not have deserialization functions"); } @Override -public ResponseMessageV4 deserializeBinaryResponse(final ByteBuf msg) throws SerializationException { +public ResponseMessageV4 deserializeBinaryResponse(final ByteBuf msg) { throw new UnsupportedOperationException("text/plain does not have deserialization functions"); } @@ -95,7 +94,7 @@ public class TextPlainMessageSerializerV4 extends A
(tinkerpop) 01/03: Remove GraphSON feature/process tests.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-server-test-updates in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 57dd2c444a002352336d3ff704470aa21ca650df Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon May 20 12:13:15 2024 -0700 Remove GraphSON feature/process tests. Starting in 4.0, gremlin-driver only supports GraphBinary. --- .../remote/GraphSONRemoteComputerFeatureTest.java | 51 --- .../driver/remote/GraphSONRemoteFeatureTest.java | 51 --- .../GraphSONRemoteGraphComputerProvider.java | 151 - .../driver/remote/GraphSONRemoteGraphProvider.java | 30 .../gremlin/driver/remote/RemoteWorld.java | 12 -- .../GraphSONRemoteGraphProcessComputerTest.java| 34 - .../GraphSONRemoteGraphProcessStandardTest.java| 33 - .../io.cucumber.core.backend.ObjectFactory | 2 - 8 files changed, 364 deletions(-) diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/GraphSONRemoteComputerFeatureTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/GraphSONRemoteComputerFeatureTest.java deleted file mode 100644 index ed170e470f..00 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/GraphSONRemoteComputerFeatureTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.remote; - -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Stage; -import io.cucumber.guice.CucumberModules; -import io.cucumber.junit.Cucumber; -import io.cucumber.junit.CucumberOptions; -import org.apache.tinkerpop.gremlin.features.AbstractGuiceFactory; -import org.apache.tinkerpop.gremlin.features.World; -import org.junit.runner.RunWith; - -@RunWith(Cucumber.class) -@CucumberOptions( -tags = "not @RemoteOnly and not @GraphComputerVerificationElementSupported", -glue = { "org.apache.tinkerpop.gremlin.features" }, -objectFactory = GraphSONRemoteComputerFeatureTest.RemoteGuiceFactory.class, -features = { "classpath:/org/apache/tinkerpop/gremlin/test/features" }, -plugin = {"progress", "junit:target/cucumber.xml"}) -public class GraphSONRemoteComputerFeatureTest extends AbstractFeatureTest { -public static class RemoteGuiceFactory extends AbstractGuiceFactory { -public RemoteGuiceFactory() { -super(Guice.createInjector(Stage.PRODUCTION, CucumberModules.createScenarioModule(), new ServiceModule())); -} -} - -public static final class ServiceModule extends AbstractModule { -@Override -protected void configure() { - bind(World.class).to(RemoteWorld.GraphSONRemoteComputerWorld.class); -} -} -} diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/GraphSONRemoteFeatureTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/GraphSONRemoteFeatureTest.java deleted file mode 100644 index 901ac413b1..00 --- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/driver/remote/GraphSONRemoteFeatureTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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
(tinkerpop) branch http-server-test-updates created (now ba25c6970a)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-server-test-updates in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at ba25c6970a Fix and re-enable tests for server and Java driver. This branch includes the following new commits: new 57dd2c444a Remove GraphSON feature/process tests. new 0776043e17 Fix max content length handling to gremlin-driver. new ba25c6970a Fix and re-enable tests for server and Java driver. The 3 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.
(tinkerpop) 03/03: Fix and re-enable tests for server and Java driver.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-server-test-updates in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit ba25c6970a639e8112a209941a102db33517aee0 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon May 27 16:58:58 2024 -0700 Fix and re-enable tests for server and Java driver. --- .../structure/io/graphson/GraphSONReader.java | 2 +- .../tinkerpop/gremlin/driver/Channelizer.java | 7 + .../tinkerpop/gremlin/driver/ConnectionPool.java | 11 +- .../driver/handler/GremlinResponseHandler.java | 3 +- .../driver/handler/HttpGremlinRequestEncoder.java | 4 +- .../handler/HttpGremlinResponseStreamDecoder.java | 21 +- .../gremlin/driver/handler/SslCheckHandler.java| 50 .../gremlin/driver/simple/AbstractClient.java | 2 +- .../handler/HttpBasicAuthorizationHandler.java | 27 ++- .../server/handler/HttpGremlinEndpointHandler.java | 2 +- .../driver/ClientConnectionIntegrateTest.java | 2 +- .../gremlin/server/GremlinDriverIntegrateTest.java | 126 +- .../server/GremlinServerAuditLogIntegrateTest.java | 259 - .../server/GremlinServerAuthIntegrateTest.java | 2 +- .../server/GremlinServerAuthzIntegrateTest.java| 78 --- .../gremlin/server/GremlinServerIntegrateTest.java | 212 ++--- .../GremlinServerSerializationIntegrateTest.java | 3 +- .../server/GremlinServerSslIntegrateTest.java | 13 +- ...tractGremlinServerChannelizerIntegrateTest.java | 50 +--- .../src/test/resources/conf/remote-objects.yaml| 2 +- .../util/ser/GraphBinaryMessageSerializerV4.java | 3 +- 21 files changed, 327 insertions(+), 552 deletions(-) diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java index 7b5c812f42..937adce201 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java @@ -177,7 +177,7 @@ public final class GraphSONReader implements GraphReader { final Direction attachEdgesOfThisDirection) throws IOException { // graphson v3 has special handling for generic Map instances, by forcing to linkedhashmap (which is probably // what it should have been anyway) stargraph format can remain unchanged across all versions -final Map vertexData = version == GraphSONVersion.V3_0 ? +final Map vertexData = ((version == GraphSONVersion.V3_0) || (version == GraphSONVersion.V4_0)) ? mapper.readValue(inputStream, linkedHashMapTypeReference) : mapper.readValue(inputStream, mapTypeReference); final StarGraph starGraph = StarGraphGraphSONDeserializer.readStarGraphVertex(vertexData); if (vertexAttachMethod != null) vertexAttachMethod.apply(starGraph.getStarVertex()); diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java index 4caa029484..d2e393f100 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java @@ -20,6 +20,8 @@ package org.apache.tinkerpop.gremlin.driver; import io.netty.channel.Channel; import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; @@ -29,6 +31,7 @@ import io.netty.handler.ssl.SslHandler; import org.apache.tinkerpop.gremlin.driver.handler.GremlinResponseHandler; import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinRequestEncoder; import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinResponseStreamDecoder; +import org.apache.tinkerpop.gremlin.driver.handler.SslCheckHandler; import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; import java.util.Optional; @@ -92,6 +95,8 @@ public interface Channelizer extends ChannelHandler { protected static final String PIPELINE_HTTP_ENCODER = "gremlin-encoder"; protected static final String PIPELINE_HTTP_DECODER = "gremlin-decoder"; +private static final SslCheckHandler sslCheckHandler = new SslCheckHandler(); + public boolean supportsSsl() { return cluster.connectionPoolSettings().enableSsl; } @@ -135,6 +140,8 @@ public interface Channelizer extends ChannelHandler { // will instead be capped by co
(tinkerpop) 02/03: Fix max content length handling to gremlin-driver.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-server-test-updates in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 0776043e175f438c7db5bd44ce2370083ad28d16 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon May 20 12:20:06 2024 -0700 Fix max content length handling to gremlin-driver. Updated to match old behavior where the incoming size of the data is checked so that it doesn't exceed the maxContentLength setting. --- .../apache/tinkerpop/gremlin/driver/Channelizer.java | 2 +- .../driver/handler/HttpGremlinRequestEncoder.java | 1 + .../handler/HttpGremlinResponseStreamDecoder.java | 18 +++--- .../gremlin/driver/simple/SimpleHttpClient.java| 2 +- .../gremlin/driver/ClientConnectionIntegrateTest.java | 7 --- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java index 7ff0b7e2e8..4caa029484 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java @@ -157,7 +157,7 @@ public interface Channelizer extends ChannelHandler { super.init(connection); gremlinRequestEncoder = new HttpGremlinRequestEncoder(cluster.getSerializer(), cluster.getRequestInterceptor(), cluster.isUserAgentOnConnectEnabled()); -gremlinResponseDecoder = new HttpGremlinResponseStreamDecoder(cluster.getSerializer()); +gremlinResponseDecoder = new HttpGremlinResponseStreamDecoder(cluster.getSerializer(), cluster.getMaxContentLength()); } @Override diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinRequestEncoder.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinRequestEncoder.java index 31a564d57e..2d9c51c73e 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinRequestEncoder.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinRequestEncoder.java @@ -22,6 +22,7 @@ import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageEncoder; +import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.http.DefaultFullHttpRequest; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpHeaderNames; diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java index 825a55ada2..8d8f626017 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java @@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.driver.handler; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageDecoder; +import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.http.DefaultHttpObject; import io.netty.handler.codec.http.HttpContent; import io.netty.handler.codec.http.HttpHeaders; @@ -44,12 +45,15 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder IS_FIRST_CHUNK = AttributeKey.valueOf("isFirstChunk"); private static final AttributeKey RESPONSE_STATUS = AttributeKey.valueOf("responseStatus"); +private static final AttributeKey BYTES_READ = AttributeKey.valueOf("bytesRead"); private final MessageSerializerV4 serializer; +private final int maxContentLength; private final ObjectMapper mapper = new ObjectMapper(); -public HttpGremlinResponseStreamDecoder(MessageSerializerV4 serializer) { +public HttpGremlinResponseStreamDecoder(final MessageSerializerV4 serializer, final int maxContentLength) { this.serializer = serializer; +this.maxContentLength = maxContentLength; } @Override @@ -65,14 +69,22 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder bytesRead = ctx.channel().attr(BYTES_READ); +bytesRead.set(bytesRead.get() + content.readableBytes()); +if (bytesRead.get() > maxContentLength) { +ctx.fireExceptionCaught(new TooLongFrameException("Response exceeded " + maxContentLength + " bytes.")); +} +
(tinkerpop) branch http-server-test-updates deleted (was ba25c6970a)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-server-test-updates in repository https://gitbox.apache.org/repos/asf/tinkerpop.git was ba25c6970a Fix and re-enable tests for server and Java driver. The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
(tinkerpop) branch master-http updated: Re-enable certain tests and add fixes. (#2621)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new aa166cacce Re-enable certain tests and add fixes. (#2621) aa166cacce is described below commit aa166caccee01598dd86ce0c50d250e8cf85771e Author: kenhuuu <106191785+kenh...@users.noreply.github.com> AuthorDate: Mon Jun 3 19:22:14 2024 -0700 Re-enable certain tests and add fixes. (#2621) * Remove GraphSON feature/process tests. Starting in 4.0, gremlin-driver only supports GraphBinary. * Fix max content length handling to gremlin-driver. Updated to match old behavior where the incoming size of the data is checked so that it doesn't exceed the maxContentLength setting. * Fix and re-enable tests for server and Java driver. --- .../structure/io/graphson/GraphSONReader.java | 2 +- .../tinkerpop/gremlin/driver/Channelizer.java | 9 +- .../tinkerpop/gremlin/driver/ConnectionPool.java | 11 +- .../driver/handler/GremlinResponseHandler.java | 3 +- .../driver/handler/HttpGremlinRequestEncoder.java | 3 + .../handler/HttpGremlinResponseStreamDecoder.java | 35 ++- .../gremlin/driver/handler/SslCheckHandler.java| 50 .../gremlin/driver/simple/AbstractClient.java | 2 +- .../gremlin/driver/simple/SimpleHttpClient.java| 2 +- .../handler/HttpBasicAuthorizationHandler.java | 27 ++- .../server/handler/HttpGremlinEndpointHandler.java | 2 +- .../driver/ClientConnectionIntegrateTest.java | 9 +- .../remote/GraphSONRemoteComputerFeatureTest.java | 51 .../driver/remote/GraphSONRemoteFeatureTest.java | 51 .../GraphSONRemoteGraphComputerProvider.java | 151 .../driver/remote/GraphSONRemoteGraphProvider.java | 30 --- .../gremlin/driver/remote/RemoteWorld.java | 12 - .../GraphSONRemoteGraphProcessComputerTest.java| 34 --- .../GraphSONRemoteGraphProcessStandardTest.java| 33 --- .../gremlin/server/GremlinDriverIntegrateTest.java | 126 +- .../server/GremlinServerAuditLogIntegrateTest.java | 259 - .../server/GremlinServerAuthIntegrateTest.java | 2 +- .../server/GremlinServerAuthzIntegrateTest.java| 78 --- .../gremlin/server/GremlinServerIntegrateTest.java | 212 ++--- .../GremlinServerSerializationIntegrateTest.java | 3 +- .../server/GremlinServerSslIntegrateTest.java | 13 +- ...tractGremlinServerChannelizerIntegrateTest.java | 50 +--- .../io.cucumber.core.backend.ObjectFactory | 2 - .../src/test/resources/conf/remote-objects.yaml| 2 +- .../util/ser/GraphBinaryMessageSerializerV4.java | 3 +- 30 files changed, 346 insertions(+), 921 deletions(-) diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java index 7b5c812f42..937adce201 100644 --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONReader.java @@ -177,7 +177,7 @@ public final class GraphSONReader implements GraphReader { final Direction attachEdgesOfThisDirection) throws IOException { // graphson v3 has special handling for generic Map instances, by forcing to linkedhashmap (which is probably // what it should have been anyway) stargraph format can remain unchanged across all versions -final Map vertexData = version == GraphSONVersion.V3_0 ? +final Map vertexData = ((version == GraphSONVersion.V3_0) || (version == GraphSONVersion.V4_0)) ? mapper.readValue(inputStream, linkedHashMapTypeReference) : mapper.readValue(inputStream, mapTypeReference); final StarGraph starGraph = StarGraphGraphSONDeserializer.readStarGraphVertex(vertexData); if (vertexAttachMethod != null) vertexAttachMethod.apply(starGraph.getStarVertex()); diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java index 7ff0b7e2e8..d2e393f100 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java @@ -20,6 +20,8 @@ package org.apache.tinkerpop.gremlin.driver; import io.netty.channel.Channel; import io.netty.channel.ChannelHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeli
(tinkerpop) branch master-http updated: Fix gremlin-util tests CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git The following commit(s) were added to refs/heads/master-http by this push: new 999e67310e Fix gremlin-util tests CTR. 999e67310e is described below commit 999e67310e4db1d77ff6993aacb85433ea0903db Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue May 28 23:31:18 2024 -0700 Fix gremlin-util tests CTR. --- .../gremlin/util/ser/AbstractGraphSONMessageSerializerV4.java| 4 .../tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java | 4 .../tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java | 3 ++- .../gremlin/util/ser/binary/GraphBinaryMessageSerializerV4Test.java | 2 +- .../util/ser/binary/types/sample/SamplePersonSerializerTest.java | 5 +++-- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/AbstractGraphSONMessageSerializerV4.java b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/AbstractGraphSONMessageSerializerV4.java index 34febf0b1b..ae5868b4f3 100644 --- a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/AbstractGraphSONMessageSerializerV4.java +++ b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/AbstractGraphSONMessageSerializerV4.java @@ -97,6 +97,10 @@ public abstract class AbstractGraphSONMessageSerializerV4 extends AbstractMessag @Override public ByteBuf serializeResponseAsBinary(final ResponseMessageV4 responseMessage, final ByteBufAllocator allocator) throws SerializationException { +if (null == responseMessage.getStatus()) { +throw new SerializationException("ResponseStatusV4 can't be null when serializing a full ResponseMessageV4."); +} + return writeHeader(responseMessage, allocator); } diff --git a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java index f5b6fff101..d98c7cfd85 100644 --- a/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java +++ b/gremlin-util/src/main/java/org/apache/tinkerpop/gremlin/util/ser/GraphBinaryMessageSerializerV4.java @@ -186,6 +186,10 @@ public class GraphBinaryMessageSerializerV4 extends AbstractMessageSerializerV4< @Override public ByteBuf serializeResponseAsBinary(final ResponseMessageV4 responseMessage, final ByteBufAllocator allocator) throws SerializationException { +if (null == responseMessage.getStatus()) { +throw new SerializationException("ResponseStatusV4 can't be null when serializing a full ResponseMessageV4."); +} + return writeHeader(responseMessage, allocator); } diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java index 7f56f76265..1fd82dc76d 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/GraphSONMessageSerializerV4Test.java @@ -270,7 +270,8 @@ public class GraphSONMessageSerializerV4Test { } private ResponseMessageV4 convert(final Object toSerialize, MessageSerializerV4 serializer) throws SerializationException { -final ByteBuf bb = serializer.serializeResponseAsBinary(responseMessageBuilder.result(Collections.singletonList(toSerialize)).create(), allocator); +final ByteBuf bb = serializer.serializeResponseAsBinary( + responseMessageBuilder.result(Collections.singletonList(toSerialize)).code(HttpResponseStatus.OK).create(), allocator); return serializer.deserializeBinaryResponse(bb); } } diff --git a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/GraphBinaryMessageSerializerV4Test.java b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/GraphBinaryMessageSerializerV4Test.java index 4403e9584b..df95403306 100644 --- a/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/GraphBinaryMessageSerializerV4Test.java +++ b/gremlin-util/src/test/java/org/apache/tinkerpop/gremlin/util/ser/binary/GraphBinaryMessageSerializerV4Test.java @@ -42,7 +42,7 @@ public class GraphBinaryMessageSerializerV4Test { private final ByteBufAllocator allocator = ByteBufAllocator.DEFAULT; private final GraphBinaryMessageSerializerV4 serializer = new GraphBinaryMessageSerializerV4(); -private static class SampleTypeSerializerRegistryBuilder extends TypeSerializerRegi
(tinkerpop) branch 3.7-dev updated (44f6848249 -> 8d9f63ce4e)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch 3.7-dev in repository https://gitbox.apache.org/repos/asf/tinkerpop.git from 44f6848249 Merge branch 'pr-2645' into 3.7-dev add 194d68464c [TINKERPOP-3082] Allow specifying a customized Spark AppName new 8d9f63ce4e Merge pull request #2634 The 1 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 | 1 + .../apache/tinkerpop/gremlin/spark/structure/Spark.java | 7 ++- .../tinkerpop/gremlin/spark/structure/SparkTest.java| 17 + 3 files changed, 24 insertions(+), 1 deletion(-)
(tinkerpop) 01/01: Merge pull request #2634
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch 3.7-dev in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 8d9f63ce4e368293b604060992f444380269b2f8 Merge: 44f6848249 194d68464c Author: kenhuuu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Jun 6 11:24:09 2024 -0700 Merge pull request #2634 [TINKERPOP-3082] Allow specifying a customized Spark AppName CHANGELOG.asciidoc | 1 + .../apache/tinkerpop/gremlin/spark/structure/Spark.java | 7 ++- .../tinkerpop/gremlin/spark/structure/SparkTest.java| 17 + 3 files changed, 24 insertions(+), 1 deletion(-)
(tinkerpop) branch master updated (def315086d -> 2dd560b4e3)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/tinkerpop.git from def315086d Merge branch '3.7-dev' add 194d68464c [TINKERPOP-3082] Allow specifying a customized Spark AppName add 8d9f63ce4e Merge pull request #2634 new 2dd560b4e3 Merge branch '3.7-dev' The 1 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 | 1 + .../apache/tinkerpop/gremlin/spark/structure/Spark.java | 7 ++- .../tinkerpop/gremlin/spark/structure/SparkTest.java| 17 + 3 files changed, 24 insertions(+), 1 deletion(-)
(tinkerpop) 01/01: Merge branch '3.7-dev'
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 2dd560b4e3d66e24acde8ef2c06cf6f2dfb33ca2 Merge: def315086d 8d9f63ce4e Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Thu Jun 6 11:25:29 2024 -0700 Merge branch '3.7-dev' CHANGELOG.asciidoc | 1 + .../apache/tinkerpop/gremlin/spark/structure/Spark.java | 7 ++- .../tinkerpop/gremlin/spark/structure/SparkTest.java| 17 + 3 files changed, 24 insertions(+), 1 deletion(-)
(tinkerpop) 01/01: Re-enable and fix shouldBlowTheWorkQueueSize test.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit dcd0c96d63ff31dc382ede2920d58a0641311d21 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Sat Jun 8 10:53:04 2024 -0700 Re-enable and fix shouldBlowTheWorkQueueSize test. Server error handling was incorrect in some cases as the initial HttpResponse is never sent if the failure happened before the task is submitted. The driver didn't properly handle errors that were serialized in GraphBinary. --- .../handler/HttpGremlinResponseStreamDecoder.java | 15 +++-- .../server/handler/HttpGremlinEndpointHandler.java | 2 + .../gremlin/server/handler/HttpHandlerUtil.java| 15 + .../tinkerpop/gremlin/server/handler/StateKey.java | 5 ++ .../gremlin/server/GremlinServerIntegrateTest.java | 69 +++--- 5 files changed, 65 insertions(+), 41 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java index d38220a4ca..d271e0dc0d 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java @@ -24,6 +24,7 @@ import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.http.DefaultHttpObject; import io.netty.handler.codec.http.HttpContent; +import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.HttpResponseStatus; @@ -34,7 +35,9 @@ import io.netty.util.AttributeMap; import io.netty.util.CharsetUtil; import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; +import org.apache.tinkerpop.gremlin.util.ser.SerTokensV4; import org.apache.tinkerpop.gremlin.util.ser.SerializationException; +import org.apache.tinkerpop.gremlin.util.ser.SerializersV4; import org.apache.tinkerpop.shaded.jackson.databind.JsonNode; import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper; @@ -45,6 +48,7 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder IS_FIRST_CHUNK = AttributeKey.valueOf("isFirstChunk"); private static final AttributeKey RESPONSE_STATUS = AttributeKey.valueOf("responseStatus"); +private static final AttributeKey RESPONSE_ENCODING = AttributeKey.valueOf("responseSerializer"); private static final AttributeKey BYTES_READ = AttributeKey.valueOf("bytesRead"); private final MessageSerializerV4 serializer; @@ -60,14 +64,14 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder out) throws Exception { final Attribute isFirstChunk = ((AttributeMap) ctx).attr(IS_FIRST_CHUNK); final Attribute responseStatus = ((AttributeMap) ctx).attr(RESPONSE_STATUS); +final Attribute responseEncoding = ((AttributeMap) ctx).attr(RESPONSE_ENCODING); if (msg instanceof HttpResponse) { ctx.channel().attr(BYTES_READ).set(0); -responseStatus.set(((HttpResponse) msg).status()); -if (isError(((HttpResponse) msg).status())) { -return; -} +final HttpResponse resp = (HttpResponse) msg; +responseStatus.set(resp.status()); + responseEncoding.set(resp.headers().get(HttpHeaderNames.CONTENT_TYPE)); isFirstChunk.set(true); } @@ -88,9 +92,8 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder> serializer = ctx.channel().attr(StateKey.SERIALIZER).get(); final Context requestCtx = new Context(requestMessage, ctx, settings, graphManager, gremlinExecutor, @@ -200,6 +201,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler REQUEST_ID = AttributeKey.valueOf("requestId"); +/** + * The key for whether a {@link io.netty.handler.codec.http.HttpResponse} has been sent for the current response. + */ +public static final AttributeKey HTTP_RESPONSE_SENT = AttributeKey.valueOf("responseSent"); + /** * The key for the current {@link AuthenticatedUser}. */ diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 75dcf666c7..ac153b4dc0 100644 --- a/gremlin-server/src/test/java/
(tinkerpop) branch http-initial-error-fix created (now dcd0c96d63)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git at dcd0c96d63 Re-enable and fix shouldBlowTheWorkQueueSize test. This branch includes the following new commits: new dcd0c96d63 Re-enable and fix shouldBlowTheWorkQueueSize test. The 1 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.
(tinkerpop) branch http-initial-error-fix updated (dcd0c96d63 -> cb1d34caeb)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard dcd0c96d63 Re-enable and fix shouldBlowTheWorkQueueSize test. new 0bc007e3cb Re-enable and fix shouldBlowTheWorkQueueSize test CTR. new cb1d34caeb Update timing of returning connection and server pipelining CTR. 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 (dcd0c96d63) \ N -- N -- N refs/heads/http-initial-error-fix (cb1d34caeb) 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 2 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: .../tinkerpop/gremlin/driver/Channelizer.java | 3 ++- .../driver/handler/GremlinResponseHandler.java | 9 .../handler/HttpGremlinResponseStreamDecoder.java | 24 +++-- .../server/handler/HttpRequestIdHandler.java | 25 +- 4 files changed, 49 insertions(+), 12 deletions(-)
(tinkerpop) 01/02: Re-enable and fix shouldBlowTheWorkQueueSize test CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 0bc007e3cb57045fd61fdcbd4f3918622f8796c3 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Sat Jun 8 10:53:04 2024 -0700 Re-enable and fix shouldBlowTheWorkQueueSize test CTR. Server error handling was incorrect in some cases as the initial HttpResponse is never sent if the failure happened before the task is submitted. The driver didn't properly handle errors that were serialized in GraphBinary. --- .../handler/HttpGremlinResponseStreamDecoder.java | 15 +++-- .../server/handler/HttpGremlinEndpointHandler.java | 2 + .../gremlin/server/handler/HttpHandlerUtil.java| 15 + .../tinkerpop/gremlin/server/handler/StateKey.java | 5 ++ .../gremlin/server/GremlinServerIntegrateTest.java | 69 +++--- 5 files changed, 65 insertions(+), 41 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java index d38220a4ca..d271e0dc0d 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java @@ -24,6 +24,7 @@ import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.http.DefaultHttpObject; import io.netty.handler.codec.http.HttpContent; +import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.HttpResponseStatus; @@ -34,7 +35,9 @@ import io.netty.util.AttributeMap; import io.netty.util.CharsetUtil; import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; +import org.apache.tinkerpop.gremlin.util.ser.SerTokensV4; import org.apache.tinkerpop.gremlin.util.ser.SerializationException; +import org.apache.tinkerpop.gremlin.util.ser.SerializersV4; import org.apache.tinkerpop.shaded.jackson.databind.JsonNode; import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper; @@ -45,6 +48,7 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder IS_FIRST_CHUNK = AttributeKey.valueOf("isFirstChunk"); private static final AttributeKey RESPONSE_STATUS = AttributeKey.valueOf("responseStatus"); +private static final AttributeKey RESPONSE_ENCODING = AttributeKey.valueOf("responseSerializer"); private static final AttributeKey BYTES_READ = AttributeKey.valueOf("bytesRead"); private final MessageSerializerV4 serializer; @@ -60,14 +64,14 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder out) throws Exception { final Attribute isFirstChunk = ((AttributeMap) ctx).attr(IS_FIRST_CHUNK); final Attribute responseStatus = ((AttributeMap) ctx).attr(RESPONSE_STATUS); +final Attribute responseEncoding = ((AttributeMap) ctx).attr(RESPONSE_ENCODING); if (msg instanceof HttpResponse) { ctx.channel().attr(BYTES_READ).set(0); -responseStatus.set(((HttpResponse) msg).status()); -if (isError(((HttpResponse) msg).status())) { -return; -} +final HttpResponse resp = (HttpResponse) msg; +responseStatus.set(resp.status()); + responseEncoding.set(resp.headers().get(HttpHeaderNames.CONTENT_TYPE)); isFirstChunk.set(true); } @@ -88,9 +92,8 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder> serializer = ctx.channel().attr(StateKey.SERIALIZER).get(); final Context requestCtx = new Context(requestMessage, ctx, settings, graphManager, gremlinExecutor, @@ -200,6 +201,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler REQUEST_ID = AttributeKey.valueOf("requestId"); +/** + * The key for whether a {@link io.netty.handler.codec.http.HttpResponse} has been sent for the current response. + */ +public static final AttributeKey HTTP_RESPONSE_SENT = AttributeKey.valueOf("responseSent"); + /** * The key for the current {@link AuthenticatedUser}. */ diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 75dcf666c7..ac153b4dc0 100644 --- a/gremlin-server/src/tes
(tinkerpop) 02/02: Update timing of returning connection and server pipelining CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit cb1d34caeb7ac2cd8c7335766cdf9229fc02b5de Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue Jun 11 18:42:16 2024 -0700 Update timing of returning connection and server pipelining CTR. The connection was being returned back to the pool too early as sometimes the LastHttpContent had not yet been received. Changing it to only release after the LastHttpContent has been received will prevent accidentally using the same channel for multiple requests. The server will now ignore incoming requests if it is already handling a request which stops pipelining from working altogether. This prevents accidentally using the same channel for multiple requests on the server side which caused errors due to concurrent modification of channel state. --- .../tinkerpop/gremlin/driver/Channelizer.java | 3 ++- .../driver/handler/GremlinResponseHandler.java | 9 .../handler/HttpGremlinResponseStreamDecoder.java | 24 +++-- .../server/handler/HttpRequestIdHandler.java | 25 +- 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java index d2e393f100..41f3f5eb13 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java @@ -28,6 +28,7 @@ import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.http.HttpClientCodec; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslHandler; +import io.netty.util.AttributeKey; import org.apache.tinkerpop.gremlin.driver.handler.GremlinResponseHandler; import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinRequestEncoder; import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinResponseStreamDecoder; @@ -155,7 +156,7 @@ public interface Channelizer extends ChannelHandler { * channelizer. Only sessionless requests are possible. */ final class HttpChannelizer extends AbstractChannelizer { - +public static final AttributeKey LAST_CONTENT_READ = AttributeKey.valueOf("lastContentRead"); private HttpGremlinRequestEncoder gremlinRequestEncoder; private HttpGremlinResponseStreamDecoder gremlinResponseDecoder; diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java index 88e8a740e6..8b550c86d2 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java @@ -34,6 +34,8 @@ import org.slf4j.LoggerFactory; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import static org.apache.tinkerpop.gremlin.driver.Channelizer.HttpChannelizer.LAST_CONTENT_READ; + /** * Takes a map of requests pending responses and writes responses to the {@link ResultQueue} of a request * as the {@link ResponseMessageV4} objects are deserialized. @@ -60,10 +62,10 @@ public class GremlinResponseHandler extends SimpleChannelInboundHandler data = response.getResult().getData(); // unrolls the collection into individual results to be handled by the queue. data.forEach(item -> queue.add(new Result(item))); @@ -75,8 +77,7 @@ public class GremlinResponseHandler extends SimpleChannelInboundHandler { +import static org.apache.tinkerpop.gremlin.driver.Channelizer.HttpChannelizer.LAST_CONTENT_READ; +public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder { private static final AttributeKey IS_FIRST_CHUNK = AttributeKey.valueOf("isFirstChunk"); private static final AttributeKey RESPONSE_STATUS = AttributeKey.valueOf("responseStatus"); private static final AttributeKey RESPONSE_ENCODING = AttributeKey.valueOf("responseSerializer"); private static final AttributeKey BYTES_READ = AttributeKey.valueOf("bytesRead"); +private static final ResponseMessageV4 EMPTY_RESPONSE = + ResponseMessageV4.build().code(HttpResponseStatus.OK).result(Collections.emptyList()).create(); + private final MessageSerializerV4 serializer; private final int maxContentLength; private final ObjectMapper mapper = new ObjectMapper(); @@ -68,6 +73,7 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder IN
(tinkerpop) 01/03: Check for server pipelining CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit bfac6adfa1d812a135e7f00901dc87c3592dc9e7 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue Jun 11 18:42:16 2024 -0700 Check for server pipelining CTR. The server will now ignore incoming requests if it is already handling a request which stops pipelining from working altogether. This prevents accidentally using the same channel for multiple requests on the server side which caused errors due to concurrent modification of channel state. --- .../server/handler/HttpRequestIdHandler.java | 25 +- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java index 824fc477c6..02ed6df191 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java @@ -22,7 +22,11 @@ import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; +import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponse; +import io.netty.handler.codec.http.LastHttpContent; +import io.netty.util.AttributeKey; +import io.netty.util.ReferenceCountUtil; import java.util.UUID; @@ -31,11 +35,27 @@ import java.util.UUID; */ @ChannelHandler.Sharable public class HttpRequestIdHandler extends ChannelDuplexHandler { +/** + * The key for whether a {@link io.netty.handler.codec.http.HttpResponse} has been sent for the current response. + */ +private static final AttributeKey IN_USE = AttributeKey.valueOf("inUse"); + public static String REQUEST_ID_HEADER_NAME = "Gremlin-RequestId"; @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { -ctx.channel().attr(StateKey.REQUEST_ID).set(UUID.randomUUID()); +if (msg instanceof HttpRequest) { +final Boolean currentlyInUse = ctx.channel().attr(IN_USE).get(); +if (currentlyInUse != null && currentlyInUse == true) { +// Pipelining not supported so just ignore the request if another request already being handled. +ReferenceCountUtil.release(msg); +return; +} + +ctx.channel().attr(StateKey.REQUEST_ID).set(UUID.randomUUID()); +ctx.channel().attr(IN_USE).set(true); +} + ctx.fireChannelRead(msg); } @@ -44,7 +64,10 @@ public class HttpRequestIdHandler extends ChannelDuplexHandler { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; response.headers().add(REQUEST_ID_HEADER_NAME, ctx.channel().attr(StateKey.REQUEST_ID).get()); +} else if (msg instanceof LastHttpContent) { +ctx.channel().attr(IN_USE).set(false); } + ctx.write(msg, promise); } }
(tinkerpop) 02/03: Prevent Java driver channel from being reused too early.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 5c69d0522cb5b43e91f03e2fd8a48a48b0215893 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue Jun 11 23:01:02 2024 -0700 Prevent Java driver channel from being reused too early. The connection was being returned too quickly before all HttpContent were read. This modifies the driver's handlers by ensuring that the LastHttpContent has been handled before returning the connection. The same was done for the SimpleHttpClient. As a consequence, some tests needed to be updated as they will now have up to two more empty ResponseMessageV4s added to the end. --- .../tinkerpop/gremlin/driver/Channelizer.java | 8 ++ .../driver/handler/GremlinResponseHandler.java | 30 +++--- .../handler/HttpGremlinResponseStreamDecoder.java | 13 +- .../gremlin/driver/simple/AbstractClient.java | 23 - .../gremlin/driver/simple/SimpleHttpClient.java| 28 +++- .../gremlin/server/GremlinServerIntegrateTest.java | 14 +++--- 6 files changed, 72 insertions(+), 44 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java index d2e393f100..5d8af18a3f 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java @@ -26,6 +26,7 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.http.HttpClientCodec; +import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslHandler; import org.apache.tinkerpop.gremlin.driver.handler.GremlinResponseHandler; @@ -33,7 +34,9 @@ import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinRequestEncoder; import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinResponseStreamDecoder; import org.apache.tinkerpop.gremlin.driver.handler.SslCheckHandler; import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; +import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; +import java.util.Collections; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; @@ -155,6 +158,11 @@ public interface Channelizer extends ChannelHandler { * channelizer. Only sessionless requests are possible. */ final class HttpChannelizer extends AbstractChannelizer { +/** + * This response is used as a signal for determining if all content of the response has been read. + */ +public static final ResponseMessageV4 LAST_CONTENT_READ_RESPONSE = + ResponseMessageV4.build().code(HttpResponseStatus.NO_CONTENT).result(Collections.emptyList()).create(); private HttpGremlinRequestEncoder gremlinRequestEncoder; private HttpGremlinResponseStreamDecoder gremlinResponseDecoder; diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java index 88e8a740e6..83203f964c 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java @@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.driver.handler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.util.AttributeKey; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.driver.Result; import org.apache.tinkerpop.gremlin.driver.ResultQueue; @@ -34,12 +35,15 @@ import org.slf4j.LoggerFactory; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import static org.apache.tinkerpop.gremlin.driver.Channelizer.HttpChannelizer.LAST_CONTENT_READ_RESPONSE; + /** * Takes a map of requests pending responses and writes responses to the {@link ResultQueue} of a request * as the {@link ResponseMessageV4} objects are deserialized. */ public class GremlinResponseHandler extends SimpleChannelInboundHandler { private static final Logger logger = LoggerFactory.getLogger(GremlinResponseHandler.class); +private static final AttributeKey CAUGHT_EXCEPTION = AttributeKey.valueOf("caughtException"); private final AtomicReference pending; public Gremlin
(tinkerpop) branch http-initial-error-fix updated (cb1d34caeb -> 0760d33af5)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard cb1d34caeb Update timing of returning connection and server pipelining CTR. new bfac6adfa1 Check for server pipelining CTR. new 5c69d0522c Prevent Java driver channel from being reused too early. new 0760d33af5 Update console test to use line separator CTR 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 (cb1d34caeb) \ N -- N -- N refs/heads/http-initial-error-fix (0760d33af5) 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 3 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: .../gremlin/console/GremlinGroovyshTest.groovy | 4 +-- .../tinkerpop/gremlin/driver/Channelizer.java | 11 ++-- .../driver/handler/GremlinResponseHandler.java | 29 +++--- .../handler/HttpGremlinResponseStreamDecoder.java | 25 +-- .../gremlin/driver/simple/AbstractClient.java | 23 - .../gremlin/driver/simple/SimpleHttpClient.java| 28 - .../gremlin/server/GremlinServerIntegrateTest.java | 14 --- 7 files changed, 74 insertions(+), 60 deletions(-)
(tinkerpop) 03/03: Update console test to use line separator CTR
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 0760d33af539600c448460e31254e49522a9645b Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Wed Jun 12 12:17:21 2024 -0700 Update console test to use line separator CTR --- .../org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy b/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy index dd4aed29e7..843abaf84b 100644 --- a/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy +++ b/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy @@ -56,7 +56,7 @@ class GremlinGroovyshTest extends AbstractGremlinServerIntegrationTest { shell.execute("g.V().count().next()") // 6 vertices in modern graph -assertTrue(out.toString().endsWith("6\r\n")) +assertTrue(out.toString().endsWith("6" + System.lineSeparator())) } @Test @@ -70,7 +70,7 @@ class GremlinGroovyshTest extends AbstractGremlinServerIntegrationTest { shell.execute("g.V().count().next()") // 6 vertices in modern graph -assertTrue(out.toString().endsWith("6\r\n")) +assertTrue(out.toString().endsWith("6" + System.lineSeparator())) } @Override
(tinkerpop) 02/02: Update console test to use line separator CTR
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 80a879a90182c445cd04c96b1a7a5cfe03b27d2d Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Wed Jun 12 12:17:21 2024 -0700 Update console test to use line separator CTR --- .../org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy b/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy index dd4aed29e7..843abaf84b 100644 --- a/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy +++ b/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy @@ -56,7 +56,7 @@ class GremlinGroovyshTest extends AbstractGremlinServerIntegrationTest { shell.execute("g.V().count().next()") // 6 vertices in modern graph -assertTrue(out.toString().endsWith("6\r\n")) +assertTrue(out.toString().endsWith("6" + System.lineSeparator())) } @Test @@ -70,7 +70,7 @@ class GremlinGroovyshTest extends AbstractGremlinServerIntegrationTest { shell.execute("g.V().count().next()") // 6 vertices in modern graph -assertTrue(out.toString().endsWith("6\r\n")) +assertTrue(out.toString().endsWith("6" + System.lineSeparator())) } @Override
(tinkerpop) branch http-initial-error-fix updated (0760d33af5 -> 80a879a901)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard 0760d33af5 Update console test to use line separator CTR discard 5c69d0522c Prevent Java driver channel from being reused too early. new 2e25a2d567 Prevent Java driver channel from being reused too early CTR. new 80a879a901 Update console test to use line separator CTR 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 (0760d33af5) \ N -- N -- N refs/heads/http-initial-error-fix (80a879a901) 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 2 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: .../driver/handler/HttpGremlinResponseStreamDecoder.java | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-)
(tinkerpop) 01/02: Prevent Java driver channel from being reused too early CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 2e25a2d567037bcc2abb6fc7f27a60e1155e0b6b Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue Jun 11 23:01:02 2024 -0700 Prevent Java driver channel from being reused too early CTR. The connection was being returned too quickly before all HttpContent were read. This modifies the driver's handlers by ensuring that the LastHttpContent has been handled before returning the connection. The same was done for the SimpleHttpClient. As a consequence, some tests needed to be updated as they will now have up to two more empty ResponseMessageV4s added to the end. --- .../tinkerpop/gremlin/driver/Channelizer.java | 8 ++ .../driver/handler/GremlinResponseHandler.java | 30 +++--- .../handler/HttpGremlinResponseStreamDecoder.java | 22 +++- .../gremlin/driver/simple/AbstractClient.java | 23 - .../gremlin/driver/simple/SimpleHttpClient.java| 28 +++- .../gremlin/server/GremlinServerIntegrateTest.java | 14 +++--- 6 files changed, 75 insertions(+), 50 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java index d2e393f100..5d8af18a3f 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java @@ -26,6 +26,7 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.http.HttpClientCodec; +import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslHandler; import org.apache.tinkerpop.gremlin.driver.handler.GremlinResponseHandler; @@ -33,7 +34,9 @@ import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinRequestEncoder; import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinResponseStreamDecoder; import org.apache.tinkerpop.gremlin.driver.handler.SslCheckHandler; import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; +import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; +import java.util.Collections; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; @@ -155,6 +158,11 @@ public interface Channelizer extends ChannelHandler { * channelizer. Only sessionless requests are possible. */ final class HttpChannelizer extends AbstractChannelizer { +/** + * This response is used as a signal for determining if all content of the response has been read. + */ +public static final ResponseMessageV4 LAST_CONTENT_READ_RESPONSE = + ResponseMessageV4.build().code(HttpResponseStatus.NO_CONTENT).result(Collections.emptyList()).create(); private HttpGremlinRequestEncoder gremlinRequestEncoder; private HttpGremlinResponseStreamDecoder gremlinResponseDecoder; diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java index 88e8a740e6..83203f964c 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java @@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.driver.handler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.util.AttributeKey; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.driver.Result; import org.apache.tinkerpop.gremlin.driver.ResultQueue; @@ -34,12 +35,15 @@ import org.slf4j.LoggerFactory; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import static org.apache.tinkerpop.gremlin.driver.Channelizer.HttpChannelizer.LAST_CONTENT_READ_RESPONSE; + /** * Takes a map of requests pending responses and writes responses to the {@link ResultQueue} of a request * as the {@link ResponseMessageV4} objects are deserialized. */ public class GremlinResponseHandler extends SimpleChannelInboundHandler { private static final Logger logger = LoggerFactory.getLogger(GremlinResponseHandler.class); +private static final AttributeKey CAUGHT_EXCEPTION = AttributeKey.valueOf("caughtException"); private final AtomicReference pending; public Gremlin
(tinkerpop) 01/03: Check for server pipelining CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 2b67fcd9ede1d61575f92ebf8cc01795876f92fc Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue Jun 11 18:42:16 2024 -0700 Check for server pipelining CTR. The server will now ignore incoming requests if it is already handling a request which stops pipelining from working altogether. This prevents accidentally using the same channel for multiple requests on the server side which caused errors due to concurrent modification of channel state. --- .../server/handler/HttpRequestIdHandler.java | 32 +- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java index 824fc477c6..19822a057b 100644 --- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java +++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java @@ -22,7 +22,11 @@ import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; +import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponse; +import io.netty.handler.codec.http.LastHttpContent; +import io.netty.util.AttributeKey; +import io.netty.util.ReferenceCountUtil; import java.util.UUID; @@ -31,20 +35,46 @@ import java.util.UUID; */ @ChannelHandler.Sharable public class HttpRequestIdHandler extends ChannelDuplexHandler { +/** + * The key for whether a {@link io.netty.handler.codec.http.HttpResponse} has been sent for the current response. + */ +private static final AttributeKey IN_USE = AttributeKey.valueOf("inUse"); + public static String REQUEST_ID_HEADER_NAME = "Gremlin-RequestId"; @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { -ctx.channel().attr(StateKey.REQUEST_ID).set(UUID.randomUUID()); +if (msg instanceof HttpRequest) { +final Boolean currentlyInUse = ctx.channel().attr(IN_USE).get(); +if (currentlyInUse != null && currentlyInUse == true) { +// Pipelining not supported so just ignore the request if another request already being handled. +ReferenceCountUtil.release(msg); +return; +} + +ctx.channel().attr(StateKey.REQUEST_ID).set(UUID.randomUUID()); +ctx.channel().attr(IN_USE).set(true); +} + ctx.fireChannelRead(msg); } +@Override +public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { +ctx.channel().attr(IN_USE).set(false); +super.exceptionCaught(ctx, cause); +} + @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { if (msg instanceof HttpResponse) { HttpResponse response = (HttpResponse) msg; response.headers().add(REQUEST_ID_HEADER_NAME, ctx.channel().attr(StateKey.REQUEST_ID).get()); } +if (msg instanceof LastHttpContent) { // possible for an object to be both HttpResponse and LastHttpContent. +ctx.channel().attr(IN_USE).set(false); +} + ctx.write(msg, promise); } }
(tinkerpop) 03/03: Update console test to use line separator CTR
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 1f6aba2486500e486df1895819b3632b91c1002e Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Wed Jun 12 12:17:21 2024 -0700 Update console test to use line separator CTR --- .../org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy b/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy index dd4aed29e7..843abaf84b 100644 --- a/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy +++ b/gremlin-console/src/test/groovy/org/apache/tinkerpop/gremlin/console/GremlinGroovyshTest.groovy @@ -56,7 +56,7 @@ class GremlinGroovyshTest extends AbstractGremlinServerIntegrationTest { shell.execute("g.V().count().next()") // 6 vertices in modern graph -assertTrue(out.toString().endsWith("6\r\n")) +assertTrue(out.toString().endsWith("6" + System.lineSeparator())) } @Test @@ -70,7 +70,7 @@ class GremlinGroovyshTest extends AbstractGremlinServerIntegrationTest { shell.execute("g.V().count().next()") // 6 vertices in modern graph -assertTrue(out.toString().endsWith("6\r\n")) +assertTrue(out.toString().endsWith("6" + System.lineSeparator())) } @Override
(tinkerpop) branch http-initial-error-fix updated (80a879a901 -> 1f6aba2486)
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a change to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git discard 80a879a901 Update console test to use line separator CTR discard 2e25a2d567 Prevent Java driver channel from being reused too early CTR. discard bfac6adfa1 Check for server pipelining CTR. new 2b67fcd9ed Check for server pipelining CTR. new 02f638ad89 Prevent Java driver channel from being reused too early CTR. new 1f6aba2486 Update console test to use line separator CTR 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 (80a879a901) \ N -- N -- N refs/heads/http-initial-error-fix (1f6aba2486) 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 3 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: .../tinkerpop/gremlin/server/handler/HttpRequestIdHandler.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-)
(tinkerpop) 02/03: Prevent Java driver channel from being reused too early CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch http-initial-error-fix in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 02f638ad898636b844c401ab18474a93f574738b Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Tue Jun 11 23:01:02 2024 -0700 Prevent Java driver channel from being reused too early CTR. The connection was being returned too quickly before all HttpContent were read. This modifies the driver's handlers by ensuring that the LastHttpContent has been handled before returning the connection. The same was done for the SimpleHttpClient. As a consequence, some tests needed to be updated as they will now have up to two more empty ResponseMessageV4s added to the end. --- .../tinkerpop/gremlin/driver/Channelizer.java | 8 ++ .../driver/handler/GremlinResponseHandler.java | 30 +++--- .../handler/HttpGremlinResponseStreamDecoder.java | 22 +++- .../gremlin/driver/simple/AbstractClient.java | 23 - .../gremlin/driver/simple/SimpleHttpClient.java| 28 +++- .../gremlin/server/GremlinServerIntegrateTest.java | 14 +++--- 6 files changed, 75 insertions(+), 50 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java index d2e393f100..5d8af18a3f 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Channelizer.java @@ -26,6 +26,7 @@ import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelPipeline; import io.netty.channel.socket.SocketChannel; import io.netty.handler.codec.http.HttpClientCodec; +import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.ssl.SslContext; import io.netty.handler.ssl.SslHandler; import org.apache.tinkerpop.gremlin.driver.handler.GremlinResponseHandler; @@ -33,7 +34,9 @@ import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinRequestEncoder; import org.apache.tinkerpop.gremlin.driver.handler.HttpGremlinResponseStreamDecoder; import org.apache.tinkerpop.gremlin.driver.handler.SslCheckHandler; import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; +import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; +import java.util.Collections; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; @@ -155,6 +158,11 @@ public interface Channelizer extends ChannelHandler { * channelizer. Only sessionless requests are possible. */ final class HttpChannelizer extends AbstractChannelizer { +/** + * This response is used as a signal for determining if all content of the response has been read. + */ +public static final ResponseMessageV4 LAST_CONTENT_READ_RESPONSE = + ResponseMessageV4.build().code(HttpResponseStatus.NO_CONTENT).result(Collections.emptyList()).create(); private HttpGremlinRequestEncoder gremlinRequestEncoder; private HttpGremlinResponseStreamDecoder gremlinResponseDecoder; diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java index 88e8a740e6..83203f964c 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/GremlinResponseHandler.java @@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.driver.handler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.HttpResponseStatus; +import io.netty.util.AttributeKey; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.tinkerpop.gremlin.driver.Result; import org.apache.tinkerpop.gremlin.driver.ResultQueue; @@ -34,12 +35,15 @@ import org.slf4j.LoggerFactory; import java.util.List; import java.util.concurrent.atomic.AtomicReference; +import static org.apache.tinkerpop.gremlin.driver.Channelizer.HttpChannelizer.LAST_CONTENT_READ_RESPONSE; + /** * Takes a map of requests pending responses and writes responses to the {@link ResultQueue} of a request * as the {@link ResponseMessageV4} objects are deserialized. */ public class GremlinResponseHandler extends SimpleChannelInboundHandler { private static final Logger logger = LoggerFactory.getLogger(GremlinResponseHandler.class); +private static final AttributeKey CAUGHT_EXCEPTION = AttributeKey.valueOf("caughtException"); private final AtomicReference pending; public Gremlin
(tinkerpop) 01/04: Re-enable and fix shouldBlowTheWorkQueueSize test CTR.
This is an automated email from the ASF dual-hosted git repository. kenhuuu pushed a commit to branch master-http in repository https://gitbox.apache.org/repos/asf/tinkerpop.git commit 82bfa9e7e4e67e13d90c3dba314684085c721c75 Author: Ken Hu <106191785+kenh...@users.noreply.github.com> AuthorDate: Sat Jun 8 10:53:04 2024 -0700 Re-enable and fix shouldBlowTheWorkQueueSize test CTR. Server error handling was incorrect in some cases as the initial HttpResponse is never sent if the failure happened before the task is submitted. The driver didn't properly handle errors that were serialized in GraphBinary. --- .../handler/HttpGremlinResponseStreamDecoder.java | 15 +++-- .../server/handler/HttpGremlinEndpointHandler.java | 2 + .../gremlin/server/handler/HttpHandlerUtil.java| 15 + .../tinkerpop/gremlin/server/handler/StateKey.java | 5 ++ .../gremlin/server/GremlinServerIntegrateTest.java | 69 +++--- 5 files changed, 65 insertions(+), 41 deletions(-) diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java index d38220a4ca..d271e0dc0d 100644 --- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java +++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/HttpGremlinResponseStreamDecoder.java @@ -24,6 +24,7 @@ import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.TooLongFrameException; import io.netty.handler.codec.http.DefaultHttpObject; import io.netty.handler.codec.http.HttpContent; +import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.HttpResponseStatus; @@ -34,7 +35,9 @@ import io.netty.util.AttributeMap; import io.netty.util.CharsetUtil; import org.apache.tinkerpop.gremlin.util.MessageSerializerV4; import org.apache.tinkerpop.gremlin.util.message.ResponseMessageV4; +import org.apache.tinkerpop.gremlin.util.ser.SerTokensV4; import org.apache.tinkerpop.gremlin.util.ser.SerializationException; +import org.apache.tinkerpop.gremlin.util.ser.SerializersV4; import org.apache.tinkerpop.shaded.jackson.databind.JsonNode; import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper; @@ -45,6 +48,7 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder IS_FIRST_CHUNK = AttributeKey.valueOf("isFirstChunk"); private static final AttributeKey RESPONSE_STATUS = AttributeKey.valueOf("responseStatus"); +private static final AttributeKey RESPONSE_ENCODING = AttributeKey.valueOf("responseSerializer"); private static final AttributeKey BYTES_READ = AttributeKey.valueOf("bytesRead"); private final MessageSerializerV4 serializer; @@ -60,14 +64,14 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder out) throws Exception { final Attribute isFirstChunk = ((AttributeMap) ctx).attr(IS_FIRST_CHUNK); final Attribute responseStatus = ((AttributeMap) ctx).attr(RESPONSE_STATUS); +final Attribute responseEncoding = ((AttributeMap) ctx).attr(RESPONSE_ENCODING); if (msg instanceof HttpResponse) { ctx.channel().attr(BYTES_READ).set(0); -responseStatus.set(((HttpResponse) msg).status()); -if (isError(((HttpResponse) msg).status())) { -return; -} +final HttpResponse resp = (HttpResponse) msg; +responseStatus.set(resp.status()); + responseEncoding.set(resp.headers().get(HttpHeaderNames.CONTENT_TYPE)); isFirstChunk.set(true); } @@ -88,9 +92,8 @@ public class HttpGremlinResponseStreamDecoder extends MessageToMessageDecoder> serializer = ctx.channel().attr(StateKey.SERIALIZER).get(); final Context requestCtx = new Context(requestMessage, ctx, settings, graphManager, gremlinExecutor, @@ -200,6 +201,7 @@ public class HttpGremlinEndpointHandler extends SimpleChannelInboundHandler REQUEST_ID = AttributeKey.valueOf("requestId"); +/** + * The key for whether a {@link io.netty.handler.codec.http.HttpResponse} has been sent for the current response. + */ +public static final AttributeKey HTTP_RESPONSE_SENT = AttributeKey.valueOf("responseSent"); + /** * The key for the current {@link AuthenticatedUser}. */ diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java index 75dcf666c7..ac153b4dc0 100644 --- a/gremlin-server/src/test/java/org/apac