From 97dbf50dd56ee7640411ac61e6aa288f208a4375 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 01 Sep 2026 08:54:30 +0000
Subject: [PATCH] [#874] Grant the offline tools a read-only JDBC transaction instead of refusing it (#880)
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
index 757aa99..ca84641 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -105,6 +105,7 @@
/** The storage associated with this index. */
private final Storage storage;
private final State state;
+ private final EntryContainer entryContainer;
/**
* A flag to indicate if this vlvIndex should be trusted to be consistent with the entries tree.
@@ -131,15 +132,8 @@
}
this.state = state;
+ this.entryContainer = entryContainer;
this.trusted = state.getIndexFlags(txn, getName()).contains(IndexFlag.TRUSTED);
- if (!trusted && entryContainer.getHighestEntryID(txn).longValue() == 0)
- {
- /*
- * If there are no entries in the entry container then there is no reason why this vlvIndex
- * can't be upgraded to trusted.
- */
- setTrusted(txn, true);
- }
this.config.addChangeListener(this);
}
@@ -163,6 +157,19 @@
void afterOpen(final WriteableTransaction txn, boolean createOnDemand) throws StorageRuntimeException
{
counter.open(txn, createOnDemand);
+ if (createOnDemand && !trusted && entryContainer.isEmpty(txn))
+ {
+ /*
+ * If there are no entries in the entry container then there is no reason why this vlvIndex
+ * can't be upgraded to trusted.
+ *
+ * Guarded by createOnDemand - which is accessMode.isWriteable() - and done here rather than in the
+ * constructor, as DefaultIndex.afterOpen() does: the transaction a read-only container opens is not
+ * allowed to write, so upgrading an untrusted index of an empty backend used to fail the offline tools
+ * on it instead of leaving the flag alone (#874).
+ */
+ setTrusted(txn, true);
+ }
}
@Override
--
Gitblit v1.10.0