Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2014-03-05 17:40:50 +0000
committerEike Stepper2014-03-05 17:45:11 +0000
commiteb28a5a11d96db22b435e6635b33d0b45319d815 (patch)
treee3130f976e20ac12163abf1412e875e9ff76d5d2 /plugins/org.eclipse.emf.cdo.server
parentdbcd34266afa9338e4a24996855d727286b22c61 (diff)
downloadcdo-eb28a5a11d96db22b435e6635b33d0b45319d815.tar.gz
cdo-eb28a5a11d96db22b435e6635b33d0b45319d815.tar.xz
cdo-eb28a5a11d96db22b435e6635b33d0b45319d815.zip
[429694] Wrong branch manager is used in SynchronizableRepository.handleCommitInfo()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=429694
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server')
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java12
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java8
-rw-r--r--plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/SynchronizableRepository.java56
3 files changed, 70 insertions, 6 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
index 5d742926f5..2350d4fa48 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/Session.java
@@ -40,6 +40,7 @@ import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevision;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager;
import org.eclipse.emf.cdo.spi.server.ISessionProtocol;
+import org.eclipse.emf.cdo.spi.server.InternalRepository;
import org.eclipse.emf.cdo.spi.server.InternalSession;
import org.eclipse.emf.cdo.spi.server.InternalSessionManager;
import org.eclipse.emf.cdo.spi.server.InternalTransaction;
@@ -534,7 +535,16 @@ public class Session extends Container<IView> implements InternalSession
@Override
public String toString()
{
- String name = manager.getRepository().getName();
+ String name = "unknown";
+ if (manager != null)
+ {
+ InternalRepository repository = manager.getRepository();
+ if (repository != null)
+ {
+ name = repository.getName();
+ }
+ }
+
if (userID != null && userID.length() != 0)
{
name = userID + "@" + name;
diff --git a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
index 02523c58a8..2e139d7b67 100644
--- a/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
+++ b/plugins/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/internal/server/syncing/RepositorySynchronizer.java
@@ -28,6 +28,7 @@ import org.eclipse.emf.cdo.session.CDOSessionConfiguration;
import org.eclipse.emf.cdo.session.CDOSessionConfigurationFactory;
import org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent;
import org.eclipse.emf.cdo.session.CDOSessionLocksChangedEvent;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchAdjustable;
import org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionCache;
import org.eclipse.emf.cdo.spi.server.InternalRepositorySynchronizer;
import org.eclipse.emf.cdo.spi.server.InternalSynchronizableRepository;
@@ -399,7 +400,6 @@ public class RepositorySynchronizer extends PriorityQueueRunner implements Inter
try
{
CDOSessionConfiguration masterConfiguration = remoteSessionConfigurationFactory.createSessionConfiguration();
- masterConfiguration.setBranchManager(localRepository.getBranchManager());
masterConfiguration.setPassiveUpdateMode(PassiveUpdateMode.ADDITIONS);
masterConfiguration.setLockNotificationMode(LockNotificationMode.ALWAYS);
@@ -715,6 +715,12 @@ public class RepositorySynchronizer extends PriorityQueueRunner implements Inter
try
{
StoreThreadLocal.setSession(localRepository.getReplicatorSession());
+
+ if (lockChangeInfo instanceof CDOBranchAdjustable)
+ {
+ ((CDOBranchAdjustable)lockChangeInfo).adjustBranches(localRepository.getBranchManager());
+ }
+
localRepository.handleLockChangeInfo(lockChangeInfo);
}
finally
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 240f59b4de..da7470e160 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
@@ -39,6 +39,7 @@ import org.eclipse.emf.cdo.common.revision.CDORevisionKey;
import org.eclipse.emf.cdo.common.revision.delta.CDORevisionDelta;
import org.eclipse.emf.cdo.common.util.CDOCommonUtil;
import org.eclipse.emf.cdo.common.util.CDOException;
+import org.eclipse.emf.cdo.internal.common.commit.DelegatingCommitInfo;
import org.eclipse.emf.cdo.internal.common.revision.AbstractCDORevisionCache;
import org.eclipse.emf.cdo.internal.server.Repository;
import org.eclipse.emf.cdo.internal.server.TransactionCommitContext;
@@ -46,6 +47,7 @@ import org.eclipse.emf.cdo.server.IStoreAccessor;
import org.eclipse.emf.cdo.server.IStoreAccessor.CommitContext;
import org.eclipse.emf.cdo.server.ITransaction;
import org.eclipse.emf.cdo.server.StoreThreadLocal;
+import org.eclipse.emf.cdo.spi.common.branch.CDOBranchAdjustable;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch;
import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranchManager;
import org.eclipse.emf.cdo.spi.common.commit.CDOChangeKindCache;
@@ -265,7 +267,7 @@ public abstract class SynchronizableRepository extends Repository.Default implem
setLastReplicatedBranchID(branchID);
}
- public void handleCommitInfo(CDOCommitInfo commitInfo)
+ public void handleCommitInfo(final CDOCommitInfo commitInfo)
{
CDOBranch branch = commitInfo.getBranch();
if (branch.isLocal())
@@ -273,11 +275,57 @@ public abstract class SynchronizableRepository extends Repository.Default implem
return;
}
- long timeStamp = commitInfo.getTimeStamp();
- CDOBranchPoint head = branch.getHead();
+ // Convert branches from remoteSession to localRepository
+ InternalCDOBranchManager newBranchManager = getBranchManager();
+
+ for (CDOIDAndVersion key : commitInfo.getNewObjects())
+ {
+ if (key instanceof CDOBranchAdjustable)
+ {
+ CDOBranchAdjustable branchAdjustable = (CDOBranchAdjustable)key;
+ branchAdjustable.adjustBranches(newBranchManager);
+ }
+ }
+
+ for (CDORevisionKey key : commitInfo.getChangedObjects())
+ {
+ if (key instanceof CDOBranchAdjustable)
+ {
+ CDOBranchAdjustable branchAdjustable = (CDOBranchAdjustable)key;
+ branchAdjustable.adjustBranches(newBranchManager);
+ }
+ }
+
+ for (CDOIDAndVersion key : commitInfo.getDetachedObjects())
+ {
+ if (key instanceof CDOBranchAdjustable)
+ {
+ CDOBranchAdjustable branchAdjustable = (CDOBranchAdjustable)key;
+ branchAdjustable.adjustBranches(newBranchManager);
+ }
+ }
+
+ final InternalCDOBranch newBranch = newBranchManager.getBranch(branch.getID());
+ CDOCommitInfo newCommitInfo = new DelegatingCommitInfo()
+ {
+ @Override
+ protected CDOCommitInfo getDelegate()
+ {
+ return commitInfo;
+ }
+
+ @Override
+ public CDOBranch getBranch()
+ {
+ return newBranch;
+ }
+ };
+
+ long timeStamp = newCommitInfo.getTimeStamp();
+ CDOBranchPoint head = newBranch.getHead();
InternalTransaction transaction = replicatorSession.openTransaction(++lastTransactionID, head);
- ReplicatorCommitContext commitContext = new ReplicatorCommitContext(transaction, commitInfo);
+ ReplicatorCommitContext commitContext = new ReplicatorCommitContext(transaction, newCommitInfo);
commitContext.preWrite();
boolean success = false;

Back to the top