| Summary: | CDOSavePoint and Reattachment issue | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Stephane fournier <stephane.fournier> | ||||
| Component: | cdo.core | Assignee: | Eike Stepper <stepper> | ||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | caspar_d, stepper, steve.monnier | ||||
| Version: | 4.1 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Stephane fournier
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. |