andreachild commented on code in PR #3161:
URL: https://github.com/apache/tinkerpop/pull/3161#discussion_r2216949693


##########
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) {

Review Comment:
   Moving the call to `unmarkDeleted` before the check for 
`vertexWithIdAlreadyExists` error would actually cause the error to be thrown 
because `unmarkDeleted` resets the `isDeletedInTx` value to `false` which 
causes `container.get()` to return non-null.
   
   ```
   /**
    * Get transaction specific value of stored element.
    */
   public T get() {
       if (isDeletedInTx.get()) return null;
       if (transactionUpdatedValue.get() != null) return 
transactionUpdatedValue.get();
       if (isDeleted) return null;
       return element;
   }
   ```



-- 
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]

Reply via email to