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

Optimistic Transactions / Queued Operations Problems #50

Open
andyjefferson opened this issue Apr 11, 2016 · 1 comment
Open

Optimistic Transactions / Queued Operations Problems #50

andyjefferson opened this issue Apr 11, 2016 · 1 comment

Comments

@andyjefferson
Copy link
Member

andyjefferson commented Apr 11, 2016

The current technique used to queue operations in optimistic transactions is flawed: it queues operations per collection and does not honour the order of operations between different collections. If I have an optimistic transaction which does the following:

(given: two objects with collection properties, one object of element type)

objectA.collection.add(element)
objectA.collection.remove(element)
objectB.collection.add(element)
objectB.collection.remove(element)
objectA.collection.add(element)

The outcome after commit depends on the order in which the collections are processed.

A: add(element), remove(element), add(element)
B: add(element), remove(element)

With relationship management, element.owner would now be null; if B is processed first, it would be A. If everything was processed in order, it would be A (i.e. A would be correct / expected).

Originally raised on old DN forum.

@andyjefferson
Copy link
Member Author

DataNucleus has had a single "OperationQueue" since v4.0 and so part of this was enabled back then.

In terms of RDBMS, CollectionMapping, MapMapping and ArrayMapping all have calls to ExecutionContext.flushOperationsForBackingStore and these would need removing, and instead to go through the queued operations one by one (as well as processing inserts/updates/deletes in the same way via the OperationQueue).

Clearly though we need testcase(s) that demonstrate the need for this before anything happens

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

No branches or pull requests

1 participant