From 2d99dd7e2843c998a2d15f072cb827f443a79809 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Wed, 23 Sep 2026 07:39:43 +0000
Subject: [PATCH] [#1014] Report a ReplicaOfflineMsg as forwarded only to a peer which can decode it (#1019)
---
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicaOfflineMsg.java | 30 +++++++++++++++++++++++++++++-
1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicaOfflineMsg.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicaOfflineMsg.java
index 80dc167..d2768e6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicaOfflineMsg.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ReplicaOfflineMsg.java
@@ -12,6 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2014 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
*/
package org.opends.server.replication.protocol;
@@ -81,7 +82,7 @@
@Override
public byte[] getBytes(short protocolVersion)
{
- if (protocolVersion < ProtocolVersion.REPLICATION_PROTOCOL_V8)
+ if (!isSupportedBy(protocolVersion))
{
return null;
}
@@ -94,6 +95,33 @@
/** {@inheritDoc} */
@Override
+ public boolean isEncodableFor(short protocolVersion)
+ {
+ return isSupportedBy(protocolVersion);
+ }
+
+ /**
+ * Whether a peer which negotiated the provided replication protocol version
+ * can be sent this message at all.
+ * <p>
+ * The message was introduced by
+ * {@link ProtocolVersion#REPLICATION_PROTOCOL_V8} and has no encoding below
+ * it: an older peer is not told that the replica went offline, and cannot be.
+ * This answers for the message type, for a caller which has no instance at
+ * hand - see {@link #isEncodableFor(short)} for the one which has.
+ *
+ * @param protocolVersion
+ * The protocol version negotiated with the peer.
+ * @return <code>true</code> if that version carries this message,
+ * <code>false</code> otherwise.
+ */
+ public static boolean isSupportedBy(short protocolVersion)
+ {
+ return protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V8;
+ }
+
+ /** {@inheritDoc} */
+ @Override
public int size()
{
return bytes(1) + shorts(1) + csns(1);
--
Gitblit v1.10.0