From b5acb25ee2ad9bf8b166b9de1a34e6aab6ea23b7 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Fri, 01 Sep 2006 12:04:47 +0000
Subject: [PATCH] issue 604 : solve the naming conflict that might happen when several masters are used there are 3 main parts in this commit : - attach the replication context in an OperationContext - if operation replay fails then fix the problem - in the pre-op checks for conflict and cause failure if necessary most of the time there should be no conflict and the operation should be processed normally
---
opends/src/server/org/opends/server/synchronization/MultimasterSynchronization.java | 137 ++++++++++++++++++++++++++-------------------
1 files changed, 78 insertions(+), 59 deletions(-)
diff --git a/opends/src/server/org/opends/server/synchronization/MultimasterSynchronization.java b/opends/src/server/org/opends/server/synchronization/MultimasterSynchronization.java
index d4067a3..f9f2b10 100644
--- a/opends/src/server/org/opends/server/synchronization/MultimasterSynchronization.java
+++ b/opends/src/server/org/opends/server/synchronization/MultimasterSynchronization.java
@@ -72,6 +72,21 @@
new HashMap<DN, SynchronizationDomain>() ;
/**
+ * Get the ServerState associated to the SynchronizationDomain
+ * with a given DN.
+ *
+ * @param baseDn The DN of the Synchronization Domain for which the
+ * ServerState must be returned.
+ * @return the ServerState associated to the SynchronizationDomain
+ * with the DN in parameter.
+ */
+ public static ServerState getServerState(DN baseDn)
+ {
+ SynchronizationDomain domain = findDomain(baseDn);
+ return domain.getServerState();
+ }
+
+ /**
* {@inheritDoc}
*/
public void initializeSynchronizationProvider(ConfigEntry configEntry)
@@ -245,6 +260,47 @@
return domain.handleConflictResolution(modifyOperation);
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SynchronizationProviderResult handleConflictResolution(
+ AddOperation addOperation) throws DirectoryException
+ {
+ SynchronizationDomain domain = findDomain(addOperation.getEntryDN());
+ if (domain == null)
+ return new SynchronizationProviderResult(true);
+
+ return domain.handleConflictResolution(addOperation);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SynchronizationProviderResult handleConflictResolution(
+ DeleteOperation deleteOperation) throws DirectoryException
+ {
+ SynchronizationDomain domain = findDomain(deleteOperation.getEntryDN());
+ if (domain == null)
+ return new SynchronizationProviderResult(true);
+
+ return domain.handleConflictResolution(deleteOperation);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SynchronizationProviderResult handleConflictResolution(
+ ModifyDNOperation modifyDNOperation) throws DirectoryException
+ {
+ SynchronizationDomain domain = findDomain(modifyDNOperation.getEntryDN());
+ if (domain == null)
+ return new SynchronizationProviderResult(true);
+
+ return domain.handleConflictResolution(modifyDNOperation);
+ }
/**
* {@inheritDoc}
@@ -275,57 +331,35 @@
* {@inheritDoc}
*/
@Override
+ public SynchronizationProviderResult doPreOperation(
+ DeleteOperation deleteOperation) throws DirectoryException
+ {
+ return new SynchronizationProviderResult(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public SynchronizationProviderResult doPreOperation(
+ ModifyDNOperation modifyDNOperation) throws DirectoryException
+ {
+ return new SynchronizationProviderResult(true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public SynchronizationProviderResult doPreOperation(AddOperation addOperation)
{
SynchronizationDomain domain = findDomain(addOperation.getEntryDN());
if (domain == null)
return new SynchronizationProviderResult(true);
- domain.setChangeNumber(addOperation);
- return new SynchronizationProviderResult(true);
- }
+ if (!addOperation.isSynchronizationOperation())
+ domain.doPreOperation(addOperation);
- /**
- * Pre-operation processing.
- * Called after operation has been processed by the core server
- * but before being committed to the backend
- * Generate the Change number and update the historical information
- *
- * @param deleteOperation the current operation
- * @return code indicating if operation must be processed
- */
- @Override
- public SynchronizationProviderResult
- doPreOperation(DeleteOperation deleteOperation)
- {
- SynchronizationDomain domain = findDomain(deleteOperation.getEntryDN());
- if (domain == null)
- return new SynchronizationProviderResult(true);
-
- domain.setChangeNumber(deleteOperation);
-
- return new SynchronizationProviderResult(true);
- }
-
- /**
- * Pre-operation processing.
- * Called after operation has been processed by the core server
- * but before being committed to the backend
- * Generate the Change number and update the historical information
- *
- * @param modifyDNOperation the current operation
- * @return code indicating if operation must be processed
- */
- @Override
- public SynchronizationProviderResult
- doPreOperation(ModifyDNOperation modifyDNOperation)
- {
-
- SynchronizationDomain domain = findDomain(modifyDNOperation.getEntryDN());
- if (domain == null)
- return new SynchronizationProviderResult(true);
-
- domain.setChangeNumber(modifyDNOperation);
return new SynchronizationProviderResult(true);
}
@@ -390,21 +424,6 @@
return;
}
- /**
- * Get the ServerState associated to the SynchronizationDomain
- * with a given DN.
- *
- * @param baseDn The DN of the Synchronization Domain for which the
- * ServerState must be returned.
- * @return the ServerState associated to the SynchronizationDomain
- * with the DN in parameter.
- */
- public static ServerState getServerState(DN baseDn)
- {
- SynchronizationDomain domain = findDomain(baseDn);
- return domain.getServerState();
- }
-
}
--
Gitblit v1.10.0