Community
Participate
Working Groups
Build Identifier: CDO 4.0 GA 1) Open a CDO Transaction on a resource. 2) Delete one object (dummyObject) from its container. 3) Create a CDOSavePoint 4) Undo the delete operation 5) Create a CDOSavePoint 6) Modify the dummyObject, let say change one of its attributes for instance its name. 7) Create a CDOSavePoint. 8) Commit the CDO transaction. >> The modification made at step 6 is not committed due to the fact the dummyObject was contained in getSharedDetachedObjects. See the post at the following link to have the whole explanation : http://www.eclipse.org/forums/index.php/mv/msg/222265/702727/#msg_702727 Stephane. Reproducible: Always
Some infos about the evolution of the relevant CDO features: 1) Initially there was no support for savepoints or reattachment. All commit/rollback data was recorded in CDOTransactionImpl. 2) Later support for savepoints has been added. Basically by factoring the commit/rollback data into CDOSavepointImpl. Reattachment still wasn't considered. 3) Support for reattachment has been added to CDOSavepointImpl. The savepoint design was "inherited" from the former transaction design, meaning that a single savepoint only contains the delta compared to the preceeding savepoint. None of the following major operations can be executed without looking at several or all savepoints: - tx.commit() - tx.rollback() - tx.getXyzObjects() - savepoint.rollback() - savepoint.getXyzObjects() In addition the following issues are evident: - Reattachment over multiple savepoints is broken. - Netting out modifications is broken. - Preceeding savepoints can not be garbage collected. - One can not merge into a dirty transaction. - Passive updates and conflicts are not properly considered with savepoints. - Many other mechanisms suffer from the savepoint complexity. In essence, the mechanism is complex, functionally insufficent and often slow and hungry for heap space. Most of the above issues could be addressed by a major redesign of CDOSavepointImpl. All internal maps would be removed and replaced with a single one: Map<CDOID, ObjectRecord> objectRecords; class ObjectRecord { private final CDOState initialState; private final CDORevision initialRevision; private CDORevisionDelta revisionDelta; } This would be a one or two weeks effort because so many functions rely on the current design.
I have a hotfix in mind for this particular problem, though...
Created attachment 200415 [details] Patch v1 This patch removes the sharedDetachedObjects map and changes several getAllXyz() methods in CDOSavepointImpl (turn backward iteration into forward iteration, i.e. "chronological replay").
Test cases are in TransactionTest: testReattachCommit() testReattachModifyCommit() testReattachCommitWithSavepoints() testReattachModifyCommitWithSavepoints()
Committed revision 8821: - trunk/plugins/org.eclipse.emf.cdo - trunk/plugins/org.eclipse.emf.cdo.tests
The hotfix passes all tests. Resolving for now. Let me know if you want any of the other mentioned issues fixed.
Is it merged into CDO 4.0 maintenance branch ?
Yes, through bug 353172.
Closing.