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

Fabio Pistolesi
21.00.2016 fc0a020218a55a4259d88d7c087fe022943c6bb4
OPENDJ-3066 LDAPReplicationDomain should track import and export of the domain via ReplicationDomain

When a domain is initialized by protocol, ReplicationDomain would initiate an import and restart the broker after it is finished. It considers the import finished when the broker has started.
On the other hand LDAPDomainProtocol may write the server state after import has finished but the broker is still in the process of being restarted,
leading to a race condition between the configuration handler and the state of import.
Always use the same check for deciding wheteher import/export has completed.
1 files modified
9 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -334,7 +334,6 @@
  private final InternalClientConnection conn = getRootConnection();
  private final AtomicBoolean shutdown = new AtomicBoolean();
  private volatile boolean disabled;
  private volatile boolean stateSavingDisabled;
  /**
   * This list is used to temporary store operations that needs to be replayed
@@ -444,9 +443,8 @@
          synchronized (this)
          {
            wait(1000);
            if (!disabled && !stateSavingDisabled)
            if (!disabled && !ieRunning())
            {
              // save the ServerState
              state.save();
            }
          }
@@ -3513,9 +3511,6 @@
   */
  private void preBackendImport(Backend<?> backend) throws DirectoryException
  {
    // Stop saving state
    stateSavingDisabled = true;
    // Prevent the processing of the backend finalisation event as the import will disable the attached backend
    ignoreBackendInitializationEvent = true;
@@ -3574,8 +3569,6 @@
      // Process import
      preBackendImport(backend);
      backend.importLDIF(importConfig, DirectoryServer.getInstance().getServerContext());
      stateSavingDisabled = false;
    }
    catch(Exception e)
    {