Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325549 - Synchronizable repository: order of commits is not ensured (CommitRunnable / WriteThroughCommitContext)
Summary: Synchronizable repository: order of commits is not ensured (CommitRunnable / ...
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard: offline-01
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-17 03:34 EDT by Erwin Betschart CLA
Modified: 2011-06-23 03:42 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erwin Betschart CLA 2010-09-17 03:34:49 EDT
Build Identifier: 4.0

Scenario:
1. Offline clone commits via WritheThroughCommitContext to the master repository (commit A).
2. A session on the master repository commits changes (commit B) which depend on the commit A.
3. The offline clone writes commit A to the store.
4. The offline clone receives an CDOSessionInvalidationEvent of commit B and put it to the local store.

Under certain circumstances 4. can be executed before 3. (E.g. commit A is huge and commit B is very small).

The following execption is then thrown: 
[ERROR] Failed to register revision: Tracker@OID1746:0v130
java.lang.IllegalStateException: Failed to register revision: Tracker@OID1746:0v130
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.addRevisions(TransactionCommitContext.java:995)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.updateInfraStructure(TransactionCommitContext.java:938)
	at org.eclipse.emf.cdo.internal.server.TransactionCommitContext.commit(TransactionCommitContext.java:352)
	at org.eclipse.emf.cdo.internal.server.syncing.SynchronizableRepository$WriteThroughCommitContext.commit(SynchronizableRepository.java:553)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$2.runLoop(InternalCommitContext.java:49)
	at org.eclipse.emf.cdo.spi.server.InternalCommitContext$2.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:329)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:187)
	at org.eclipse.emf.cdo.server.internal.net4j.protocol.CommitTransactionIndication.indicating(CommitTransactionIndication.java:122)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.indicating(IndicationWithMonitoring.java:84)
	at org.eclipse.net4j.signal.IndicationWithResponse.doExtendedInput(IndicationWithResponse.java:90)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:315)
	at org.eclipse.net4j.signal.IndicationWithResponse.execute(IndicationWithResponse.java:63)
	at org.eclipse.net4j.signal.IndicationWithMonitoring.execute(IndicationWithMonitoring.java:63)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:240)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:146)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)


Because the store alreay contains a newer object (from commit B) than the one from commit A.


Reproducible: Sometimes
Comment 1 Eike Stepper CLA 2010-09-17 07:30:25 EDT
Adding to SynchronizableRepository:
  private ReadLock writeThroughCommitLock;
  private WriteLock handleCommitInfoLock;
Comment 2 Eike Stepper CLA 2010-09-17 07:30:42 EDT
Committed to HEAD
Comment 3 Eike Stepper CLA 2011-06-23 03:42:03 EDT
Available in R20110608-1407