From add86d3c7c047215f886c51e2b29a4c7f1e86c0c Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Thu, 03 Sep 2026 08:21:14 +0000
Subject: [PATCH] [#877] Bound a statement of the JDBC backend by the class of the work it belongs to (#882)
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
index e9188ab..a7ae259 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -2380,7 +2380,29 @@
long getNumberOfEntriesInBaseDN0(ReadableTransaction txn)
{
- return id2childrenCount.getTotalCount(txn);
+ return getNumberOfEntriesInBaseDN0(txn, false);
+ }
+
+ /**
+ * The same count, told which kind of work it is part of: {@code verify-index} reads it before
+ * walking the whole backend, with nobody waiting on the walk or on the count that sizes it, while
+ * {@code cn=monitor} and the searches of {@code GroupManager} and {@code SubentryManager} read it
+ * for a client.
+ * <p>
+ * The read behind {@code NOTE_BACKEND_STARTED} is deliberately left with the client callers,
+ * though nobody waits on it either: it goes through {@code BackendImpl.getEntryCount()}, which is
+ * the same method those three call, and what a bound costs it there is a log line reporting -1
+ * entries - that method answers -1 for any failure rather than failing the open.
+ *
+ * @param txn storage transaction
+ * @param partOfAWholeTreeWalk whether this read belongs to a walk of a whole tree rather than to
+ * a client operation
+ * @return The number of entries stored in this entry container including the baseDN.
+ * @see ReadableTransaction#openBulkCursor(TreeName)
+ */
+ long getNumberOfEntriesInBaseDN0(ReadableTransaction txn, boolean partOfAWholeTreeWalk)
+ {
+ return id2childrenCount.getTotalCount(txn, partOfAWholeTreeWalk);
}
/**
--
Gitblit v1.10.0