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

pgamba
20.46.2007 83b23a40998d4d86220779d61931cbe18b53fa9c
Fix ReplicationTestServer failure by removing all entries before starting
3 files modified
36 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationCache.java 16 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java 16 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java 4 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationCache.java
@@ -1037,6 +1037,18 @@
      if (this.generationId != newGenId)
      {
        clearDbs();
        // Reset the in memory domain generationId
        generationId = newGenId;
      }
    }
    /**
     * Clears the Db associated with that cache.
     */
    public void clearDbs()
    {
        // Reset the localchange and state db for the current domain
        synchronized (sourceDbHandlers)
        {
@@ -1073,10 +1085,6 @@
              "Exception caught while clearing generationId:" +
              e.getLocalizedMessage()));
        }
        // Reset the in memory domain generationId
        generationId = newGenId;
      }
    }
    /**
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -989,4 +989,20 @@
    else
      return null;
  }
  /**
   * Clears the Db associated with that server.
   */
  public void clearDb()
  {
    Iterator<ReplicationCache> rcachei = getCacheIterator();
    if (rcachei != null)
    {
      while (rcachei.hasNext())
      {
        ReplicationCache rc = rcachei.next();
        rc.clearDbs();
      }
    }
  }
}
opendj-sdk/opends/tests/unit-tests-testng/src/server/org/opends/server/replication/server/ReplicationServerTest.java
@@ -41,6 +41,7 @@
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
@@ -74,6 +75,7 @@
import org.opends.server.replication.protocol.ReplServerStartMessage;
import org.opends.server.replication.protocol.ReplSessionSecurity;
import org.opends.server.replication.protocol.ReplicationMessage;
import org.opends.server.replication.protocol.ResetGenerationId;
import org.opends.server.replication.protocol.ServerStartMessage;
import org.opends.server.replication.protocol.UpdateMessage;
import org.opends.server.replication.protocol.WindowMessage;
@@ -1238,6 +1240,8 @@
   {
     debugInfo("Starting searchBackend");
     replicationServer.clearDb();
     LDIFWriter ldifWriter = null;
     ByteArrayOutputStream stream = new ByteArrayOutputStream();
     LDIFExportConfig exportConfig = new LDIFExportConfig(stream);