Uh oh!
There was an error while loading. Please reload this page.
Remove the unfixable testStateMachineFull and fix the dead replay pool - #700
Merged
vharseko merged 2 commits intoJul 8, 2026
Merged
Conversation
testStateMachineFull (a walk through all replication state machine transitions) has been disabled since the ForgeRock era. Investigation showed it cannot work in its historical form: the degraded status only appears while the replication server queues changes faster than the DS replays them, which makes every degraded transition a race between the publisher and the replay on modern hardware, and the unbounded floods needed to force it exhaust the 512m test JVM heap with real backend entries before the status analyzer (5 second period) can observe a non-empty queue with the degraded threshold of 1. Remove the test and its private helpers; the degraded/normal transitions remain covered deterministically by testStateMachineStatusAnalyzer. The investigation also uncovered a real bug in the test helper shared by the whole class: applyConfigurationChange() was invoked with a bare Mockito mock whose getNumUpdateReplayThreads() returns 0 (Mockito's default for Integer, instead of null), silently killing the shared replay thread pool of MultimasterReplication - a regression from the refactoring that replaced MultimasterReplicationFakeConf with a mock. Stub the mock so that the default pool is used, and harden getNumberOfReplayThreadsOrDefault() to fall back to the default for non-positive values, since a zero would silently disable replication replay.
| @@ -1,3 +1,4 @@ | |||
| /* | |||
Contributor
There was a problem hiding this comment.
I think this line should be removed
Suggested change
| /* |
maximthomas
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
StateMachineTest.testStateMachineFull— a walk through all replication state machine transitions (NC→D→N→NC→N→D→NC→D→N→BG→NC→N→D→BG→FU→...) — has been disabled since the ForgeRock era. A deep attempt to revive it (part of theslowgroup audit) showed it cannot work in its historical form:checkDSDegradedStatussamples the RS-side queue every 5 seconds against a threshold of 1). On modern hardware the publisher and the replay run at comparable rates, so every degraded transition is a race: bounded change batches get replayed before the analyzer samples a non-empty queue, and unbounded floods exhaust the 512m test JVM heap with real backend entries first (reproduced consistently).The test and its private helpers (
resetGenId,BrokerInitializer) are removed with an explanatory note in the class; the degraded/normal transitions remain covered deterministically bytestStateMachineStatusAnalyzer.Real bug found and fixed along the way
The class helper invoked
applyConfigurationChange()with a bare Mockito mock.mock(ReplicationSynchronizationProviderCfg.class).getNumUpdateReplayThreads()returns 0 (Mockito's default forInteger, notnull), so the null-check ingetNumberOfReplayThreadsOrDefault()never fired and the call silently killed the shared replay thread pool ofMultimasterReplicationfor every test in the class — a regression from the refactoring that replacedMultimasterReplicationFakeConfwith a bare mock (thread dumps showed zeroReplica replay threads; the DS listener queued updates nobody replayed, window acknowledgements never went out and the RS writer froze onacquirePermitInSendWindow).getNumberOfReplayThreadsOrDefault()falls back to the default for non-positive values — the configuration schema enforces a minimum of 1, so a zero can only come from a broken caller and would silently disable replication replay.Verification
StateMachineTest: 2 consecutive runs, 5/5 green (~125s) —testStateMachineStatusAnalyzernow exercises a live replay pool for the first time.