From 7cebc65e3c86e7b49c3bc6f782745c182f59acf3 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Mon, 21 Sep 2026 10:07:24 +0000
Subject: [PATCH] [#1012] Pin the commit of the post-import statistics refresh, and say why it is there (#1016)

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/jdbc/JDBCStorage.java |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jdbc/JDBCStorage.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jdbc/JDBCStorage.java
index 6721873..4f56aa4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jdbc/JDBCStorage.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jdbc/JDBCStorage.java
@@ -2842,6 +2842,15 @@
 						}
 						return null;
 					});
+					// Committed here, per tree, rather than left to the caller: the connection of an import
+					// goes back to the pool as soon as this refresh is over, and CachedConnection.close()
+					// rolls back before the pool hands it on - so a refresh left inside the transaction of
+					// the borrow would be discarded by its own return, on the one engine where the database
+					// does not commit it for us. On postgres the rows ANALYZE writes to pg_statistic are
+					// ordinary catalog rows, and a rollback takes with them the histogram the "where k>?
+					// order by k" batches of #859 need, leaving only the pg_class.reltuples it writes in
+					// place; mysql (implicit commit), oracle (dbms_stats commits) and sql server commit the
+					// statement themselves, which is why no container suite pins this (issue #1012).
 					con.commit();
 				}
 			}catch (Exception e) {

--
Gitblit v1.10.0