vkagamlyk commented on code in PR #3161:
URL: https://github.com/apache/tinkerpop/pull/3161#discussion_r2216919114
##########
tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerTransactionGraph.java:
##########
@@ -152,11 +152,19 @@ public Vertex addVertex(final Object... keyValues) {
if (container != null && container.get() != null)
throw Exceptions.vertexWithIdAlreadyExists(idValue);
+ long version = txNumber;
+ if (container != null && container.isDeleted() &&
container.getModified() != null) {
+ // vertex being added was previously deleted
+ // we need to reference the version from the deleted state when
adding the vertex back
+ version = container.getModified().version();
+ container.unmarkDeleted((TinkerTransaction) tx());
+ }
+
// no existing container, let's use new one
if (container == null)
container = newContainer;
- final TinkerVertex vertex = new TinkerVertex(idValue, label, this,
txNumber);
+ final TinkerVertex vertex = new TinkerVertex(idValue, label, this,
version);
Review Comment:
I think you're right, for scenario remove-add in same transaction better to
preserve version, so `updatedOutsideTransaction()` will be correct.
and the test confirms it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]