From 3f27a7ede5ca9df06137254aa32d41d023ac105d Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Tue, 16 Sep 2014 15:05:25 +0000
Subject: [PATCH] OPENDJ-1444 CR-4537 Remove previous cookie from storage of ChangeNumberIndexDB

---
 opends/src/server/org/opends/server/replication/server/changelog/je/DomainDBCursor.java |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/changelog/je/DomainDBCursor.java b/opends/src/server/org/opends/server/replication/server/changelog/je/DomainDBCursor.java
index 780b19b..28acc78 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/je/DomainDBCursor.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/je/DomainDBCursor.java
@@ -46,14 +46,14 @@
   private final DN baseDN;
   private final ReplicationDomainDB domainDB;
 
-  private final ConcurrentSkipListMap<Integer, CSN> newReplicas =
-      new ConcurrentSkipListMap<Integer, CSN>();
+  private final ConcurrentSkipListMap<Integer, CSN> newReplicas = new ConcurrentSkipListMap<Integer, CSN>();
   /**
    * Replaces null CSNs in ConcurrentSkipListMap that does not support null values.
    */
   private static final CSN NULL_CSN = new CSN(0, 0, 0);
 
   private final PositionStrategy positionStrategy;
+  private final KeyMatchingStrategy matchingStrategy;
 
   /**
    * Builds a DomainDBCursor instance.
@@ -62,14 +62,19 @@
    *          the replication domain baseDN of this cursor
    * @param domainDB
    *          the DB for the provided replication domain
+   * @param matchingStrategy
+   *          Cursor key matching strategy, which allow to indicates how key is
+   *          matched
    * @param positionStrategy
-   *          Cursor position strategy, which allow to indicates at which
-   *          exact position the cursor must start
+   *          Cursor position strategy, which allow to indicates at which exact
+   *          position the cursor must start
    */
-  public DomainDBCursor(DN baseDN, ReplicationDomainDB domainDB, PositionStrategy positionStrategy)
+  public DomainDBCursor(final DN baseDN, final ReplicationDomainDB domainDB, final KeyMatchingStrategy matchingStrategy,
+      final PositionStrategy positionStrategy)
   {
     this.baseDN = baseDN;
     this.domainDB = domainDB;
+    this.matchingStrategy = matchingStrategy;
     this.positionStrategy = positionStrategy;
   }
 
@@ -89,13 +94,13 @@
    *
    * @param serverId
    *          the serverId of the replica
-   * @param startAfterCSN
-   *          the CSN after which to start iterating
+   * @param startCSN
+   *          the CSN to use as a starting point
    */
-  public void addReplicaDB(int serverId, CSN startAfterCSN)
+  public void addReplicaDB(int serverId, CSN startCSN)
   {
     // only keep the oldest CSN that will be the new cursor's starting point
-    newReplicas.putIfAbsent(serverId, startAfterCSN != null ? startAfterCSN : NULL_CSN);
+    newReplicas.putIfAbsent(serverId, startCSN != null ? startCSN : NULL_CSN);
   }
 
   /** {@inheritDoc} */
@@ -109,7 +114,7 @@
       final CSN csn = pair.getValue();
       final CSN startCSN = !NULL_CSN.equals(csn) ? csn : null;
       final DBCursor<UpdateMsg> cursor =
-          domainDB.getCursorFrom(baseDN, serverId, startCSN, positionStrategy);
+          domainDB.getCursorFrom(baseDN, serverId, startCSN, matchingStrategy, positionStrategy);
       addCursor(cursor, null);
       iter.remove();
     }

--
Gitblit v1.10.0