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
92 ■■■■■ 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 21 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServer.java 44 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 23 ●●●●● 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.
   *
   * @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,18 +717,21 @@
        baseDNs.put(baseDn, replicationServerDomain);
        synchronized (domainMonitor)
        {
          synchronized (this)
          if (waitConnections)
          {
            // kick up the connect thread so that this new domain
            // gets connected to all the Replication Servers.
            this.notify();
          }
          try
          {
            // wait for the connect thread to signal that it finished its job
            domainMonitor.wait(500);
          } catch (InterruptedException e)
          {
            synchronized (this)
            {
              // kick up the connect thread so that this new domain
              // gets connected to all the Replication Servers.
              this.notify();
            }
            try
            {
              // wait for the connect thread to signal that it finished its job
              domainMonitor.wait(500);
            } catch (InterruptedException e)
            {
            }
          }
        }
      }
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -3061,24 +3061,21 @@
    try
    {
      storeReceivedCTHeartbeat(msg.getChangeNumber());
      // If we are the first replication server warned,
      // then forwards the reset message to the remote replication servers
      for (ReplicationServerHandler rsHandler : replicationServers.values())
      if (senderHandler.isDataServer())
      {
        try
        // If we are the first replication server warned,
        // then forwards the reset message to the remote replication servers
        for (ReplicationServerHandler rsHandler : replicationServers.values())
        {
          // After we'll have sent the message , the remote RS will adopt
          // the new genId
          if (senderHandler.isDataServer())
          try
          {
            rsHandler.send(msg);
          } catch (IOException e)
          {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
            logError(ERR_CHANGELOG_ERROR_SENDING_MSG.get(rsHandler.getName()));
            stopServer(rsHandler);
          }
        } catch (IOException e)
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, e);
          logError(ERR_CHANGELOG_ERROR_SENDING_MSG.get(rsHandler.getName()));
          stopServer(rsHandler);
        }
      }
    }
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);