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

Nicolas Capponi
02.29.2014 f2666e9996dbbbf77126a7ee9958e124d1c87762
Checkpoint commit for OPENDJ-1206 : Create a new ReplicationBackend/ChangelogBackend 
to support cn=changelog

Ignore unused domains when validating a server state for a changelog search. This was
the prior behavior withe ECL* implementation.

* ReplicationServer.java:
Update validateServerState() method to ignore unused domain
1 files modified
26 ■■■■ changed files
opends/src/server/org/opends/server/replication/server/ReplicationServer.java 26 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -625,10 +625,24 @@
   */
  public void validateServerState(MultiDomainServerState state, Set<DN> ignoredBaseDNs) throws DirectoryException
  {
    // TODO : should skip unused domains, where domain.getLatestServerState(); is empty
    final Set<DN> domains = getDomainDNs(ignoredBaseDNs);
    final Set<DN> stateDomains = state.getSnapshot().keySet();
    final Set<DN> domainsCopy = new HashSet<DN>(domains);
    // Build the two sets of DNs to compare
    final Set<DN> activeServerDomains = new HashSet<DN>();
    for (final DN dn : getDomainDNs(ignoredBaseDNs))
    {
      final ServerState lastServerState = getReplicationServerDomain(dn).getLatestServerState();
      if (!lastServerState.isEmpty())
      {
         activeServerDomains.add(dn);
      }
    }
    final Set<DN> stateDomains = new HashSet<DN>();
    for (final DN dn : state)
    {
      stateDomains.add(dn);
    }
    // The two sets of DNs are expected to be the same. Check this.
    final Set<DN> domainsCopy = new HashSet<DN>(activeServerDomains);
    final Set<DN> stateDomainsCopy = new HashSet<DN>(stateDomains);
    domainsCopy.removeAll(stateDomains);
    if (!domainsCopy.isEmpty())
@@ -642,11 +656,11 @@
          ERR_RESYNC_REQUIRED_MISSING_DOMAIN_IN_PROVIDED_COOKIE.get(
              missingDomains, "<" + state.toString() + missingDomains + ">"));
    }
    stateDomainsCopy.removeAll(domains);
    stateDomainsCopy.removeAll(activeServerDomains);
    if (!stateDomainsCopy.isEmpty())
    {
      final StringBuilder startState = new StringBuilder();
      for (DN dn : domains) {
      for (DN dn : activeServerDomains) {
        startState.append(dn).append(":").append(state.getServerState(dn).toString()).append(";");
      }
      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,