Community
Participate
Working Groups
Build Identifier: With a metamodel generated in native with containment proxy to true : 1. Control a model element to a new resource 2. Set a savepoint 3. Commit 4. Uncontrol this model element to its original resource 2. Set a savepoint 3. Commit 1. Control again this model element to the new resource 2. Set a savepoint 3. Commit I get the following exception on commit : org.eclipse.emf.cdo.util.CommitException: Rollback in MEMStore: java.lang.IllegalStateException: Origin revision not found for CDORevisionDelta[Root@OID5:0v3 --> [CDOFeatureDelta[null, CONTAINER, resource=OID6, container=OID4, feature=-1]]] at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.computeDirtyObject(TransactionCommitContext.java:959) at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.computeDirtyObjects(TransactionCommitContext.java:937) at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.write(TransactionCommitContext.java:455) at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:42) at org.eclipse.emf.cdo.spi.server.InternalCommitContext$1.runLoop(InternalCommitContext.java:1) at org.eclipse.net4j.util.om.monitor.ProgressDistributor.run(ProgressDistributor.java:96) at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicatingCommit(CommitTransactionIndication.java:244) at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:92) at org.eclipse.emf.cdo.server.internal.net4j.protocol.CDOServerIndicationWithMonitoring.indicating(CDOServerIndicationWithMonitoring.java:109) at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84) at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90) Reproducible: Always
Created attachment 212736 [details] JUnit test Attached a JUnit test to show the issue using a metamodel also in attachment.
Created attachment 212737 [details] The metamodel
Reproduced with CDO 4.0 SR2 but also with master.
If we doesn't set CDOSavePoint we doesn't have the exception, this seems related to https://bugs.eclipse.org/bugs/show_bug.cgi?id=352977 .
Removing the "childRoot" model element from its resource before adding to the new resource doesn't throws exception.
I regenerated model6 with containmentProxies=true and stripped down the test to the minimum to reproduce the problem: Root root = getModel6Factory().createRoot(); BaseObject childRoot = getModel6Factory().createBaseObject(); root.getListA().add(childRoot); CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResource mainResource = transaction.createResource(getResourcePath("/mainResource.model1")); mainResource.getContents().add(root); transaction.commit(); // Control childRoot to a new resource CDOResource fragmentResource = transaction.createResource(getResourcePath("/fragmentResource.model1")); fragmentResource.getContents().add(childRoot); transaction.commit(); // Uncontrol category1 to its original resource fragmentResource.getContents().remove(childRoot); transaction.setSavepoint(); // <---- Problem here!!! transaction.commit(); // Control again childRoot to the new resource fragmentResource.getContents().add(childRoot); transaction.commit(); It turns out that a single setSavepoint() call causes the problem. Removing it makes the test pass.
The problem is, again, this pathological combination of reattachment with multiple savepoints. It seems I can fix it with this code in CDOSavepointImpl.getAllRevisionDeltas(): Set<CDOID> reattachedObjects = savepoint.getReattachedObjects().keySet(); for (CDOID detachedID : savepoint.getDetachedObjects().keySet()) { if (!reattachedObjects.contains(detachedID)) { allRevisionDeltas.remove(detachedID); } } As you've suggested in comment 4 this is really related to bug 352977 which requires a larger redesign to give us more confidence.
Comment on attachment 212736 [details] JUnit test Esteban, please confirm that: 1) The number of lines that you changed is smaller than 250. 2) You are the only author of these changed lines. 3) You apply the EPL to these changed lines.
All suites pass. commit b255e7b5c36e07a796b294447d0caee8460a79e0
Port to 4.1 via bug 374882.
Created attachment 212989 [details] Patch
I confirm that: 1) The number of lines that I changed is smaller than 250. 2) I am the only author of these changed lines. 3) I apply the EPL to these changed lines. Thanks.
Closing.