From 3c92094914aa2d751bd2225ef32a750954fda623 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Mon, 27 Aug 2007 18:58:10 +0000
Subject: [PATCH] This adds the numSubordinates and hasSubordinates operational attribute support in OpenDS. - Implemented as virtual attributes - They are enabled by default - numSubordinates and hasSubordinates methods added to the backend API and implemented for all existing backends - JE implementation uses the id2children index to keep count of the number of subordinates for each entry. - The behavior of exceeding the index-entry-limit (ALL-IDs) has changed to store a 8 byte entry ID set count with the most significant bit set to 1 instead of a 0 byte array to signify the index-entry-limit has been exceeded. The previous format is still compatible but all requests for numSubordinates will return undefined (-1). - The DBTest tool is also included in this fix. This can be used to list root containers, entry containers, database containers, index status, as well as dumping a database with or without decoding the data.
---
opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Index.java | 83 ++++++++++++++++++-----------------------
1 files changed, 36 insertions(+), 47 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Index.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Index.java
index dee7ea1..e2a8b11 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Index.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Index.java
@@ -198,7 +198,7 @@
{
if (indexEntryLimit > 0 && entryIDList.size() >= indexEntryLimit)
{
- entryIDList = new EntryIDSet();
+ entryIDList = new EntryIDSet(entryIDList.size());
entryLimitExceededCount++;
if(debugEnabled())
@@ -212,18 +212,13 @@
}
}
- else
- {
- if(!entryIDList.add(entryID))
- {
- success = false;
- }
- }
-
- byte[] after = entryIDList.toDatabase();
- data.setData(after);
- put(txn, key, data);
}
+
+ success = entryIDList.add(entryID);
+
+ byte[] after = entryIDList.toDatabase();
+ data.setData(after);
+ put(txn, key, data);
}
else
{
@@ -245,7 +240,7 @@
* @throws DatabaseException If an error occurs in the JE database.
*/
public void removeID(Transaction txn, DatabaseEntry key, EntryID entryID)
- throws DatabaseException
+ throws DatabaseException
{
OperationStatus status;
LockMode lockMode = LockMode.RMW;
@@ -256,48 +251,42 @@
if (status == OperationStatus.SUCCESS)
{
EntryIDSet entryIDList = new EntryIDSet(key.getData(), data.getData());
- if (entryIDList.isDefined())
+ // Ignore failures if rebuild is running since the entry ID is
+ // probably already removed.
+ if (!entryIDList.remove(entryID) && !rebuildRunning)
{
- // Ignore failures if rebuild is running since the entry ID is
- // probably already removed.
- if (!entryIDList.remove(entryID) && !rebuildRunning)
+ if(trusted)
{
- // Invalidate the key by setting it undefined
- byte[] after = new EntryIDSet().toDatabase();
- data.setData(after);
- put(txn, key, data);
+ setTrusted(txn, false);
- if(trusted)
+
+
+ if(debugEnabled())
{
- setTrusted(txn, false);
-
- if(debugEnabled())
- {
- StringBuilder builder = new StringBuilder();
- StaticUtils.byteArrayToHexPlusAscii(builder, key.getData(), 4);
- TRACER.debugError("The expected entry ID does not exist in " +
- "the entry ID list for index %s.\nKey:%s",
- name, builder.toString());
- }
-
- logError(ERR_JEB_INDEX_CORRUPT_REQUIRES_REBUILD.get(name));
+ StringBuilder builder = new StringBuilder();
+ StaticUtils.byteArrayToHexPlusAscii(builder, key.getData(), 4);
+ TRACER.debugError("The expected entry ID does not exist in " +
+ "the entry ID list for index %s.\nKey:%s",
+ name, builder.toString());
}
+
+ logError(ERR_JEB_INDEX_CORRUPT_REQUIRES_REBUILD.get(name));
+ }
+ }
+ else
+ {
+ byte[] after = entryIDList.toDatabase();
+ if (after == null)
+ {
+ // No more IDs, so remove the key. If index is not
+ // trusted then this will cause all subsequent reads
+ // for this key to return undefined set.
+ delete(txn, key);
}
else
{
- byte[] after = entryIDList.toDatabase();
- if (after == null)
- {
- // No more IDs, so remove the key. If index is not
- // trusted then this will cause all subsequent reads
- // for this key to return undefined set.
- delete(txn, key);
- }
- else
- {
- data.setData(after);
- put(txn, key, data);
- }
+ data.setData(after);
+ put(txn, key, data);
}
}
}
--
Gitblit v1.10.0