Skip to content

Wait for the renamed entry before reading the naming conflict monitor - #895

Open
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix/naming-conflicts-flaky-monitor-delta
Open

Wait for the renamed entry before reading the naming conflict monitor#895
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix/naming-conflicts-flaky-monitor-delta

Conversation

@vharseko

Copy link
Copy Markdown
Member

UpdateOperationTest.namingConflicts fails intermittently in CI with

java.lang.AssertionError: expected [1] but found [2]
	at org.opends.server.replication.UpdateOperationTest.namingConflicts(UpdateOperationTest.java:756)

seen on JDK 25 in run 32375391745, where the other JDKs of the same run passed.

Why

The clean-up after the two-adds-one-DN case publishes a delete for each entry and then waits for each DN to go:

broker.publish(new DeleteMsg(personWithUUIDEntry.getName(),      gen.newCSN(), user1entryUUID));
broker.publish(new DeleteMsg(personWithSecondUniqueID.getName(), gen.newCSN(), user1entrysecondUUID));

assertNull(getEntry(personWithUUIDEntry.getName(), 10000, false), ...);
assertNull(getEntry(personWithSecondUniqueID.getName(), 10000, false), ...);

Both entries were created with the same DN — personWithSecondUniqueID is built at user1dn, the DN of personWithUUIDEntry — and the conflicting one has since been renamed by the test to entryuuid=<user1entrysecondUUID> + user1dn. So both waits watch user1dn and both return the moment the first delete is replayed. Nothing waits for the second.

The second delete is the one with a conflict to solve: its DN holds no entry any more, so solveNamingConflict(DeleteOperation) finds the renamed entry by entryUUID and counts a resolved naming conflict before replaying the delete against the new DN. The next section snapshots that counter with updateMonitorCount(baseDN, resolvedMonitorAttr) and asserts a delta of 1 for the conflict it raises itself — so a count that arrives late is read as its own, and the assertion sees 2.

Fix

Wait for the DN the rename gave the entry. The count is taken before the replayed delete, so an entry gone from that DN means the count is already in the monitor.

The other clean-up block in the same method waits on a distinct DN per delete and is not affected.

Verification

mvn -pl opendj-server-legacy verify -Pprecommit -Dit.test='UpdateOperationTest#namingConflicts'Tests run: 1, Failures: 0, Errors: 0.

UpdateOperationTest.namingConflicts cleans up after the two-adds-one-DN case
by publishing a delete for each entry and then waiting for each DN to go. Both
entries were created with the same DN, though - personWithSecondUniqueID is
built at user1dn, the DN of personWithUUIDEntry - and the conflicting one has
since been renamed to "entryuuid=<uuid> + user1dn". So both waits watch user1dn
and both return the moment the first delete is replayed; nothing waits for the
second.

That second delete is the one with a conflict to solve. Its DN holds no entry
any more, so solveNamingConflict(DeleteOperation) finds the renamed one by
entryUUID and counts a resolved naming conflict before replaying the delete
against the new DN. The next section snapshots that counter with
updateMonitorCount() and asserts a delta of 1 for the conflict it raises itself,
so a count that arrives late is read as its own: "expected [1] but found [2]",
as on JDK 25 in run 32375391745.

Wait for the DN the rename gave the entry instead. The count is taken before
the replayed delete, so an entry gone from that DN means the count is already
in the monitor.
@vharseko
vharseko requested a review from maximthomas August 21, 2026 06:37
@vharseko vharseko added tests Test suites: fixing, enabling, un-disabling replication java Pull requests that update java code labels Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update java code replication tests Test suites: fixing, enabling, un-disabling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant