From 400fb2694641b05e53217d3c742a6e49e3a254c6 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Sun, 29 Nov 2026 07:16:47 +0000
Subject: [PATCH] [#1208] Preserve replication history during scaling, recovery and shutdown (#1282)
---
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplSessionSecurity.java | 39 +++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplSessionSecurity.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplSessionSecurity.java
index 649d79d..1629e83 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplSessionSecurity.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplSessionSecurity.java
@@ -32,6 +32,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
+import org.forgerock.opendj.ldap.DN;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.CryptoManager;
import org.opends.server.util.FailureLogThrottle;
@@ -49,6 +50,8 @@
private static final String REPLICATION_CLIENT_NAME = "Replication Client";
+ private static final String TRACE_TLS_FAILURES = "org.opends.server.replication.traceTlsFailures";
+
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
/**
@@ -175,6 +178,33 @@
public Session createClientSession(final Socket socket,
final int soTimeout) throws ConfigException, IOException
{
+ return createClientSession(socket, soTimeout, null, 0, null);
+ }
+
+ /**
+ * Creates a client session with optional per-attempt TLS diagnostics. The
+ * diagnostic records the socket endpoints before closing the socket, even
+ * if the caller has already reported the outage.
+ *
+ * @param socket
+ * The connected socket.
+ * @param soTimeout
+ * The socket timeout option.
+ * @param role
+ * The client role (DS or RS).
+ * @param serverId
+ * The client ID for the attempted session.
+ * @param baseDN
+ * The domain for the attempted session, or null to omit diagnostics.
+ * @return The new protocol session.
+ * @throws ConfigException
+ * If the session configuration is invalid.
+ * @throws IOException
+ * If the session cannot be established.
+ */
+ public Session createClientSession(final Socket socket, final int soTimeout,
+ final String role, final int serverId, final DN baseDN) throws ConfigException, IOException
+ {
boolean hasCompleted = false;
SSLSocket secureSocket = null;
@@ -206,6 +236,15 @@
hasCompleted = true;
return new Session(socket, secureSocket);
}
+ catch (final SSLException e)
+ {
+ if (baseDN != null && Boolean.getBoolean(TRACE_TLS_FAILURES))
+ {
+ logger.info(NOTE_REPLICATION_TLS_CLIENT_FAILURE, role, serverId, baseDN,
+ socket.getLocalSocketAddress(), socket.getRemoteSocketAddress());
+ }
+ throw e;
+ }
finally
{
if (!hasCompleted)
--
Gitblit v1.10.0