From 35a4e8a46adf60988cc29fd82c0115126c1660a3 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 22 Sep 2026 09:07:01 +0000
Subject: [PATCH] [#992] Apply the confidentiality of a backend index to the running backend (#1000)
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java | 47 ++++++++++++++++++++++++++++++++++++++---------
1 files changed, 38 insertions(+), 9 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
index 88edf18..f1799b5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DefaultIndex.java
@@ -53,7 +53,18 @@
/** The limit on the number of entry IDs that may be indexed by one key. */
private int indexEntryLimit;
- private EntryIDSetCodec codec;
+ /**
+ * Volatile because {@link #afterOpen} binds it to the confidentiality then in force, and an index
+ * whose configuration gives that setting up - or asks for it - is opened again while operations of
+ * other threads are holding this instance.
+ */
+ private volatile EntryIDSetCodec codec;
+ /**
+ * Whether that codec encrypts: the confidentiality this index was opened under. Held here rather
+ * than read from the suite, since the suite carries the setting now in force for the attribute,
+ * which this index writes under only once its tree has been given up and opened again.
+ */
+ private volatile boolean encrypted;
private CryptoSuite cryptoSuite;
/**
@@ -98,7 +109,8 @@
{
final EnumSet<IndexFlag> flags = state.getIndexFlags(txn, getName());
codec = flags.contains(COMPACTED) ? CODEC_V2 : CODEC_V1;
- if (cryptoSuite.isEncrypted())
+ encrypted = cryptoSuite.isEncrypted();
+ if (encrypted)
{
codec = new EntryIDSet.EntryIDSetCodecV3(codec, cryptoSuite);
}
@@ -307,12 +319,6 @@
}
@Override
- public boolean setConfidential(boolean indexConfidential)
- {
- return cryptoSuite.isEncrypted() != indexConfidential;
- }
-
- @Override
public final int getIndexEntryLimit()
{
return indexEntryLimit;
@@ -338,8 +344,31 @@
return trusted;
}
+ /** Whether this index encrypts what it writes: the confidentiality its tree was opened under. */
final boolean isEncrypted()
{
- return cryptoSuite.isEncrypted();
+ return encrypted;
+ }
+
+ /** The codec this index currently reads and writes under. */
+ final EntryIDSetCodec codec()
+ {
+ return codec;
+ }
+
+ /**
+ * Puts this index back to the confidentiality, codec and trust it answered before its tree was
+ * given up and opened again, for a reopen whose commit the storage gave up: what
+ * {@link #afterOpen} binds is memory, and outlives a write the storage rolled back, so a change
+ * asked for again would otherwise find this index already agreeing with the setting that write
+ * never durably reached. The trust is bound the same way - an index opened over an empty entry
+ * container is trusted on the spot - and, left behind, is what an operation which then fails
+ * writes down for every index in its buffer, for a tree the give-up took with it.
+ */
+ final void revertFailedReopen(boolean encrypted, EntryIDSetCodec codec, boolean trusted)
+ {
+ this.encrypted = encrypted;
+ this.codec = codec;
+ this.trusted = trusted;
}
}
--
Gitblit v1.10.0