From f73b655466092169abac34833fb628fce1fcdebe Mon Sep 17 00:00:00 2001
From: jcduff <jcduff@localhost>
Date: Thu, 23 Oct 2008 14:04:24 +0000
Subject: [PATCH] The commit will bring the following features :     - An updated version of the underlying database. BDB JE 3.3 is now used.     - Attribute API refactoring providing a better abstraction and offering improved performances.     - A new GUI called the Control-Panel to replace the Status-Panel: the specifications for this       GUI are available on OpenDS Wiki and contains a link to a mockup.        See <https://www.opends.org/wiki/page/ControlPanelUISpecification>.     - Some changes in the replication protocol to implement "Assured Replication Mode". The        specifications are on OpenDS Wiki at <https://www.opends.org/wiki/page/AssuredMode> and section 7       described some of the replication changes required to support this. Assured Replication is not finished,       but the main replication protocol changes to support it are done. As explained by Gilles on an email on       the Dev mailing list (http://markmail.org/message/46rgo3meq3vriy4a), with these changes the newer versions       of OpenDS may not be able to replicate with OpenDS 1.0 instances.     - Support for Service Tags on the platforms where the functionality is available and enabled. Specifications       are published at <https://www.opends.org/wiki/page/OpenDSServiceTagEnabled>. For more information on       Service Tags see <http://wikis.sun.com/display/ServiceTag/Sun+Service+Tag+FAQ>.     - The Admin Connector service. In order to provide agentry of the OpenDS server at any time, a new service       has been added, dedicated to the administration, configuration and monitoring of the server.       An overview of the Admin Connector service and it's use is available on the       OpenDS wiki <https://www.opends.org/wiki/page/ManagingAdministrationTrafficToTheServer>     - Updates to the various command line tools to support the Admin Connector service.     - Some internal re-architecting of the server to put the foundation of future developments such as virtual       directory services. The new NetworkGroups and WorkFlow internal services which have been specified in       <https://www.opends.org/wiki/page/BasicOperationRoutingThroughNetworkGroup> are now implemented.     - Many bug fixes...

---
 opends/src/server/org/opends/server/replication/common/ChangeNumber.java |   66 ++++++++++++++++++++++-----------
 1 files changed, 44 insertions(+), 22 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/common/ChangeNumber.java b/opends/src/server/org/opends/server/replication/common/ChangeNumber.java
index 2b27143..8c8ef70 100644
--- a/opends/src/server/org/opends/server/replication/common/ChangeNumber.java
+++ b/opends/src/server/org/opends/server/replication/common/ChangeNumber.java
@@ -26,6 +26,8 @@
  */
 package org.opends.server.replication.common;
 
+import java.util.Date;
+
 /**
  * Class used to represent Change Numbers.
  */
@@ -143,6 +145,19 @@
   }
 
   /**
+   * Convert the ChangeNumber to a printable String that is .
+   * @return the string
+   */
+  public String toStringUI()
+  {
+    Date date = new Date(timeStamp);
+    return String.format(
+        "%016x%04x%08x (%s,%d,%d)",
+        timeStamp, serverId, seqnum,
+        date.toString(), serverId, seqnum);
+  }
+
+  /**
    * Compares 2 ChangeNumber.
    * @param CN1 the first ChangeNumber to compare
    * @param CN2 the second ChangeNumber to compare
@@ -186,35 +201,42 @@
     }
   }
 
-  /**
-   * Computes the difference in number of changes between 2
-   * change numbers.
-   * @param op1 the first ChangeNumber
-   * @param op2 the second ChangeNumber
-   * @return the difference
-   */
-  public static int diffSeqNum(ChangeNumber op1, ChangeNumber op2)
+ /**
+  * Computes the difference in number of changes between 2
+  * change numbers. First one is expected to be newer than second one. If this
+  * is not the case, 0 will be returned.
+  * @param op1 the first ChangeNumber
+  * @param op2 the second ChangeNumber
+  * @return the difference
+  */
+ public static int diffSeqNum(ChangeNumber op1, ChangeNumber op2)
   {
     int totalCount = 0;
     int max = op1.getSeqnum();
-    if (op2 != null)
+    long maxTimeStamp = op1.getTime();
+    if (op1 != null)
     {
-      int current = op2.getSeqnum();
-      if (current == max)
+      if (op2 != null)
       {
-      }
-      else if (current < max)
+        int current = op2.getSeqnum();
+        long currentTimestamp = op2.getTime();
+        if (current != max)
+        {
+          if (currentTimestamp <= maxTimeStamp)
+          {
+            if (current < max)
+            {
+              totalCount += max - current;
+            } else
+            {
+              totalCount += Integer.MAX_VALUE - (current - max) + 1;
+            }
+          }
+        }
+      } else
       {
-        totalCount += max - current;
+        totalCount += max;
       }
-      else
-      {
-        totalCount += Integer.MAX_VALUE - (current - max) + 1;
-      }
-    }
-    else
-    {
-      totalCount += max;
     }
     return totalCount;
   }

--
Gitblit v1.10.0