Stabilize flaky JournalManagerTest.missingVolumePageHandling#261
Open
vharseko wants to merge 1 commit into
Open
Stabilize flaky JournalManagerTest.missingVolumePageHandling#261vharseko wants to merge 1 commit into
vharseko wants to merge 1 commit into
Conversation
The missing-volume alert asserted after startup is posted by
JournalManager.writeForCopy when the journal copier copies a page back to a
now-deleted volume. For the non-transactional pages this test writes, that copy
runs on the background JOURNAL_COPIER thread, so the assertion immediately after
new Persistit(_config) races it: on a slow/loaded runner no alert has been
posted yet and getHistory(MISSING_VOLUME_CATEGORY) returns null ("Startup with
missing volumes should have generated alerts", seen on macos-latest JDK 26).
Force the copy-back with copyBackPages() before the assertion so the alert is
generated deterministically. ignoreMissingVolumes is still false at that point,
so the missing-volume pages are retained and the later
ignoreMissingVolumes-behavior check is unaffected.
maximthomas
approved these changes
Jul 10, 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 free
to 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.
Problem
JournalManagerTest.missingVolumePageHandlingis flaky. It creates two volumes, writes non-transactional data, closes, deletes the volume files, restarts, and immediately asserts that startup generated missing-volume alerts:The
MISSING_VOLUMEalert is posted byJournalManager.writeForCopywhen the journal copier copies a page back to a now-deleted volume (VolumeNotFoundException). For the non-transactional pages this test writes, that copy-back is not part of the synchronous recovery ininitialize()— it runs on the backgroundJOURNAL_COPIERthread. So the assertion immediately afternew Persistit(_config)races the copier: on a slow/loaded runner no alert has been posted yet andgetHistory(...)returnsnull:Observed on
build-maven (macos-latest, 26); passes on the other 9 build jobs in the same run. (The siblingmissingVolumeTransactionHandling*tests are not affected — their alert comes from synchronous transaction replay during recovery, not the background copier.)Fix
Force the copy-back with
copyBackPages()before the assertion, so the alert is generated deterministically instead of relying on the background copier having already run.ignoreMissingVolumesis stillfalseat that point, sowriteForCopyretains the missing-volume pages (it only drops them once ignore is set); the laterignoreMissingVolumes-behavior check (alertCount1 == alertCount2) is therefore unaffected.Not caused by this PR's parent change
Unrelated to the PR it was blocking (#236, remove useless null checks): its only persistit change is in
Persistit.crash()(dropping proven-non-null checks), not the startup/alert path.Verification
missingVolumePageHandling6/6 green (including theignoreMissingVolumescount check, confirming the pages are retained).JournalManagerTestclass: 13/13.