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

Fix problem running MERGE inside FOREACH in compatibility mode #7146

Merged
merged 2 commits into from
May 18, 2016

Conversation

systay
Copy link
Contributor

@systay systay commented May 17, 2016

No description provided.

@@ -36,71 +36,70 @@
{
public Lock exclusiveLock( Supplier<Statement> stmtSupplier, PropertyContainer container )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is also used by the TopLevelTransaction or PlaceboTransaction in order to implement Transaction.acquireWriteLock(PropertyContainer).

The Supplier<Statement> passed in through that API will actually "acquire a new" statement (the implementation of course will acquire a new statement by incrementing the reference count on the current statement, and to make things more confusing this is done via a method call called currentStatement despite it actually providing a new statement). Thus not closing the statement in this method will cause unbalanced statements for transactions that do explicit locking.

@systay systay force-pushed the foreach-merge-2.3 branch 3 times, most recently from c588bb4 to e406cc6 Compare May 17, 2016 16:42
@systay
Copy link
Contributor Author

systay commented May 17, 2016

Thanks @thobe. WDYT about this solution?

*/
public Lock exclusiveLock( Statement statement, PropertyContainer container )
{
if ( container instanceof Node )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now shared and exclusive have different behaviour when they deal with statement: not closing and closing it, which is bad

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really - there are is a exclusive/share version of the methods that take a Supplier<Statement>, but only a single exclusive version that does not close the statement after itself.

I agree that it's not pretty - this is just a bug fix in the 2.3 maintenance branch. When merging into the 3.0 branch, we should just do a null-merge, because this has already been fixed "for reals" there

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should rename the second kind of exclusiveLock something like exclusiveLockForCypherRuntime

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW @systay you are claiming that the fix is needed in 2.3, but the PR is issued against 3.0 and it is also labelled as such, mistake?

@thobe thobe merged commit 8066343 into neo4j:3.0 May 18, 2016
@davidegrohmann
Copy link
Contributor

@thobe since you have merged this PR now, does it need to be backported to 2.3? we merge it in 3.0 and the name of the branch we merged from contains "2.3"

@thobe
Copy link
Contributor

thobe commented May 18, 2016

@davidegrohmann no, the problem is only in the 2.3 compatibility mode in 3.x (at least so I'm told)

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

Successfully merging this pull request may close these issues.

6 participants