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

pgamba
15.50.2007 0ef56d4515f70530da93570f9af3a0744fe77d12
Fix #2424 impact of generation ID on binary copy - an LDAP server that has already sent changes must not be able to replicate with an empty replication server
2 files modified
28 ■■■■■ changed files
opends/src/server/org/opends/server/replication/common/ServerState.java 10 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ServerHandler.java 18 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/ServerState.java
@@ -329,4 +329,14 @@
    }
    return true;
  }
  /**
   * Tests if the state is empty.
   *
   * @return True if the state is empty.
   */
  public boolean isEmpty()
  {
    return list.isEmpty();
  }
}
opends/src/server/org/opends/server/replication/server/ServerHandler.java
@@ -359,9 +359,27 @@
        }
        else
        {
          // We are an empty Replicationserver
          if ((generationId>0)&&(!serverState.isEmpty()))
          {
            // If the LDAP server has already sent changes
            // it is not expected to connect to an empty RS
            Message message = NOTE_BAD_GENERATION_ID.get(
                receivedMsg.getBaseDn().toNormalizedString(),
                Short.toString(receivedMsg.getServerId()),
                Long.toString(generationId),
                Long.toString(localGenerationId));
            ErrorMessage errorMsg =
              new ErrorMessage(replicationServerId, serverId, message);
            session.publish(errorMsg);
          }
          else
          {
          replicationCache.setGenerationId(generationId, false);
        }
      }
      }
      else if (msg instanceof ReplServerStartMessage)
      {
        // The remote server is a replication server