summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaspar De Groot2011-11-27 21:30:10 (EST)
committerCaspar De Groot2011-11-27 21:30:10 (EST)
commit97f9a70efe78b5b472b1a8b87bc7475adada5de2 (patch)
tree6c032bc6ad080e038e47c867174437bd580b27bc
parent2372a6d550fcdc21c038d345c5190829545e010c (diff)
downloadcdo-97f9a70efe78b5b472b1a8b87bc7475adada5de2.zip
cdo-97f9a70efe78b5b472b1a8b87bc7475adada5de2.tar.gz
cdo-97f9a70efe78b5b472b1a8b87bc7475adada5de2.tar.bz2
[364548] Exception "Durable locking is not enabled." during save of changes
https://bugs.eclipse.org/bugs/show_bug.cgi?id=364548
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java2
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java36
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java165
4 files changed, 91 insertions, 114 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java
index 6fa8990..c459718 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java
@@ -588,7 +588,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem
String areaID = view.getDurableLockingID();
if (areaID == null)
{
- throw new IllegalStateException("Durable locking is not enabled.");
+ throw new IllegalStateException("Durable locking is not enabled for view " + view);
}
LockObjectsResult masterLockingResult = sessionProtocol.delegateLockObjects(areaID, revKeys, view.getBranch(),
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java
index 0dcf044..d59d990 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/offline/OfflineTest.java
@@ -411,7 +411,7 @@ public class OfflineTest extends AbstractSyncingTest
/**
* See bug 364548.
*/
- public void _testEmptyCommit() throws Exception
+ public void testEmptyCommit() throws Exception
{
InternalRepository master = getRepository("master");
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java
index 2db5700..3421864 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOSingleTransactionStrategyImpl.java
@@ -67,38 +67,26 @@ public class CDOSingleTransactionStrategyImpl implements CDOTransactionStrategy
InternalCDOSession session = transaction.getSession();
CommitTransactionResult result = null;
- if (transaction.isDirty())
- {
- OMMonitor monitor = new EclipseMonitor(progressMonitor);
+ OMMonitor monitor = new EclipseMonitor(progressMonitor);
+ CDOSessionProtocol sessionProtocol = session.getSessionProtocol();
+ result = sessionProtocol.commitTransaction(commitContext, monitor);
- CDOSessionProtocol sessionProtocol = session.getSessionProtocol();
- result = sessionProtocol.commitTransaction(commitContext, monitor);
+ commitContext.postCommit(result);
- String rollbackMessage = result.getRollbackMessage();
- if (rollbackMessage != null)
+ String rollbackMessage = result.getRollbackMessage();
+ if (rollbackMessage != null)
+ {
+ List<CDOObjectReference> xRefs = result.getXRefs();
+ if (xRefs != null)
{
- // Needed even for failed commits to retain invalidation order in the session
- commitContext.postCommit(result);
-
- List<CDOObjectReference> xRefs = result.getXRefs();
- if (xRefs != null)
- {
- throw new ReferentialIntegrityException(rollbackMessage, xRefs);
- }
-
- throw new CommitException(rollbackMessage);
+ throw new ReferentialIntegrityException(rollbackMessage, xRefs);
}
+
+ throw new CommitException(rollbackMessage);
}
- // Needed even for non-dirty transactions to release locks
- commitContext.postCommit(result);
transaction.setCommitComment(null);
- if (result == null)
- {
- return null;
- }
-
long previousTimeStamp = result.getPreviousTimeStamp();
CDOBranch branch = transaction.getBranch();
long timeStamp = result.getTimeStamp();
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
index 7d6ee2c..a25d312 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java
@@ -2706,7 +2706,7 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
try
{
- // TODO (CD) It might be better to always do the checks,
+ // TODO (CD) It might be wise to always do the checks,
// instead of only for partial commits
if (isPartialCommit)
{
@@ -2740,122 +2740,111 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
public void postCommit(CommitTransactionResult result)
{
- if (isDirty())
+ try
{
- try
+ InternalCDOSession session = getSession();
+ long timeStamp = result.getTimeStamp();
+
+ if (result.getRollbackMessage() != null)
{
- InternalCDOSession session = getSession();
- long timeStamp = result.getTimeStamp();
+ CDOCommitInfo commitInfo = new FailureCommitInfo(timeStamp, result.getPreviousTimeStamp());
+ session.invalidate(commitInfo, transaction);
+ return;
+ }
- if (result.getRollbackMessage() != null)
- {
- CDOCommitInfo commitInfo = new FailureCommitInfo(timeStamp, result.getPreviousTimeStamp());
- session.invalidate(commitInfo, transaction);
- return;
- }
+ CDOBranch branch = result.getBranch();
+ boolean branchChanged = !ObjectUtil.equals(branch, getBranch());
+ if (branchChanged)
+ {
+ basicSetBranchPoint(branch.getHead());
+ }
- CDOBranch branch = result.getBranch();
- boolean branchChanged = !ObjectUtil.equals(branch, getBranch());
- if (branchChanged)
- {
- basicSetBranchPoint(branch.getHead());
- }
+ for (CDOPackageUnit newPackageUnit : getNewPackageUnits())
+ {
+ ((InternalCDOPackageUnit)newPackageUnit).setState(CDOPackageUnit.State.LOADED);
+ }
+
+ postCommit(getNewObjects(), result);
+ postCommit(getDirtyObjects(), result);
- for (CDOPackageUnit newPackageUnit : getNewPackageUnits())
+ for (CDORevisionDelta delta : getRevisionDeltas().values())
+ {
+ ((InternalCDORevisionDelta)delta).adjustReferences(result.getReferenceAdjuster());
+ }
+
+ for (CDOID id : getDetachedObjects().keySet())
+ {
+ removeObject(id);
+ }
+
+ CDOCommitInfo commitInfo = makeCommitInfo(timeStamp, result.getPreviousTimeStamp());
+ session.invalidate(commitInfo, transaction);
+
+ // Bug 290032 - Sticky views
+ if (session.isSticky())
+ {
+ CDOBranchPoint commitBranchPoint = CDOBranchUtil.copyBranchPoint(result);
+ for (CDOObject object : getNewObjects().values()) // Note: keyset() does not work because ID mappings are
+ // not applied there!
{
- ((InternalCDOPackageUnit)newPackageUnit).setState(CDOPackageUnit.State.LOADED);
+ session.setCommittedSinceLastRefresh(object.cdoID(), commitBranchPoint);
}
- postCommit(getNewObjects(), result);
- postCommit(getDirtyObjects(), result);
-
- for (CDORevisionDelta delta : getRevisionDeltas().values())
+ for (CDOID id : getDirtyObjects().keySet())
{
- ((InternalCDORevisionDelta)delta).adjustReferences(result.getReferenceAdjuster());
+ session.setCommittedSinceLastRefresh(id, commitBranchPoint);
}
for (CDOID id : getDetachedObjects().keySet())
{
- removeObject(id);
+ session.setCommittedSinceLastRefresh(id, commitBranchPoint);
}
+ }
- CDOCommitInfo commitInfo = makeCommitInfo(timeStamp, result.getPreviousTimeStamp());
- session.invalidate(commitInfo, transaction);
-
- // Bug 290032 - Sticky views
- if (session.isSticky())
+ CDOTransactionHandler2[] handlers = getTransactionHandlers2();
+ for (int i = 0; i < handlers.length; i++)
+ {
+ CDOTransactionHandler2 handler = handlers[i];
+ if (handler instanceof CDOTransactionHandler3)
{
- CDOBranchPoint commitBranchPoint = CDOBranchUtil.copyBranchPoint(result);
- for (CDOObject object : getNewObjects().values()) // Note: keyset() does not work because ID mappings are
- // not applied there!
- {
- session.setCommittedSinceLastRefresh(object.cdoID(), commitBranchPoint);
- }
-
- for (CDOID id : getDirtyObjects().keySet())
- {
- session.setCommittedSinceLastRefresh(id, commitBranchPoint);
- }
-
- for (CDOID id : getDetachedObjects().keySet())
- {
- session.setCommittedSinceLastRefresh(id, commitBranchPoint);
- }
+ CDOTransactionHandler3 handler3 = (CDOTransactionHandler3)handler;
+ handler3.committedTransaction(transaction, this, commitInfo);
}
-
- CDOTransactionHandler2[] handlers = getTransactionHandlers2();
- for (int i = 0; i < handlers.length; i++)
+ else
{
- CDOTransactionHandler2 handler = handlers[i];
- if (handler instanceof CDOTransactionHandler3)
- {
- CDOTransactionHandler3 handler3 = (CDOTransactionHandler3)handler;
- handler3.committedTransaction(transaction, this, commitInfo);
- }
- else
- {
- handler.committedTransaction(transaction, this);
- }
+ handler.committedTransaction(transaction, this);
}
+ }
- getChangeSubscriptionManager().committedTransaction(transaction, this);
- getAdapterManager().committedTransaction(transaction, this);
+ getChangeSubscriptionManager().committedTransaction(transaction, this);
+ getAdapterManager().committedTransaction(transaction, this);
- cleanUp(this);
- Map<CDOID, CDOID> idMappings = result.getIDMappings();
- IListener[] listeners = getListeners();
- if (listeners != null)
+ cleanUp(this);
+ Map<CDOID, CDOID> idMappings = result.getIDMappings();
+ IListener[] listeners = getListeners();
+ if (listeners != null)
+ {
+ if (branchChanged)
{
- if (branchChanged)
- {
- fireViewTargetChangedEvent(listeners);
- }
-
- fireEvent(new FinishedEvent(CDOTransactionFinishedEvent.Type.COMMITTED, idMappings), listeners);
+ fireViewTargetChangedEvent(listeners);
}
- CDOLockState[] newLockStates = result.getNewLockStates();
- if (newLockStates != null)
- {
- updateAndNotifyLockStates(Operation.UNLOCK, null, result.getTimeStamp(), newLockStates);
- }
- }
- catch (RuntimeException ex)
- {
- throw ex;
+ fireEvent(new FinishedEvent(CDOTransactionFinishedEvent.Type.COMMITTED, idMappings), listeners);
}
- catch (Exception ex)
+
+ CDOLockState[] newLockStates = result.getNewLockStates();
+ if (newLockStates != null)
{
- throw new TransactionException(ex);
+ updateAndNotifyLockStates(Operation.UNLOCK, null, result.getTimeStamp(), newLockStates);
}
}
- else
+ catch (RuntimeException ex)
{
- // Removes locks even if no one touch the transaction
- if (options().isAutoReleaseLocksEnabled())
- {
- unlockObjects(null, null);
- }
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new TransactionException(ex);
}
}