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

ludovicp
31.06.2010 dfee862f2637845769ee7c9ed594985920c4c6aa
Add support for displaying replication CSNs in the Access Logs. The default is disabled, but the log of replication CSNs can be activated by setting the log-changenumber property in the Replication domain configuration.
7 files modified
85 ■■■■ changed files
opends/resource/schema/02-config.ldif 6 ●●●●● patch | view | raw | blame | history
opends/src/admin/defn/org/opends/server/admin/std/ReplicationDomainConfiguration.xml 22 ●●●●● patch | view | raw | blame | history
opends/src/admin/messages/ReplicationDomainCfgDefn.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java 11 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/AbstractOperation.java 5 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/core/OperationTestCase.java 15 ●●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/DomainFakeCfg.java 24 ●●●●● patch | view | raw | blame | history
opends/resource/schema/02-config.ldif
@@ -2458,6 +2458,11 @@
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
attributeTypes: ( 1.3.6.1.4.1.26027.1.1.608
  NAME 'ds-cfg-log-changenumber'
  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
  SINGLE-VALUE
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.1
  NAME 'ds-cfg-access-control-handler'
  SUP top
@@ -3022,6 +3027,7 @@
        ds-cfg-fractional-include $
        ds-cfg-solve-conflicts $
        ds-cfg-changetime-heartbeat-interval $
        ds-cfg-log-changenumber $
        ds-cfg-initialization-window-size )
  X-ORIGIN 'OpenDS Directory Server' )
objectClasses: ( 1.3.6.1.4.1.26027.1.2.58
opends/src/admin/defn/org/opends/server/admin/std/ReplicationDomainConfiguration.xml
@@ -495,6 +495,28 @@
      </ldap:attribute>
    </adm:profile>
  </adm:property>
    <adm:property name="log-changenumber" advanced="false">
    <adm:synopsis>
      Indicates if this server logs the ChangeNumber in access log.
    </adm:synopsis>
    <adm:description>
      This boolean indicates if the domain should log the ChangeNumber
      of replicated operations in the access log.
    </adm:description>
    <adm:default-behavior>
      <adm:defined>
        <adm:value>false</adm:value>
      </adm:defined>
    </adm:default-behavior>
    <adm:syntax>
      <adm:boolean />
    </adm:syntax>
    <adm:profile name="ldap">
      <ldap:attribute>
        <ldap:name>ds-cfg-log-changenumber</ldap:name>
      </ldap:attribute>
    </adm:profile>
  </adm:property>
  <adm:property name="initialization-window-size">
    <adm:synopsis>
      Specifies the window size that this Directory Server may use when
opends/src/admin/messages/ReplicationDomainCfgDefn.properties
@@ -27,6 +27,8 @@
property.isolation-policy.synopsis=Specifies the behavior of the Directory Server if a write operation is attempted on the data within the Replication Domain when none of the configured Replication Servers are available.
property.isolation-policy.syntax.enumeration.value.accept-all-updates.synopsis=Indicates that updates should be accepted even though it is not possible to send them to any Replication Server. Best effort is made to re-send those updates to a Replication Servers when one of them is available, however those changes are at risk because they are only available from the historical information. This mode can also introduce high replication latency.
property.isolation-policy.syntax.enumeration.value.reject-all-updates.synopsis=Indicates that all updates attempted on this Replication Domain are rejected when no Replication Server is available.
property.log-changenumber.synopsis=Indicates if this server logs the ChangeNumber in access log.
property.log-changenumber.description=This boolean indicates if the domain should log the ChangeNumber of replicated operations in the access log.
property.referrals-url.synopsis=The URLs other LDAP servers should use to refer to the local server.
property.referrals-url.description=URLs used by peer servers in the topology to refer to the local server through LDAP referrals. If this attribute is not defined, every URLs available to access this server will be used. If defined, only URLs specified here will be used.
property.referrals-url.syntax.string.pattern.synopsis=A LDAP URL compliant with RFC 2255.
opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -405,6 +405,9 @@
  // The operation should become a no-op
  private static final int FRACTIONAL_BECOME_NO_OP = 3;
  // This configuration boolean indicates if this ReplicationDomain should log
  // ChangeNumbers.
  private boolean logChangeNumber = false;
  /**
   * The thread that periodically saves the ServerState of this
@@ -551,6 +554,7 @@
    heartbeatInterval = configuration.getHeartbeatInterval();
    isolationpolicy = configuration.getIsolationPolicy();
    configDn = configuration.dn();
    logChangeNumber = configuration.isLogChangenumber();
    this.updateToReplayQueue = updateToReplayQueue;
    // Get assured configuration
@@ -2297,6 +2301,12 @@
    // Note that a failed non-replication operation might not have a change
    // number.
    ChangeNumber curChangeNumber = OperationContext.getChangeNumber(op);
    if ((curChangeNumber != null) && (logChangeNumber))
    {
      Message message =
        Message.raw("replicationCN:%s", curChangeNumber.toString());
      op.appendAdditionalLogMessage(message);
    }
    if ((result == ResultCode.SUCCESS) && (!op.isSynchronizationOperation()))
    {
@@ -4234,6 +4244,7 @@
         ReplicationDomainCfg configuration)
  {
    isolationpolicy = configuration.getIsolationPolicy();
    logChangeNumber = configuration.isLogChangenumber();
    changeConfig(
        configuration.getReplicationServer(),
opends/src/server/org/opends/server/types/AbstractOperation.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 */
package org.opends.server.types;
import org.opends.messages.Message;
@@ -206,7 +206,7 @@
    }
    resultCode                 = ResultCode.UNDEFINED;
    additionalLogMessage       = new MessageBuilder();
    additionalLogMessage       = null;
    errorMessage               = new MessageBuilder();
    attachments                = new HashMap<String,Object>();
    matchedDN                  = null;
@@ -619,6 +619,7 @@
    }
    else
    {
      additionalLogMessage.append(" ");
      additionalLogMessage.append(message);
    }
  }
opends/tests/unit-tests-testng/src/server/org/opends/server/core/OperationTestCase.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 */
package org.opends.server.core;
@@ -306,19 +306,6 @@
  /**
   * Tests the <CODE>getAdditionalLogMessage</CODE> method for the provided
   * operation.
   *
   * @param  operation  The operation to test.
   */
  @Test(dataProvider = "testOperations")
  public void testGetAdditionalLogMessage(Operation operation)
  {
    assertNotNull(operation.getAdditionalLogMessage());
  }
  /**
   * Tests the <CODE>getMatchedDN</CODE> method for the provided operation.
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/DomainFakeCfg.java
@@ -79,9 +79,9 @@
  private SortedSet<String> fractionalIncludes = new TreeSet<String>();
  private SortedSet<String> eclIncludes = new TreeSet<String>();
  private ExternalChangelogDomainCfg eclCfg =
  private ExternalChangelogDomainCfg eclCfg =
    new ExternalChangelogDomainFakeCfg(true, new TreeSet<AttributeType>());
  /**
   * Creates a new Domain with the provided information
   * (assured mode disabled, default group id)
@@ -379,12 +379,12 @@
  {
    return true;
  }
  public void setEclIncludes(SortedSet<String> attrs)
  {
    this.eclIncludes = attrs;
  }
  public SortedSet<String> getECLInclude()
  {
    return this.eclIncludes;
@@ -394,7 +394,7 @@
  {
    return 180;
  }
  public int getInitializationWindowSize()
  {
@@ -414,7 +414,7 @@
   *           be successfully decoded.
   */
  public ExternalChangelogDomainCfg getExternalChangelogDomain()
  throws ConfigException
  throws ConfigException
  { return eclCfg; }
@@ -427,7 +427,7 @@
   *           be successfully decoded.
   */
  public void  setExternalChangelogDomain(ExternalChangelogDomainCfg eclCfg)
  throws ConfigException
  throws ConfigException
  { this.eclCfg=eclCfg;}
@@ -469,7 +469,7 @@
   * @throws ConfigException
   *          If the delete listener could not be registered.
   */
  public void
  public void
  addECLDomainDeleteListener(
      ConfigurationDeleteListener<ExternalChangelogDomainCfg> listener)
  throws ConfigException
@@ -483,8 +483,14 @@
   * @param listener
   *          The ECL Domain configuration delete listener.
   */
  public void
  public void
  removeECLDomainDeleteListener(
      ConfigurationDeleteListener<ExternalChangelogDomainCfg> listener)
  {}
  @Override
  public boolean isLogChangenumber()
  {
    return true;
  }
}