Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2012-04-18 02:12:49 -0400
committerEike Stepper2012-04-18 02:12:49 -0400
commit64c38e20fb448f47deac82d8d10e9c8f02340bf5 (patch)
treec4554b0326327b8ae1ca15beee156d2abad3ac09
parent6729e32a9e0e4f55886587803d4eebccbc3f439a (diff)
downloadcdo-64c38e20fb448f47deac82d8d10e9c8f02340bf5.tar.gz
cdo-64c38e20fb448f47deac82d8d10e9c8f02340bf5.tar.xz
cdo-64c38e20fb448f47deac82d8d10e9c8f02340bf5.zip
[377051] "Durable locking is not enabled for view..." while doing a rollback on a clone
https://bugs.eclipse.org/bugs/show_bug.cgi?id=377051
-rw-r--r--plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376470_Test.java104
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/transaction/CDOTransactionImpl.java10
3 files changed, 114 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
index a751d4aaab..a76e4cbffb 100644
--- a/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
+++ b/plugins/org.eclipse.emf.cdo.tests.db/src/org/eclipse/emf/cdo/tests/db/AllTestsDBH2Offline.java
@@ -14,6 +14,7 @@ import org.eclipse.emf.cdo.server.IRepository;
import org.eclipse.emf.cdo.server.IStore;
import org.eclipse.emf.cdo.server.db.CDODBUtil;
import org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy;
+import org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_376470_Test;
import org.eclipse.emf.cdo.tests.config.impl.ConfigTest;
import org.eclipse.emf.cdo.tests.config.impl.RepositoryConfig.OfflineConfig;
import org.eclipse.emf.cdo.tests.offline.Bugzilla_319552_Test;
@@ -90,6 +91,7 @@ public class AllTestsDBH2Offline extends DBConfigs
testClasses.add(Bugzilla_326047_Test.class);
testClasses.add(Bugzilla_325097_Test.class);
testClasses.add(Bugzilla_319552_Test.class);
+ testClasses.add(Bugzilla_376470_Test.class);
testClasses.add(FailoverTest.class);
}
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376470_Test.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376470_Test.java
new file mode 100644
index 0000000000..cc6d67fd44
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/bugzilla/Bugzilla_376470_Test.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.tests.bugzilla;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
+import org.eclipse.emf.cdo.tests.AbstractSyncingTest;
+import org.eclipse.emf.cdo.tests.config.impl.ConfigTest.CleanRepositoriesBefore;
+import org.eclipse.emf.cdo.tests.model1.Company;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+/**
+ * "Durable locking is not enabled for view..." while doing a rollback on a clone
+ * <p>
+ * See bug 376470.
+ *
+ * @author Eike Stepper
+ */
+@CleanRepositoriesBefore
+public class Bugzilla_376470_Test extends AbstractSyncingTest
+{
+ @Override
+ protected boolean isRawReplication()
+ {
+ return true;
+ }
+
+ public void testRollbackWhileOnline() throws Exception
+ {
+ InternalRepository clone = getRepository();
+ waitForOnline(clone);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
+
+ Company company = getModel1Factory().createCompany();
+ resource.getContents().add(company);
+ transaction.setCommitComment("resource with one company created on clone");
+ transaction.rollback();
+ }
+
+ public void testRollbackWhileOnline_NoAutoReleaseLocks() throws Exception
+ {
+ InternalRepository clone = getRepository();
+ waitForOnline(clone);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.options().setAutoReleaseLocksEnabled(false);
+ CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
+
+ Company company = getModel1Factory().createCompany();
+ resource.getContents().add(company);
+ transaction.setCommitComment("resource with one company created on clone");
+ transaction.rollback();
+ }
+
+ public void testRollbackWhileOffline() throws Exception
+ {
+ InternalRepository clone = getRepository();
+ waitForOnline(clone);
+
+ getOfflineConfig().stopMasterTransport();
+ waitForOffline(clone);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
+
+ Company company = getModel1Factory().createCompany();
+ resource.getContents().add(company);
+ transaction.setCommitComment("resource with one company created on clone");
+ transaction.rollback();
+ }
+
+ public void testRollbackWhileOffline_NoAutoReleaseLocks() throws Exception
+ {
+ InternalRepository clone = getRepository();
+ waitForOnline(clone);
+
+ getOfflineConfig().stopMasterTransport();
+ waitForOffline(clone);
+
+ CDOSession session = openSession();
+ CDOTransaction transaction = session.openTransaction();
+ transaction.options().setAutoReleaseLocksEnabled(false);
+ CDOResource resource = transaction.createResource(getResourcePath("/my/resource"));
+
+ Company company = getModel1Factory().createCompany();
+ resource.getContents().add(company);
+ transaction.setCommitComment("resource with one company created on clone");
+ transaction.rollback();
+ }
+}
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 a8c55e882f..08a3fb764e 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
@@ -17,6 +17,7 @@ package org.eclipse.emf.internal.cdo.transaction;
import org.eclipse.emf.cdo.CDOObject;
import org.eclipse.emf.cdo.CDOState;
+import org.eclipse.emf.cdo.common.CDOCommonRepository;
import org.eclipse.emf.cdo.common.branch.CDOBranch;
import org.eclipse.emf.cdo.common.branch.CDOBranchManager;
import org.eclipse.emf.cdo.common.branch.CDOBranchPoint;
@@ -61,6 +62,7 @@ import org.eclipse.emf.cdo.internal.common.commit.FailureCommitInfo;
import org.eclipse.emf.cdo.internal.common.protocol.CDODataInputImpl;
import org.eclipse.emf.cdo.internal.common.protocol.CDODataOutputImpl;
import org.eclipse.emf.cdo.internal.common.revision.CDOListWithElementProxiesImpl;
+import org.eclipse.emf.cdo.session.CDORepositoryInfo;
import org.eclipse.emf.cdo.spi.common.branch.CDOBranchUtil;
import org.eclipse.emf.cdo.spi.common.commit.CDORevisionAvailabilityInfo;
import org.eclipse.emf.cdo.spi.common.commit.InternalCDOCommitInfoManager;
@@ -1405,8 +1407,12 @@ public class CDOTransactionImpl extends CDOViewImpl implements InternalCDOTransa
if (lastSavepoint == firstSavepoint && options().isAutoReleaseLocksEnabled())
{
- // Unlock all objects
- unlockObjects(null, null);
+ CDORepositoryInfo repositoryInfo = getSession().getRepositoryInfo();
+ if (repositoryInfo.getType() == CDOCommonRepository.Type.MASTER)
+ {
+ // Unlock all objects
+ unlockObjects(null, null);
+ }
}
// Send notifications

Back to the top