From c9f289f79ccc24d93f3ff4613f2264a334121aac Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 25 Jun 2010 10:53:07 +0000
Subject: [PATCH] Fixes an issue with inconsistent Last Change Number in the External Changelog when there are deleted and newly created replication domains
---
opendj-sdk/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java | 70 ++++++++++++++++++++++++++++++++++-
1 files changed, 68 insertions(+), 2 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java b/opendj-sdk/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java
index b1a1e84..468bd34 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/server/DraftCNDbHandler.java
@@ -571,8 +571,8 @@
catch(Exception e)
{
if (debugEnabled())
- TRACER.debugInfo("In DraftCNDbHandler.getGeneralizedState, read: " +
- " key=" + key + " genServerState returned is null" +
+ TRACER.debugInfo("In DraftCNDbHandler.getValue, read: " +
+ " key=" + key + " value returned is null" +
" first=" + db.readFirstDraftCN() +
" last=" + db.readLastDraftCN() +
" count=" + db.count() +
@@ -586,4 +586,70 @@
}
return value;
}
+
+ /**
+ * Get the CN associated to a provided key.
+ * @param key the provided key.
+ * @return the associated CN, null when none.
+ */
+ public ChangeNumber getChangeNumber(int key)
+ {
+ ChangeNumber cn = null;
+ DraftCNDBCursor draftCNDBCursor = null;
+ try
+ {
+ draftCNDBCursor = db.openReadCursor(key);
+ cn = draftCNDBCursor.currentChangeNumber();
+ }
+ catch(Exception e)
+ {
+ if (debugEnabled())
+ TRACER.debugInfo("In DraftCNDbHandler.getChangeNumber, read: " +
+ " key=" + key + " changeNumber returned is null" +
+ " first=" + db.readFirstDraftCN() +
+ " last=" + db.readLastDraftCN() +
+ " count=" + db.count() +
+ " exception" + e + " " + e.getMessage());
+ return null;
+ }
+ finally
+ {
+ if (draftCNDBCursor != null)
+ draftCNDBCursor.close();
+ }
+ return cn;
+ }
+
+ /**
+ * Get the serviceID associated to a provided key.
+ * @param key the provided key.
+ * @return the serviceID, null when none.
+ */
+ public String getServiceID(int key)
+ {
+ String sid = null;
+ DraftCNDBCursor draftCNDBCursor = null;
+ try
+ {
+ draftCNDBCursor = db.openReadCursor(key);
+ sid = draftCNDBCursor.currentServiceID();
+ }
+ catch(Exception e)
+ {
+ if (debugEnabled())
+ TRACER.debugInfo("In DraftCNDbHandler.getServiceID, read: " +
+ " key=" + key + " serviceID returned is null" +
+ " first=" + db.readFirstDraftCN() +
+ " last=" + db.readLastDraftCN() +
+ " count=" + db.count() +
+ " exception" + e + " " + e.getMessage());
+ return null;
+ }
+ finally
+ {
+ if (draftCNDBCursor != null)
+ draftCNDBCursor.close();
+ }
+ return sid;
+ }
}
--
Gitblit v1.10.0