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

pgamba
25.52.2009 9268da54b39dff6f0afbda53c9bd61deff1a8f66
Fix P3/#4340 ECL (draft mode): on second RS, first and last ChangeNumber are 0 and lastExternalChangelogCookie missing until first search
4 files modified
33 ■■■■■ changed files
opends/src/server/org/opends/server/replication/common/FirstChangeNumberVirtualAttributeProvider.java 10 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/LastChangeNumberVirtualAttributeProvider.java 8 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServer.java 6 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/common/FirstChangeNumberVirtualAttributeProvider.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.replication.common;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -39,6 +41,7 @@
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.SearchOperation;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.replication.plugin.MultimasterReplication;
import org.opends.server.replication.server.ReplicationServer;
import org.opends.server.types.AttributeValue;
@@ -46,6 +49,7 @@
import org.opends.server.types.ByteString;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.DN;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
@@ -66,6 +70,9 @@
       extends VirtualAttributeProvider<UserDefinedVirtualAttributeCfg>
       implements ConfigurationChangeListener<UserDefinedVirtualAttributeCfg>
{
  // The tracer object for the debug logger.
  private static final DebugTracer TRACER = getTracer();
  /**
   * Creates a new instance of this member virtual attribute provider.
   */
@@ -140,6 +147,7 @@
          excludedDomains.add(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT);
        ReplicationServer rs = eclwe.getReplicationServer();
        rs.disableEligibility(excludedDomains);
        int[] limits = rs.getECLDraftCNLimits(
            rs.getEligibleCN(), excludedDomains);
@@ -149,7 +157,7 @@
    }
    catch(Exception e)
    {
      TRACER.debugCaught(DebugLogLevel.ERROR, e);
    }
    AttributeValue value =
      AttributeValues.create(
opends/src/server/org/opends/server/replication/common/LastChangeNumberVirtualAttributeProvider.java
@@ -26,6 +26,8 @@
 */
package org.opends.server.replication.common;
import static org.opends.server.loggers.debug.DebugLogger.getTracer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -39,6 +41,7 @@
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.SearchOperation;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.replication.plugin.MultimasterReplication;
import org.opends.server.replication.server.ReplicationServer;
import org.opends.server.types.AttributeValue;
@@ -46,6 +49,7 @@
import org.opends.server.types.ByteString;
import org.opends.server.types.ConfigChangeResult;
import org.opends.server.types.DN;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.ResultCode;
@@ -66,6 +70,7 @@
       extends VirtualAttributeProvider<UserDefinedVirtualAttributeCfg>
       implements ConfigurationChangeListener<UserDefinedVirtualAttributeCfg>
{
  private static final DebugTracer TRACER = getTracer();
  /**
   * Creates a new instance of this member virtual attribute provider.
   */
@@ -140,6 +145,7 @@
          excludedDomains.add(ServerConstants.DN_EXTERNAL_CHANGELOG_ROOT);
        ReplicationServer rs = eclwe.getReplicationServer();
        rs.disableEligibility(excludedDomains);
        int[] limits = rs.getECLDraftCNLimits(
            rs.getEligibleCN(), excludedDomains);
@@ -148,7 +154,7 @@
    }
    catch(Exception e)
    {
      TRACER.debugCaught(DebugLogLevel.ERROR, e);
    }
    AttributeValue value =
      AttributeValues.create(
opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -198,6 +198,9 @@
  // used to synchronize the domain creation with the connect thread.
  final private Object domainMonitor = new Object();
  // ServiceIDs excluded for ECL
  private  ArrayList<String> excludedServiceIDs = new ArrayList<String>();
  /**
   * The weight affected to the replication server.
   * Each replication server of the topology has a weight. When combined
@@ -1779,7 +1782,6 @@
    }
  }
  private  ArrayList<String> excludedServiceIDs;
  /**
   * Excluded a list of domain from eligibility computation.
   * @param excludedServiceIDs the provided list of serviceIDs excluded from
@@ -2026,6 +2028,8 @@
  public MultiDomainServerState getLastECLCookie(
    ArrayList<String> excludedServiceIDs)
  {
    disableEligibility(excludedServiceIDs);
    MultiDomainServerState result = new MultiDomainServerState();
    // Initialize start state for  all running domains with empty state
    Iterator<ReplicationServerDomain> rsdk = this.getDomainIterator();
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/ExternalChangeLogTest.java
@@ -3067,6 +3067,15 @@
      waitOpResult(searchOp, ResultCode.SUCCESS);
      assertEquals(searchOp.getSearchEntries().size(), 
          lastDraftChangeNumber-firstDraftChangeNumber+1);
      if (searchOp.getSearchEntries() != null)
      {
        int i=0;
        for (SearchResultEntry resultEntry : searchOp.getSearchEntries())
        {
          i++;
          debugInfo(tn, "Result entry returned:" + resultEntry.toLDIFString());
        }
      }
    }
    catch(Exception e)
    {