From d9b21dcf9e0a987e0ffb2cd8f6f59e9f6357a50f Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Thu, 19 Oct 2006 15:32:47 +0000
Subject: [PATCH] Fix for [Issue 798] break infinite loop when problems with naming resolution conflict. Reviewed by gbellato. The fix is to replay the operation a maximum of 10 times. There is a unit test for this issue that uses the short-circuit plugin to force the infinite replay loop.
---
opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java | 2 +-
opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java | 15 ++++++++++++++-
opends/src/server/org/opends/server/synchronization/SynchMessages.java | 10 ++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/opends/src/server/org/opends/server/synchronization/SynchMessages.java b/opends/src/server/org/opends/server/synchronization/SynchMessages.java
index 1c3a9aa..6fefefc 100644
--- a/opends/src/server/org/opends/server/synchronization/SynchMessages.java
+++ b/opends/src/server/org/opends/server/synchronization/SynchMessages.java
@@ -257,6 +257,14 @@
CATEGORY_MASK_SYNC | SEVERITY_MASK_SEVERE_ERROR | 34;
/**
+ * Loop detected while replaying an operation. This message takes one
+ * string argument containing details of the operation that could not be
+ * replayed.
+ */
+ public static final int MSGID_LOOP_REPLAYING_OPERATION =
+ CATEGORY_MASK_SYNC | SEVERITY_MASK_MILD_ERROR | 35;
+
+ /**
* Register the messages from this class in the core server.
*
*/
@@ -345,5 +353,7 @@
MessageHandler.registerMessage(
MSGID_EXCEPTION_RECEIVING_SYNCHRONIZATION_MESSAGE,
"An Exception was caught while receiving synchronization message : %s");
+ MessageHandler.registerMessage(MSGID_LOOP_REPLAYING_OPERATION,
+ "A loop was detected while replaying operation: %s");
}
}
diff --git a/opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java b/opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java
index f02c35d..922bfe6 100644
--- a/opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java
+++ b/opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java
@@ -1038,10 +1038,11 @@
Operation op = null;
boolean done = false;
ChangeNumber changeNumber = null;
+ int retryCount = 10;
try
{
- while (!done)
+ while (!done && retryCount-- > 0)
{
op = msg.createOperation(conn);
@@ -1093,6 +1094,18 @@
done = true;
}
}
+
+ if (!done)
+ {
+ // Continue with the next change but the servers could now become
+ // inconsistent.
+ // TODO : REPAIR : Should let the repair tool know about this
+ int msgID = MSGID_LOOP_REPLAYING_OPERATION;
+ String message = getMessage(msgID, op.toString());
+ logError(ErrorLogCategory.SYNCHRONIZATION,
+ ErrorLogSeverity.SEVERE_ERROR, message, msgID);
+ updateError(changeNumber);
+ }
}
catch (ASN1Exception e)
{
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java
index 55047af..9345b82 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java
@@ -1011,7 +1011,7 @@
* [Issue 798] break infinite loop when problems with naming resolution
* conflict.
*/
- @Test(enabled=false)
+ @Test(enabled=true)
public void infiniteReplayLoop() throws Exception
{
final DN baseDn = DN.decode("ou=People,dc=example,dc=com");
--
Gitblit v1.10.0