From 067771ecaf547a6a25a52f4c8a38575d0dbd8015 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 16 Jan 2007 20:13:21 +0000
Subject: [PATCH] Revert the changes made in revision 980 because they appear to be responsible for a number of test case failures and a potential deadlock.

---
 opends/src/server/org/opends/server/synchronization/changelog/ChangelogDB.java |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/opends/src/server/org/opends/server/synchronization/changelog/ChangelogDB.java b/opends/src/server/org/opends/server/synchronization/changelog/ChangelogDB.java
index 29e92ba..fc94e70 100644
--- a/opends/src/server/org/opends/server/synchronization/changelog/ChangelogDB.java
+++ b/opends/src/server/org/opends/server/synchronization/changelog/ChangelogDB.java
@@ -170,6 +170,10 @@
   public ChangelogCursor openReadCursor(ChangeNumber changeNumber)
                 throws DatabaseException, Exception
   {
+    if (changeNumber == null)
+      changeNumber = readFirstChange();
+    if (changeNumber == null)
+      return null;
     return new ChangelogCursor(changeNumber);
   }
 
@@ -315,16 +319,13 @@
     {
       cursor = db.openCursor(txn, null);
 
-      if (startingChangeNumber != null)
-      {
-        key = new ChangelogKey(startingChangeNumber);
-        data = new DatabaseEntry();
+      DatabaseEntry key = new ChangelogKey(startingChangeNumber);
+      DatabaseEntry data = new DatabaseEntry();
 
-        if (cursor.getSearchKey(key, data, LockMode.DEFAULT) !=
-          OperationStatus.SUCCESS)
-        {
-          throw new Exception("ChangeNumber not available");
-        }
+      if (cursor.getSearchKey(key, data, LockMode.DEFAULT) !=
+        OperationStatus.SUCCESS)
+      {
+        throw new Exception("ChangeNumber not available");
       }
     }
 
@@ -372,7 +373,7 @@
     }
 
     /**
-     * Get the next ChangeNumber in the database from this Cursor.
+     * Get the next ChangeNumber inthe database from this Cursor.
      *
      * @return The next ChangeNumber in the database from this cursor.
      * @throws DatabaseException In case of underlying database problem.

--
Gitblit v1.10.0