From 0d9383e9bdcfc20e808968f4b7fe6c1ac0f48fa6 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Mon, 17 Aug 2009 00:23:12 +0000
Subject: [PATCH] These changes allow import-ldif to support multiple suffixes and fix some problems with the include/exclude options.
---
opends/src/server/org/opends/server/backends/jeb/Index.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 52 insertions(+), 4 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/Index.java b/opends/src/server/org/opends/server/backends/jeb/Index.java
index 98c93a6..3e39920 100644
--- a/opends/src/server/org/opends/server/backends/jeb/Index.java
+++ b/opends/src/server/org/opends/server/backends/jeb/Index.java
@@ -310,13 +310,39 @@
private void
+ deleteKey(DatabaseEntry key, ImportIDSet importIdSet,
+ DatabaseEntry data) throws DatabaseException {
+
+
+ OperationStatus status = read(null, key, data, LockMode.RMW);
+ if(status == OperationStatus.SUCCESS) {
+ ImportIDSet newImportIDSet = new ImportIDSet(data.getData().length/8,
+ indexEntryLimit, maintainCount);
+ newImportIDSet.remove(data.getData(), importIdSet);
+ if(newImportIDSet.isDefined() && (newImportIDSet.size() == 0))
+ {
+ delete(null, key);
+ }
+ else
+ {
+ data.setData(newImportIDSet.toDatabase());
+ put(null, key, data);
+ }
+ } else {
+ //Should never happen -- the keys should always be there.
+ throw new DatabaseException();
+ }
+ }
+
+
+ private void
insertKey(DatabaseEntry key, ImportIDSet importIdSet,
DatabaseEntry data) throws DatabaseException {
OperationStatus status = read(null, key, data, LockMode.RMW);
if(status == OperationStatus.SUCCESS) {
- ImportIDSet newImportIDSet = new ImportIDSet();
- if (newImportIDSet.merge(data.getData(), importIdSet, indexEntryLimit,
- maintainCount))
+ ImportIDSet newImportIDSet = new ImportIDSet(data.getData().length/8,
+ indexEntryLimit, maintainCount);
+ if (newImportIDSet.merge(data.getData(), importIdSet))
{
entryLimitExceededCount++;
}
@@ -357,6 +383,28 @@
/**
+ * Delete the specified import ID set from the import ID set associated with
+ * the key.
+ *
+ * @param key The key to delete the set from.
+ * @param importIdSet The import ID set to delete.
+ * @param data A database entry to use for data.
+ *
+ * @throws DatabaseException If a database error occurs.
+ */
+ public void
+ delete(DatabaseEntry key, ImportIDSet importIdSet,
+ DatabaseEntry data) throws DatabaseException {
+ Cursor cursor = curLocal.get();
+ if(cursor == null) {
+ cursor = openCursor(null, null);
+ curLocal.set(cursor);
+ }
+ deleteKey(key, importIdSet, data);
+ }
+
+
+ /**
* Add the specified import ID set to the provided keys in the keyset.
*
* @param importIDSet A import ID set to use.
@@ -766,7 +814,7 @@
* @param entryID The entry ID to delete.
* @throws DatabaseException If a database error occurs.
*/
- public synchronized
+ public
void delete(Transaction txn, Set<byte[]> keySet, EntryID entryID)
throws DatabaseException {
setTrusted(txn, false);
--
Gitblit v1.10.0