mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
23.00.2015 27f221cd8a1b4afa4bd129b9b2bfcac3f701e9c2
Fixed IllegalStateException being thrown while importing 500k entries.

Importer.java:
In addToDB(), first check whether ImportIDSets are defined before checking the size.
In tmpEnv field, used DNCache instead of TmpEnv type + In DNCache, added the missing methods and javadocs from TmpEnv + removed javadocs for overriden methods

ImportIDSet.java:
Added message for triggered invalid case.
2 files modified
61 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportIDSet.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java 59 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportIDSet.java
@@ -101,7 +101,7 @@
   */
  void addEntryID(long entryID)
  {
    Reject.ifTrue(entryID < 0);
    Reject.ifTrue(entryID < 0, "entryID must always be positive");
    if (isDefined() && size() + 1 > indexEntryLimitSize) {
      entryIDSet = maintainCount ? newUndefinedSetWithSize(key, size() + 1) : newUndefinedSetWithKey(key);
    } else if (isDefined() || maintainCount) {
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)
    {