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

Matthew Swift
23.42.2014 adedc477db26cbdc9b5874fb5ec3805dafdd3ac3
OPENDJ-1710: NPE performing deletes and potentially other indexed updates against Persistit backend

Reentrant accesses to dn2id during subtree delete were interfering with the cursor's position, causing it to delete the wrong records. Avoid interference by acquiring a per-cursor exchange.
1 files modified
14 ■■■■ changed files
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistItStorage.java 14 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/persistit/PersistItStorage.java
@@ -238,7 +238,12 @@
        @Override
        public Cursor openCursor(TreeName treeName) {
            try {
                return new CursorImpl(getExchange(treeName));
              /*
               * Acquire a new exchange for the cursor rather than using a cached
               * exchange in order to avoid reentrant accesses to the same tree
               * interfering with the cursor position.
               */
                return new CursorImpl(getExchange0(treeName, false));
            } catch (PersistitException e) {
                throw new StorageRuntimeException(e);
            }
@@ -371,8 +376,11 @@
        @Override
        public void close() {
            // Exchange is released by StorageImpl.release()
            // once the Read/Write Operation is closed
            /*
             * Release immediately because this exchange did not come from the txn
             * cache.
             */
            db.releaseExchange(ex);
        }
    }