From ae41fb531bbbd1bc8f9f6a82eb41c4eeb2da63c4 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Mon, 30 May 2011 15:20:19 +0000
Subject: [PATCH] Resolve several issues with the External Changelog with regards to Cookies and changes with updates and purging. More specifically these changes are resolving the following issues : OPENDJ-57 - ECL: lastChangeNumber and firstChangeNumber reset to zero when the changelog is purged to empty OPENDJ-172 - External ChangeLog Cookie varies when searching with an empty cookie. Cookie should be reproducible. OPENDJ-173 - External ChangeLog cookies content is altered by Change purging and prevents from continuing search with a previous returned cookie.

---
 opends/src/server/org/opends/server/replication/server/DraftCNDB.java |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/DraftCNDB.java b/opends/src/server/org/opends/server/replication/server/DraftCNDB.java
index f42a956..85af56e 100644
--- a/opends/src/server/org/opends/server/replication/server/DraftCNDB.java
+++ b/opends/src/server/org/opends/server/replication/server/DraftCNDB.java
@@ -668,6 +668,34 @@
     }
 
     /**
+     * Getter for the integer value of the current curson, representing
+     * the current DraftChangeNumber being processed.
+     *
+     * @return the current DraftCN as an integer.
+     */
+    public int currentKey()
+    {
+       try
+      {
+        OperationStatus status =
+          cursor.getCurrent(key, entry, LockMode.DEFAULT);
+
+        if (status != OperationStatus.SUCCESS)
+        {
+          return -1;
+        }
+        String str = decodeUTF8(key.getData());
+        int draftCN = new Integer(str);
+        return draftCN;
+      }
+      catch(Exception e)
+      {
+        TRACER.debugCaught(DebugLogLevel.ERROR, e);
+      }
+      return -1;
+    }
+
+    /**
      * Returns the replication changeNumber associated with the current key.
      * @return the replication changeNumber
      */

--
Gitblit v1.10.0