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

abobrov
21.56.2007 0bc01c5f010215ce449fffad038bd2fc1a9046c1
- fix map inconsistency bug in clearBackend method.
- sanitize backend handling in clearSubtree method.
1 files modified
21 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/extensions/FileSystemEntryCache.java 21 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/extensions/FileSystemEntryCache.java
@@ -860,14 +860,20 @@
    Map<Long,DN> backendEntriesMap = backendMap.get(backend);
    try {
      if (backendEntriesMap == null) {
        // No entries were in the cache for this backend,
        // so we can return without doing anything.
        return;
      }
      int entriesExamined = 0;
      Set<Long> entriesSet = backendEntriesMap.keySet();
      Iterator<Long> backendEntriesIterator = entriesSet.iterator();
      Iterator<Long> backendEntriesIterator =
        backendEntriesMap.keySet().iterator();
      while (backendEntriesIterator.hasNext()) {
        long entryID = backendEntriesIterator.next();
        Long entryID = backendEntriesIterator.next();
        DN entryDN = backendEntriesMap.get(entryID);
        entryCacheDB.delete(null,
            new DatabaseEntry(entryDN.toNormalizedString().getBytes("UTF-8")));
        backendEntriesIterator.remove();
        dnMap.remove(entryDN);
        // This can take a while, so we'll periodically release and re-acquire
@@ -881,12 +887,13 @@
        }
      }
      // This backend is empty now, remove it from the backend map.
      backendMap.remove(backend);
    } catch (Exception e) {
      if (debugEnabled()) {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }
    } finally {
      backendMap.remove(backend);
      cacheWriteLock.unlock();
    }
  }
@@ -980,6 +987,12 @@
      }
    }
    // If this backend becomes empty now
    // remove it from the backend map.
    if (map.isEmpty()) {
      backendMap.remove(backend);
    }
    // See if the backend has any subordinate backends.  If so, then process
    // them recursively.
    for (Backend subBackend : backend.getSubordinateBackends())