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

gbellato
16.26.2009 51ef33bebdaa4f8df31131374fce8433c431c298
Fix a regression introduced by fix for 4223
During the creation of a replicationServerDomain, wait for the replication server
to connect to other replication servers only if the creation was initiated by a
directory server.
5 files modified
54 ■■■■ changed files
opends/src/server/org/opends/server/replication/server/DataServerHandler.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/MessageHandler.java 19 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServer.java 22 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 9 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/DataServerHandler.java
@@ -475,7 +475,7 @@
        processStartFromRemote(inServerStartMsg);
      // Get or Create the ReplicationServerDomain
      replicationServerDomain = getDomain(true);
      replicationServerDomain = getDomain(true, true);
      localGenerationId = replicationServerDomain.getGenerationId();
      oldGenerationId = localGenerationId;
opends/src/server/org/opends/server/replication/server/MessageHandler.java
@@ -239,15 +239,32 @@
  /**
   * Returns the Replication Server Domain to which belongs this handler.
   *
   * @param createIfNotExist Creates the domain if it does not exist.
   *
   * @return The replication server domain.
   */
  public ReplicationServerDomain getDomain(boolean createIfNotExist)
  {
    return getDomain(createIfNotExist, false);
  }
  /**
   * Returns the Replication Server Domain to which belongs this handler.
   *
   * @param createIfNotExist    Creates the domain if it does not exist.
   * @param waitConnections     Waits for the Connections with other RS to
   *                            be established before returning.
   * @return The replication server domain.
   */
  public ReplicationServerDomain getDomain(
      boolean createIfNotExist, boolean waitConnections)
  {
    if (replicationServerDomain==null)
    {
      replicationServerDomain =
      replicationServer.getReplicationServerDomain(serviceId,createIfNotExist);
        replicationServer.getReplicationServerDomain(
            serviceId, createIfNotExist, waitConnections);
    }
    return replicationServerDomain;
  }
opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -687,6 +687,25 @@
  public ReplicationServerDomain getReplicationServerDomain(String baseDn,
          boolean create)
  {
    return getReplicationServerDomain(baseDn, create, false);
  }
  /**
   * Get the ReplicationServerDomain associated to the base DN given in
   * parameter.
   *
   * @param baseDn The base Dn for which the ReplicationServerDomain must be
   * returned.
   * @param create Specifies whether to create the ReplicationServerDomain if
   *        it does not already exist.
   * @param waitConnections     Waits for the Connections with other RS to
   *                            be established before returning.
   * @return The ReplicationServerDomain associated to the base DN given in
   *         parameter.
   */
  public ReplicationServerDomain getReplicationServerDomain(String baseDn,
          boolean create, boolean waitConnections)
  {
    ReplicationServerDomain replicationServerDomain;
    synchronized (baseDNs)
@@ -698,6 +717,8 @@
        baseDNs.put(baseDn, replicationServerDomain);
        synchronized (domainMonitor)
        {
          if (waitConnections)
          {
          synchronized (this)
          {
            // kick up the connect thread so that this new domain
@@ -714,6 +735,7 @@
        }
      }
    }
    }
    return replicationServerDomain;
  }
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -3061,19 +3061,15 @@
    try
    {
      storeReceivedCTHeartbeat(msg.getChangeNumber());
      if (senderHandler.isDataServer())
      {
      // If we are the first replication server warned,
      // then forwards the reset message to the remote replication servers
      for (ReplicationServerHandler rsHandler : replicationServers.values())
      {
        try
        {
          // After we'll have sent the message , the remote RS will adopt
          // the new genId
          if (senderHandler.isDataServer())
          {
            rsHandler.send(msg);
          }
        } catch (IOException e)
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
@@ -3082,6 +3078,7 @@
        }
      }
    }
    }
    finally
    {
      release();
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/service/ReplicationDomainTest.java
@@ -155,7 +155,7 @@
      for (DSInfo serverInfo : domain1.getReplicasList())
      {
        if (serverInfo.getDsId() == domain2ServerId)
          assertTrue(serverInfo.getStatus() == ServerStatus.BAD_GEN_ID_STATUS);
          assertEquals(serverInfo.getStatus(), ServerStatus.BAD_GEN_ID_STATUS);
        else
        {
          assertTrue(serverInfo.getDsId() == domain1ServerId);