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

dugan
05.55.2008 1d7fd2564372abdccb1a0b41c2af5cfe15f14064
Fix issue where random entries are rejected. Issue 3135.
3 files modified
29 ■■■■ changed files
opends/src/server/org/opends/server/backends/jeb/importLDIF/DNContext.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java 23 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/WorkThread.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/importLDIF/DNContext.java
@@ -455,11 +455,11 @@
      }
      int i=0;
      //If the parent is in the pending map, another thread is working on the
      //parent entry; wait until that thread is done with the parent.
      //parent entry; wait 500ms until that thread is done with the parent.
      while(isPending(parentDN)) {
        try {
          Thread.sleep(50);
          if(i == 5) {
          if(i == 10) {
            return null;
          }
          i++;
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -141,6 +141,15 @@
  //Set to true if substring indexes are defined.
  private boolean hasSubIndexes = false;
  //Work thread 0, used to add the first 20 or so entries single threaded.
  private WorkThread workThread0;
  //Counter for thread 0;
  private int worker0Proc=0;
  //Max thread 0 adds.
  private static final int maxWorker0 = 20;
  /**
   * Create a new import job with the specified ldif import config.
   *
@@ -185,6 +194,9 @@
                bufferManager, rootContainer, importMap);
        t.setUncaughtExceptionHandler(this);
        threads.add(t);
        if(i == 0) {
          workThread0 = t;
        }
        t.start();
      }
    }
@@ -444,11 +456,20 @@
   * @param DNContext The import context.
   * @param entry The entry to process.
   */
  private void processEntry(DNContext DNContext, Entry entry) {
  private void processEntry(DNContext DNContext, Entry entry)
               throws DirectoryException, DatabaseException, JebException {
    if(worker0Proc < maxWorker0) {
       DNContext.addPending(entry.getDN());
       WorkElement element =
            WorkElement.decode(entry, DNContext);
        workThread0.process(element);
        worker0Proc++;
    } else {
    //Add this DN to the pending map.
    DNContext.addPending(entry.getDN());
    addEntryQueue(DNContext, entry);
  }
  }
  /**
   * Add work item to specified import context's queue.
opends/src/server/org/opends/server/backends/jeb/importLDIF/WorkThread.java
@@ -172,7 +172,7 @@
   * @throws DirectoryException If a directory error occurs.
   * @throws JebException If a JEB error occurs.
   */
  private void process(WorkElement element)
  public void process(WorkElement element)
  throws DatabaseException, DirectoryException, JebException {
    EntryID entryID;
    if((entryID = processDN2ID(element)) == null)