From abd513b18b6271c54c01c42d44453f9c5f241599 Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Wed, 30 Apr 2008 18:31:16 +0000
Subject: [PATCH] Performance changes to import. Mostly for issue 3161.

---
 opendj-sdk/opends/src/server/org/opends/server/backends/jeb/Index.java |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 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 739d4b7..b9874cb 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
@@ -318,14 +318,14 @@
    * @param txn A transaction.
    * @param key The key to add the set to.
    * @param importIdSet The set of import IDs.
+   * @param data Database entry to reuse for read
    * @throws DatabaseException If an database error occurs.
    */
   public void insert(Transaction txn, DatabaseEntry key,
-                     ImportIDSet importIdSet)
+                     ImportIDSet importIdSet, DatabaseEntry data)
   throws DatabaseException {
 
     OperationStatus status;
-    DatabaseEntry data = new DatabaseEntry();
       status = read(txn, key, data, LockMode.RMW);
       if(status == OperationStatus.SUCCESS) {
         ImportIDSet newImportIDSet = new IntegerImportIDSet();
@@ -348,24 +348,26 @@
 
 
   /**
-   * Add the specified entry ID to the provided keys in the keyset.
+   * Add the specified import ID set to the provided keys in the keyset.
    *
    * @param txn  A transaction.
+   * @param importIDSet A import ID set to use.
    * @param keySet  The set containing the keys.
-   * @param entryID The entry ID.
+   * @param keyData A key database entry to use.
+   * @param data A database entry to use for data.
    * @return <CODE>True</CODE> if the insert was successful.
    * @throws DatabaseException If a database error occurs.
    */
   public synchronized
-  boolean insert(Transaction txn, Set<byte[]> keySet, EntryID entryID)
-  throws DatabaseException {
+  boolean insert(Transaction txn, ImportIDSet importIDSet, Set<byte[]> keySet,
+                 DatabaseEntry keyData, DatabaseEntry data)
+          throws DatabaseException {
     for(byte[] key : keySet) {
-      if(insertIDWithRMW(txn, new DatabaseEntry(key), new DatabaseEntry(),
-              entryID.getDatabaseEntry(), entryID) !=
-              OperationStatus.SUCCESS)  {
-        return false;
-      }
+      keyData.setData(key);
+      insert(txn, keyData, importIDSet, data);
     }
+    keyData.setData(null);
+    data.setData(null);
     return true;
   }
 

--
Gitblit v1.10.0