mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
30 mins ago 729d3630daca045c4c57b5f47d91fa92a2c5de61
refs
author Valery Kharseko <vharseko@3a-systems.ru>
Saturday, November 28, 2026 10:45 +0100
committer GitHub <noreply@github.com>
Saturday, November 28, 2026 10:45 +0100
commit729d3630daca045c4c57b5f47d91fa92a2c5de61
tree 384e7469076c092ece2276d468ac804fc855dba7 tree | zip | gz
parent 70f1d20362f4a89f425ad1bfa51ae7be5f9e3eb1 view | diff
[#1208] Try a discovery responder before declaring replication isolation (#1343)

## Problem

During ordinary replication failover, the former replication server can
answer discovery and close its listening socket before the broker opens
the elected connection. The broker enters isolation after that TCP
refusal even when another replication server has already answered
discovery and can accept the session. Under `REJECT_ALL_UPDATES`, LDAP
writes can fail with result 53 until the next connection cycle.

Related to #1208. This failure was observed in the [Ubuntu / JDK
17](https://github.com/OpenIdentityPlatform/OpenDJ/actions/runs/46070263196/job/140745242110)
and [Ubuntu / JDK
27](https://github.com/OpenIdentityPlatform/OpenDJ/actions/runs/46070263196/job/140745242047)
runs for #1282 and reproduced on `master` at `2a538069c9`.

## Change

On the first reconnect after losing the established session, try one
other discovery responder if the elected former RS refuses the TCP
connection. Choose the replacement using the existing election policy
among compatible responders and check its generation again after the new
start reply. Close the provisional session if its second handshake phase
fails.

## Validation

- The socket regression makes the former RS answer discovery on an
already accepted socket after closing its listener. On `master` it
observes premature isolation. With the fix it verifies one discovery
probe and one session start on the survivor, no isolation before that
session opens, and delivery of the missing change followed by a new LDAP
modification.
- The [handshake cleanup
regression](https://github.com/OpenIdentityPlatform/OpenDJ/blob/c1e6a02b013610ed334eeddd9f98e127efca1aad/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ReplicationBrokerStopTest.java#L1138)
withholds `TopologyMsg` once after `StartSessionMsg` during ordinary
reconnect. It requires the peer to observe EOF or a TCP reset on that
same connection before teardown and verifies that a later session opens.
Removing only `close(electedRS.session)` makes the test fail with a peer
read timeout.
- Maven `verify` passed with `ReplicationBrokerStopTest` and
`ReplicationBrokerConnectFailureTest` selected (18 tests, no failures or
skips) on macOS / JDK 21. `git diff --check` passed.
2 files modified
214 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java 57 ●●●●● diff | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ReplicationBrokerStopTest.java 157 ●●●●● diff | view | raw | blame | history