mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

coulbeck
19.32.2006 d9b21dcf9e0a987e0ffb2cd8f6f59e9f6357a50f
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.
3 files modified
27 ■■■■■ changed files
opends/src/server/org/opends/server/synchronization/SynchMessages.java 10 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/synchronization/SynchronizationDomain.java 15 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/synchronization/UpdateOperationTest.java 2 ●●● patch | view | raw | blame | history
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");
  }
}
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)
    {
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");