From 0c04328d7c86a6b2d4badb96c79a22aba2fa7eca Mon Sep 17 00:00:00 2001
From: dugan <dugan@localhost>
Date: Fri, 16 May 2008 14:18:26 +0000
Subject: [PATCH] Fixes to improve performance using default JVM ergonomics:
---
opends/src/server/org/opends/server/backends/jeb/importLDIF/BufferManager.java | 33 ++++++++++++++++++++-------------
1 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/importLDIF/BufferManager.java b/opends/src/server/org/opends/server/backends/jeb/importLDIF/BufferManager.java
index a1a8f74..b314d93 100644
--- a/opends/src/server/org/opends/server/backends/jeb/importLDIF/BufferManager.java
+++ b/opends/src/server/org/opends/server/backends/jeb/importLDIF/BufferManager.java
@@ -31,7 +31,6 @@
import org.opends.server.types.Entry;
import org.opends.server.backends.jeb.Index;
import org.opends.server.backends.jeb.EntryID;
-import com.sleepycat.je.Transaction;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.DatabaseEntry;
import com.sleepycat.je.dbi.MemoryBudget;
@@ -92,15 +91,14 @@
private ReentrantLock lock = new ReentrantLock();
//Object to synchronize on if backup maps are being written.
- private Object backupSynchObj = new Object();
+ private final Object backupSynchObj = new Object();
/**
* Create buffer manager instance.
*
* @param memoryLimit The memory limit.
- * @param importThreadCount The count of import worker threads.
*/
- public BufferManager(long memoryLimit, int importThreadCount) {
+ public BufferManager(long memoryLimit) {
this.memoryLimit = memoryLimit;
this.nextElem = null;
this.backupMap = backupMap1;
@@ -113,13 +111,12 @@
* @param index The index to use.
* @param entry The entry used to build the key set.
* @param entryID The entry ID to insert into the key set.
- * @param txn A transaction.
* @param keySet Keyset hash to store the keys in.
* @throws DatabaseException If a problem happened during a flushAll cycle.
*/
void insert(Index index, Entry entry,
- EntryID entryID, Transaction txn, Set<byte[]> keySet)
+ EntryID entryID, Set<byte[]> keySet)
throws DatabaseException {
keySet.clear();
@@ -147,13 +144,12 @@
* @param id2subtree The id2subtree index to use.
* @param entry The entry used to build the key set.
* @param entryID The entry ID to insert into the key set.
- * @param txn A transaction.
* @param childKeySet id2children key set hash to use.
* @param subKeySet subtree key set hash to use.
* @throws DatabaseException If a problem occurs during processing.
*/
void insert(Index id2children, Index id2subtree, Entry entry,
- EntryID entryID, Transaction txn, Set<byte[]> childKeySet,
+ EntryID entryID, Set<byte[]> childKeySet,
Set<byte[]> subKeySet) throws DatabaseException {
childKeySet.clear();
id2children.indexer.indexEntry(entry, childKeySet);
@@ -207,7 +203,6 @@
void mergeMap() {
TreeMap<KeyHashElement, KeyHashElement> tmpMap;
synchronized(backupSynchObj) {
- tmpMap = backupMap;
if(currentMap == 1) {
backupMap = backupMap2;
tmpMap = backupMap1;
@@ -298,7 +293,7 @@
int oldSize = curElem.getMemorySize();
Index index = curElem.getIndex();
dbEntry.setData(curElem.getKey());
- index.insert(null, dbEntry, curElem.getIDSet(), entry);
+ index.insert(dbEntry, curElem.getIDSet(), entry);
if(curElem.isDefined()) {
memoryUsage -= TREEMAP_ENTRY_OVERHEAD + curElem.getMemorySize();
iter.remove();
@@ -342,9 +337,11 @@
DatabaseEntry dbEntry = new DatabaseEntry();
DatabaseEntry entry = new DatabaseEntry();
for (KeyHashElement curElem : tSet) {
- Index index = curElem.getIndex();
- dbEntry.setData(curElem.getKey());
- index.insert(null, dbEntry, curElem.getIDSet(), entry);
+ if(curElem.isDirty()) {
+ Index index = curElem.getIndex();
+ dbEntry.setData(curElem.getKey());
+ index.insert(dbEntry, curElem.getIDSet(), entry);
+ }
}
}
@@ -560,5 +557,15 @@
importIDSet.merge(e.importIDSet, e.getIndex().getIndexEntryLimit(),
e.getIndex().getMaintainCount());
}
+
+ /**
+ * Return if an undefined import ID set has been written to the index DB.
+ *
+ * @return <CODE>True</CODE> if an undefined importID set has been written
+ * to the index DB.
+ */
+ public boolean isDirty() {
+ return importIDSet.isDirty();
+ }
}
}
--
Gitblit v1.10.0