From 844e17d35395eebf235505e983e4be3f702d3978 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

---
 opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
index e72dabe..259711d 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/ECLServerHandler.java
@@ -186,8 +186,8 @@
           .append(")")
           .append("] [nextNonEligibleMsg=").append(nextNonEligibleMsg)
           .append("] [startState=").append(startState)
-          .append("] [stopState=").append(stopState)
           .append("] [currentState=").append(currentState)
+          .append("] [stopState=").append(stopState)
           .append("]]");
     }
 
@@ -735,11 +735,10 @@
       }
 
       // skip unused domains
-      final ServerState latestServerState = domain.getLatestServerState();
-      if (latestServerState.isEmpty())
+      final ServerState latestState = domain.getLatestServerState();
+      if (latestState.isEmpty())
         continue;
 
-
       // Creates the new domain context
       final DomainContext newDomainCtxt = new DomainContext();
       newDomainCtxt.active = true;
@@ -749,7 +748,7 @@
       // Assign the start state for the domain
       if (isPersistent == PERSISTENT_CHANGES_ONLY)
       {
-        newDomainCtxt.startState = latestServerState;
+        newDomainCtxt.startState = latestState;
         startStatesFromProvidedCookie.remove(domain.getBaseDN());
       }
       else
@@ -767,10 +766,9 @@
           // what we have in the replication changelog
           if (newDomainCtxt.startState == null)
           {
-            CSN latestTrimCSN =
-                new CSN(newDomainCtxt.domainLatestTrimDate, 0, 0);
             newDomainCtxt.startState =
-                domain.getStartState().duplicateOnlyOlderThan(latestTrimCSN);
+                domain.getOldestState().duplicateOnlyOlderThan(
+                    newDomainCtxt.domainLatestTrimDate);
           }
         }
         else
@@ -790,7 +788,7 @@
           }
         }
 
-        newDomainCtxt.stopState = latestServerState;
+        newDomainCtxt.stopState = latestState;
       }
       newDomainCtxt.currentState = new ServerState();
 
@@ -860,12 +858,11 @@
       ServerState cookie)
   {
     /*
-    when the provided startState is older than the replication
-    changelogdb startState, it means that the replication
-    changelog db has been trimmed and the cookie is not valid
-    anymore.
+    when the provided startState is older than the replication changelogdb
+    oldestState, it means that the replication changelog db has been trimmed and
+    the cookie is not valid anymore.
     */
-    for (CSN dbOldestChange : rsDomain.getStartState())
+    for (CSN dbOldestChange : rsDomain.getOldestState())
     {
       CSN providedChange = cookie.getCSN(dbOldestChange.getServerId());
       if (providedChange != null && providedChange.isOlderThan(dbOldestChange))

--
Gitblit v1.10.0