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

pgamba
20.24.2008 8d51279ac9c7d0163337175b23f2146e27a72cb8
 Fix 2911 dsreplication pre/post-external initialisation fails to clear all the changelogs

Reminder: Inside the ReplicationDomain (plugin) the 'generation ID' and 'server State' both define the state of the server regarding the change occurred in the topology. The 'generation ID' defines the start point. The 'server
State' defines an increment, and has a sense for the given generation ID.Thus the life cycle (loading/resetting) for the generation ID and state should be the same.

In particular at the end of an import, the generation ID is loaded or computed from the new data set.
The server Sate must be loaded or reinitialized the same way and this is not the case currently. That is what these changes fix.

1 files modified
39 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java 39 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
@@ -203,6 +203,8 @@
  private long generationId = -1;
  private boolean generationIdSavedStatus = false;
  ChangeNumberGenerator generator;
  /**
   * This object is used to store the list of update currently being
   * done on the local database.
@@ -482,7 +484,7 @@
     * The generator time is adjusted to the time of the last CN received from
     * remote other servers.
     */
    ChangeNumberGenerator generator =
    generator =
      new ChangeNumberGenerator(serverId, state);
    pendingChanges =
@@ -2255,6 +2257,21 @@
  }
  /**
   * Do what necessary when the data have changed : load state, load
   * generation Id.
   * @exception DirectoryException Thrown when an error occurs.
  */
  protected void loadDataState()
  throws DirectoryException
  {
    state.clearInMemory();
    state.loadState();
    generator.adjust(state.getMaxChangeNumber(serverId));
    // Retrieves the generation ID associated with the data imported
    generationId = loadGenerationId();
  }
  /**
   * Enable back the domain after a previous disable.
   * The domain will connect back to a replication Server and
   * will recreate threads to listen for messages from the Sycnhronization
@@ -2264,13 +2281,9 @@
   */
  public void enable()
  {
    state.clearInMemory();
    state.loadState();
    disabled = false;
    try
    {
      generationId = loadGenerationId();
      loadDataState();
    }
    catch (Exception e)
    {
@@ -2293,6 +2306,8 @@
    // Create the listener thread
    listenerThread = new ListenerThread(this, updateToReplayQueue);
    listenerThread.start();
    disabled = false;
  }
  /**
@@ -3247,17 +3262,7 @@
    }
    else
    {
      // Retrieves the generation ID associated with the data imported
      try
      {
        generationId = loadGenerationId();
      }
      catch (DirectoryException e)
      {
        logError(ERR_LOADING_GENERATION_ID.get(
            baseDN.toNormalizedString(),
            e.getLocalizedMessage()));
      }
      loadDataState();
      if (debugEnabled())
        TRACER.debugInfo(