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

Yannick Lecaillez
15.56.2015 de0831431445f6bc2c789ba5c1519a944bb16396
OPENDJ-2548: DirectoryException while rebuilding index on PDB instance

Due to nested transaction, attributes added in the compressed-schema
during a replaceEntry might be removed in case of a database rollback
caused, for example, by optimistic lock conflict. Problem is that
compressed-schema maintain also an in-memory cache of the attributes
which becomes inconsistent after those rollback.

The fix perform the entry encoding (and as such, the compressed-schema
modification) outside the replaceEntry transaction.
1 files modified
3 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -1909,6 +1909,7 @@
      throws StorageRuntimeException, DirectoryException, CanceledOperationException
  {
    final IndexBuffer indexBuffer = new IndexBuffer();
    final ByteString encodedNewEntry = id2entry.encode(newEntry);
    try
    {
      storage.write(new WriteOperation()
@@ -1935,7 +1936,7 @@
            }
            // Ensure same ordering as deleteEntry: id2entry, dn2uri, then indexes.
            id2entry.put(txn, entryID, newEntry);
            id2entry.put(txn, entryID, encodedNewEntry);
            // Update the referral tree.
            if (modifyOperation != null)