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

an-Peter Nilsson
09.06.2020 f366bd375dbee4ab6a44f39889a93a35b22c0d4e
FIX Replication status attributes for schema backend not read from disk
https://github.com/OpenIdentityPlatform/OpenDJ/issues/140

Add ds-sync-* attributes from schema ldif to extraAttributes

Those attributes are used at startup to control which state the DS
presents to the RS,
and as a result which changes will be provided by the RS and applied by
the DS.

By reading the saved state and presenting it to the RS we only fetch and
replay newer
changes we don't already have and avoid fetching and trying to
re-playing the entire history.
1 files modified
19 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaHandler.java 19 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/SchemaHandler.java
@@ -147,6 +147,7 @@
   * Example: replication uses this to store its state and GenerationID.
   */
  private Map<String, Attribute> extraAttributes = new HashMap<>();
  private Map<String, org.forgerock.opendj.ldap.Attribute> extraAttributesInitialize = new HashMap<>();
  /** Guards updates to the schema. */
  private final Lock exclusiveLock = new ReentrantLock();
@@ -224,6 +225,15 @@
      {
        throw new ConfigException(e.getMessageObject(), e);
      }
      // Do attribute conversion after fully loading the schema
      // otherwise attributes using types defined in the schema will not be properly converted
      for (final Map.Entry<String, org.forgerock.opendj.ldap.Attribute> entry : extraAttributesInitialize.entrySet())
      {
        Attribute a = Converters.toAttribute(entry.getValue());
        extraAttributes.put(entry.getKey(), a);
      }
      extraAttributesInitialize.clear();
  }
  /**
@@ -960,6 +970,15 @@
    final Entry entry = readSchemaEntry(schemaFile, readSchema);
    if (entry != null)
    {
      for (org.forgerock.opendj.ldap.Attribute a : entry.getAllAttributes())
      {
        AttributeType attrType = a .getAttributeDescription().getAttributeType();
        String attrName = attrType.getNameOrOID();
        if (attrName.startsWith("ds-sync-") || attrName.equals("modifiersName") || attrName.equals("modifyTimestamp"))
        {
          extraAttributesInitialize.put(attrName, a);
        }
      }
      updateSchemaBuilderWithEntry(schemaBuilder, entry, schemaFile.getName(), failOnError);
    }
    return entry;