Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Neo.TransientError.Transaction.Outdated Error #12251

Closed
ppoliani opened this issue Jul 26, 2019 · 8 comments
Closed

Neo.TransientError.Transaction.Outdated Error #12251

ppoliani opened this issue Jul 26, 2019 · 8 comments
Labels

Comments

@ppoliani
Copy link

I get an error from a query that used to run correctly.

Neo4j Version: 3.5.8-enterprice
Operating System: MacOS Mojave
API: Docker

Steps to reproduce

  1. Create a new HAS_PERSONAL relationship
MATCH (d:Document), (u:User {userId:"id1"})
WHERE ID(d)=16
MERGE (u)-[:HAS_PERSONAL]->(d)
RETURN d
  1. After the previous query is successful (and it is because I can see it in the Neo4j browser) I try to delete it
MATCH (u:User {userId:"id1"})-[ss:HAS_PERSONAL]->(d:Document)
WHERE ID(d)=16
DELETE ss
RETURN ss

Expected behavior

The relationship should be removed.

Actual behavior

I get the following error:

Database elements (nodes, relationships, properties) were observed during query execution, but got deleted by an overlapping committed transaction before the query results could be serialised. The transaction might succeed if it is retried.
@ppoliani ppoliani added the bug label Jul 26, 2019
@chrisvest
Copy link
Contributor

It occurs because your query is returning the deleted relationship, and the relationship object is not materialised (fully populated with properties, etc) until the result is being serialised, which, if you are using automatic rather than explicit transactions, happens after the transaction commits.

@ppoliani
Copy link
Author

@chrisvest thanks for the answer. Pardon my ignorance, but does it mean that you can return a deleted relationship? Is there a suggested alternative. The thing is that the same query works fine on version 3.3.3 but not in 3.5.8.

@InverseFalcon
Copy link

If you need to return the properties of the relationship, you can project those out before your delete and return those:

MATCH (u:User {userId:"id1"})-[ss:HAS_PERSONAL]->(d:Document)
WHERE ID(d)=16
WITH properties(ss) as deletedRelProps
DELETE ss
RETURN deletedRelProps

If you want the graph ID of the relationship too (and anything else you might need) you can use map projection first before the deletion:

MATCH (u:User {userId:"id1"})-[ss:HAS_PERSONAL]->(d:Document)
WHERE ID(d)=16
WITH ss {.*, graphID:id(ss)} as deletedRelProps
DELETE ss
RETURN deletedRelProps

@sherfert
Copy link
Contributor

sherfert commented Aug 5, 2019

@chrisvest The error message ... overlapping committed transaction ... is not very accurate though. Any chance on improving that?

@chrisvest
Copy link
Contributor

chrisvest commented Aug 5, 2019

@ppoliani The semantics of returning deleted entities are not well defined in the current Cypher versions. A proposal has been put forward that pins down the semantics in this area, but the current versions of Cypher do not yet implement it. Until then, we'll improve the error message.

@ppoliani
Copy link
Author

ppoliani commented Aug 5, 2019

@chrisvest Thanks for the reference. Will @InverseFalcon solution work at the moment?

@chrisvest
Copy link
Contributor

@ppoliani Yes, capturing the properties with a WITH prior to deleting the relationship works.

@ppoliani
Copy link
Author

ppoliani commented Aug 5, 2019

Fantastic! Shall we remove the bug label and close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants