From b6ccb560e9056cc9c028812f5f63ff2e80c95c87 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 18 Jul 2014 13:25:32 +0000
Subject: [PATCH] OPENDJ-1441 (CR-4037) Persistent searches on external changelog do not return changes for new replicas and new domains

---
 opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java |   37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java b/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java
index 4639e7e..56b0509 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/api/ReplicationDomainDB.java
@@ -26,8 +26,10 @@
 package org.opends.server.replication.server.changelog.api;
 
 import org.opends.server.replication.common.CSN;
+import org.opends.server.replication.common.MultiDomainServerState;
 import org.opends.server.replication.common.ServerState;
 import org.opends.server.replication.protocol.UpdateMsg;
+import org.opends.server.replication.server.changelog.je.MultiDomainDBCursor;
 import org.opends.server.types.DN;
 
 /**
@@ -89,6 +91,26 @@
    */
   void removeDomain(DN baseDN) throws ChangelogException;
 
+  /**
+   * Generates a {@link DBCursor} across all the domains starting after the
+   * provided {@link MultiDomainServerState} for each domain.
+   * <p>
+   * When the cursor is not used anymore, client code MUST call the
+   * {@link DBCursor#close()} method to free the resources and locks used by the
+   * cursor.
+   *
+   * @param startAfterState
+   *          Starting point for each domain cursor. If any {@link ServerState}
+   *          for a domain is null, then start from the oldest CSN for each
+   *          replicaDBs
+   * @return a non null {@link DBCursor}
+   * @throws ChangelogException
+   *           If a database problem happened
+   * @see #getCursorFrom(DN, ServerState)
+   */
+  public MultiDomainDBCursor getCursorFrom(MultiDomainServerState startAfterState)
+      throws ChangelogException;
+
   // serverId methods
 
   /**
@@ -102,16 +124,17 @@
    *
    * @param baseDN
    *          the replication domain baseDN
-   * @param startAfterServerState
+   * @param startAfterState
    *          Starting point for each ReplicaDB cursor. If any CSN for a
    *          replicaDB is null, then start from the oldest CSN for this
    *          replicaDB
    * @return a non null {@link DBCursor}
    * @throws ChangelogException
    *           If a database problem happened
+   * @see #getCursorFrom(DN, int, CSN)
    */
-  DBCursor<UpdateMsg> getCursorFrom(DN baseDN,
-      ServerState startAfterServerState) throws ChangelogException;
+  DBCursor<UpdateMsg> getCursorFrom(DN baseDN, ServerState startAfterState)
+      throws ChangelogException;
 
   /**
    * Generates a {@link DBCursor} for one replicaDB for the specified
@@ -136,6 +159,14 @@
       throws ChangelogException;
 
   /**
+   * Unregisters the provided cursor from this replication domain.
+   *
+   * @param cursor
+   *          the cursor to unregister.
+   */
+  void unregisterCursor(DBCursor<?> cursor);
+
+  /**
    * Publishes the provided change to the changelog DB for the specified
    * serverId and replication domain. After a change has been successfully
    * published, it becomes available to be returned by the External ChangeLog.

--
Gitblit v1.10.0