From 3108952a616e5a7548f646555c716bdc52db91ea Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 31 May 2010 12:06:59 +0000
Subject: [PATCH] Resolve an issue where some changes might appear to be missing after restoring a backend. A replayed change that resolve in no change still must update the historical information.
---
opends/src/server/org/opends/server/replication/server/MsgQueue.java | 35 ++++++++++-------
opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java | 12 +++++
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 14 -------
opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java | 25 +++++++++++-
4 files changed, 54 insertions(+), 32 deletions(-)
diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index f887c0a..9af9669 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -2257,15 +2257,6 @@
numResolvedModifyConflicts.incrementAndGet();
}
- if (modifyOperation.getModifications().isEmpty())
- {
- /*
- * This operation becomes a no-op due to conflict resolution
- * stop the processing and send an OK result
- */
- return new SynchronizationProviderResult.StopProcessing(
- ResultCode.SUCCESS, null);
- }
}
return new SynchronizationProviderResult.ContinueProcessing();
}
@@ -3160,11 +3151,6 @@
// Find an rename child entries.
InternalClientConnection conn =
InternalClientConnection.getRootConnection();
- DeleteContext ctx =
- (DeleteContext) conflictOp.getAttachment(SYNCHROCONTEXT);
- ChangeNumber cn = null;
- if (ctx != null)
- cn = ctx.getChangeNumber();
try
{
diff --git a/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java b/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
index c738d45..921d86e 100644
--- a/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
+++ b/opends/src/server/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2009 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.plugin;
@@ -506,6 +506,16 @@
historicalInformation.generateState(modifyOperation);
+ if (modifyOperation.getModifications().isEmpty())
+ {
+ /*
+ * This operation becomes a no-op due to conflict resolution
+ * stop the processing and send an OK result
+ */
+ return new SynchronizationProviderResult.StopProcessing(
+ ResultCode.SUCCESS, null);
+ }
+
return new SynchronizationProviderResult.ContinueProcessing();
}
diff --git a/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java b/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java
index c69c194..f15df16 100644
--- a/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java
+++ b/opends/src/server/org/opends/server/replication/protocol/ModifyMsg.java
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2009 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.replication.protocol;
@@ -169,6 +169,23 @@
}
if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V2)
{
+ String mods = "";
+ try
+ {
+ ArrayList<RawModification> ldapmods = decodeRawMods(encodedMods);
+
+ for (RawModification mod : ldapmods)
+ {
+ mods += mod.toString();
+ }
+ } catch (LDAPException e)
+ {
+
+ } catch (ASN1Exception e)
+ {
+
+ }
+
return "ModifyMsg content: " +
" protocolVersion: " + protocolVersion +
" dn: " + dn +
@@ -176,7 +193,11 @@
" uniqueId: " + uniqueId +
" assuredFlag: " + assuredFlag +
" assuredMode: " + assuredMode +
- " safeDataLevel: " + safeDataLevel;
+ " safeDataLevel: " + safeDataLevel +
+ " size: " + encodedMods.length +
+ mods;
+
+
}
return "!!! Unknown version: " + protocolVersion + "!!!";
}
diff --git a/opends/src/server/org/opends/server/replication/server/MsgQueue.java b/opends/src/server/org/opends/server/replication/server/MsgQueue.java
index 1cb9ff3..270a184 100644
--- a/opends/src/server/org/opends/server/replication/server/MsgQueue.java
+++ b/opends/src/server/org/opends/server/replication/server/MsgQueue.java
@@ -35,7 +35,6 @@
import org.opends.messages.Message;
import org.opends.server.replication.common.ChangeNumber;
import org.opends.server.replication.protocol.UpdateMsg;
-import java.util.Arrays;
/**
* This class is used to build ordered lists of UpdateMsg.
@@ -132,23 +131,29 @@
boolean sameMsgs = false;
try
{
- sameMsgs = Arrays.equals(
- msgSameChangeNumber.getBytes(),update.getBytes());
+ if (
+ (msgSameChangeNumber.getBytes().length == update.getBytes().length)
+ && (msgSameChangeNumber.isAssured() == update.isAssured())
+ && (msgSameChangeNumber.getVersion() == update.getVersion()) )
+ {
+ sameMsgs = true;
+ }
+
+
+ if (!sameMsgs)
+ {
+ // Adding 2 msgs with the same ChangeNumber is ok only when
+ // the 2 masgs are the same
+ bytesCount += (update.size() - msgSameChangeNumber.size());
+ Message errMsg = ERR_RSQUEUE_DIFFERENT_MSGS_WITH_SAME_CN.get(
+ msgSameChangeNumber.getChangeNumber().toString(),
+ msgSameChangeNumber.toString(),
+ update.toString());
+ logError(errMsg);
+ }
}
catch(Exception e)
{}
-
- if (!sameMsgs)
- {
- // Adding 2 msgs with the same ChangeNumber is ok only when the 2 msgs
- // are the same
- bytesCount += (update.size() - msgSameChangeNumber.size());
- Message errMsg = ERR_RSQUEUE_DIFFERENT_MSGS_WITH_SAME_CN.get(
- msgSameChangeNumber.toString(),
- msgSameChangeNumber.toString(),
- update.toString());
- logError(errMsg);
- }
}
else
{
--
Gitblit v1.10.0