From 27f221cd8a1b4afa4bd129b9b2bfcac3f701e9c2 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 23 Apr 2015 14:00:04 +0000
Subject: [PATCH] Fixed IllegalStateException being thrown while importing 500k entries.
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java | 59 +++++++++++++++++++++++++++--------------------------------
1 files changed, 27 insertions(+), 32 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
index a1ba859..537299a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
@@ -184,7 +184,7 @@
private final boolean skipDNValidation;
/** Temporary environment used when DN validation is done in first phase. */
- private final TmpEnv tmpEnv;
+ private final DNCache tmpEnv;
/** Root container. */
private final RootContainer rootContainer;
@@ -2059,12 +2059,12 @@
}
else
{
- if (deleteSet.size() > 0 || !deleteSet.isDefined())
+ if (!deleteSet.isDefined() || deleteSet.size() > 0)
{
final Index index = indexIDToIndexMap.get(indexID);
index.importRemove(txn, deleteSet);
}
- if (insertSet.size() > 0 || !insertSet.isDefined())
+ if (!insertSet.isDefined() || insertSet.size() > 0)
{
final Index index = indexIDToIndexMap.get(indexID);
index.importPut(txn, insertSet);
@@ -3709,10 +3709,22 @@
*/
public static interface DNCache
{
+ /**
+ * Insert the specified DN into the DN cache. It will return {@code true} if the DN does not
+ * already exist in the cache and was inserted, or {@code false} if the DN exists already in the
+ * cache.
+ *
+ * @param dn
+ * The DN to insert in the cache.
+ * @return {@code true} if the DN was inserted in the cache, or {@code false} if the DN exists
+ * in the cache already and could not be inserted.
+ * @throws StorageRuntimeException
+ * If an error occurs accessing the database.
+ */
+ boolean insert(DN dn);
/**
- * Returns {@code true} if the specified DN is contained in the DN cache, or
- * {@code false} otherwise.
+ * Returns whether the specified DN is contained in the DN cache.
*
* @param dn
* The DN to check the presence of.
@@ -3722,6 +3734,14 @@
* If an error occurs reading the database.
*/
boolean contains(DN dn) throws StorageRuntimeException;
+
+ /**
+ * Shuts the DN cache down.
+ *
+ * @throws StorageRuntimeException
+ * If error occurs.
+ */
+ void shutdown();
}
/** Invocation handler for the {@link PluggableBackendCfg} proxy. */
@@ -3830,12 +3850,7 @@
return ByteString.valueOf(hash);
}
- /**
- * Shutdown the temporary environment.
- *
- * @throws StorageRuntimeException
- * If error occurs.
- */
+ @Override
public void shutdown() throws StorageRuntimeException
{
try
@@ -3848,19 +3863,7 @@
}
}
- /**
- * Insert the specified DN into the DN cache. It will return {@code true} if
- * the DN does not already exist in the cache and was inserted, or
- * {@code false} if the DN exists already in the cache.
- *
- * @param dn
- * The DN to insert in the cache.
- * @return {@code true} if the DN was inserted in the cache, or
- * {@code false} if the DN exists in the cache already and could not
- * be inserted.
- * @throws StorageRuntimeException
- * If an error occurs accessing the database.
- */
+ @Override
public boolean insert(DN dn) throws StorageRuntimeException
{
// Use a compact representation for key
@@ -3960,14 +3963,6 @@
return false;
}
- /**
- * Check if the specified DN is contained in the temporary DN cache.
- *
- * @param dn
- * A DN check for.
- * @return {@code true} if the specified DN is in the temporary DN cache, or
- * {@code false} if it is not.
- */
@Override
public boolean contains(final DN dn)
{
--
Gitblit v1.10.0