From 5b0af4cce71888eeb3f0bfc038f53d07745c42f3 Mon Sep 17 00:00:00 2001
From: Chris Ridd <chris.ridd@forgerock.com>
Date: Wed, 30 Jul 2014 19:44:34 +0000
Subject: [PATCH] Fix OPENDJ-452: Manual add of new schema objectclass in 99-user.ldif are not replicated

---
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 9744a22..5690378 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -3821,23 +3821,37 @@
 
 
   /**
-   * Push the modifications contained in the given parameter as a modification
-   * that would happen on a local server. The modifications are not applied to
-   * the local database, historical information is not updated but a CSN is
-   * generated and the ServerState associated to this domain is updated.
+   * Push the schema modifications contained in the given parameter as a
+   * modification that would happen on a local server. The modifications are not
+   * applied to the local schema backend and historical information is not
+   * updated; but a CSN is generated and the ServerState associated to the
+   * schema domain is updated.
    *
    * @param modifications
-   *          The modification to push
+   *          The schema modifications to push
    */
-  void synchronizeModifications(List<Modification> modifications)
+  void synchronizeSchemaModifications(List<Modification> modifications)
   {
     ModifyOperation op = new ModifyOperationBasis(
         conn, nextOperationID(), nextMessageID(), null,
         DirectoryServer.getSchemaDN(), modifications);
-    LocalBackendModifyOperation localOp = new LocalBackendModifyOperation(op);
 
+    final Entry schema;
+    try
+    {
+      schema = DirectoryServer.getEntry(DirectoryServer.getSchemaDN());
+    }
+    catch (DirectoryException e)
+    {
+      TRACER.debugCaught(DebugLogLevel.ERROR, e);
+      logError(ERR_BACKEND_SEARCH_ENTRY.get(DirectoryServer.getSchemaDN().toString(),
+              stackTraceToSingleLineString(e)));
+      return;
+    }
+
+    LocalBackendModifyOperation localOp = new LocalBackendModifyOperation(op);
     CSN csn = generateCSN(localOp);
-    OperationContext ctx = new ModifyContext(csn, "schema");
+    OperationContext ctx = new ModifyContext(csn, getEntryUUID(schema));
     localOp.setAttachment(SYNCHROCONTEXT, ctx);
     localOp.setResultCode(ResultCode.SUCCESS);
     synchronize(localOp);

--
Gitblit v1.10.0