From bcd9325b7d47b6932d140a15ee761252e130ab7e Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 09 Oct 2013 13:35:05 +0000
Subject: [PATCH] OPENDJ-1116 Introduce abstraction for the changelog DB

---
 opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java b/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java
index d2d7795..f246160 100644
--- a/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java
+++ b/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java
@@ -375,14 +375,15 @@
             continue;
           }
 
-          // Purge up to wherever the other DBs have been purged to.
-          // FIXME there is an opportunity for a phantom record in the current
-          // DB if the replicaDB gets purged after the next if statement.
+          // FIXME there is an opportunity for a phantom record in the CNIndexDB
+          // if the replicaDB gets purged after call to domain.getOldestState().
           final CSN csn = record.getCSN();
-          final ServerState startState = domain.getStartState();
-          final CSN fcsn = startState.getCSN(csn.getServerId());
+          final ServerState oldestState = domain.getOldestState();
+          final CSN fcsn = oldestState.getCSN(csn.getServerId());
           if (csn.isOlderThan(fcsn))
           {
+            // This change which has already been purged from the corresponding
+            // replicaDB => purge it from CNIndexDB
             cursor.delete();
             continue;
           }
@@ -397,7 +398,7 @@
 
             if (debugEnabled())
               TRACER.debugInfo("JEChangeNumberIndexDB:clear() - ChangeVector:"
-                  + csnVector + " -- StartState:" + startState);
+                  + csnVector + " -- StartState:" + oldestState);
           }
           catch(Exception e)
           {
@@ -409,7 +410,7 @@
 
           if (csnVector == null
               || (csnVector.getCSN(csn.getServerId()) != null
-                    && !csnVector.cover(startState)))
+                    && !csnVector.cover(oldestState)))
           {
             cursor.delete();
             if (debugEnabled())

--
Gitblit v1.10.0