From 916880ab31cb31745dce3ec9a2792eaeb302efb6 Mon Sep 17 00:00:00 2001 From: Valera V Harseko Date: Fri, 10 Jul 2026 09:57:39 +0300 Subject: [PATCH] Stabilize flaky JournalManagerTest.missingVolumePageHandling 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. --- .../java/com/persistit/JournalManagerTest.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/persistit/core/src/test/java/com/persistit/JournalManagerTest.java b/persistit/core/src/test/java/com/persistit/JournalManagerTest.java index 359520ec2..0350e9578 100644 --- a/persistit/core/src/test/java/com/persistit/JournalManagerTest.java +++ b/persistit/core/src/test/java/com/persistit/JournalManagerTest.java @@ -1,6 +1,8 @@ /** * Copyright 2011-2012 Akiban Technologies, Inc. - * + * + * Portions Copyrighted 2026 3A Systems, LLC. + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -477,6 +479,18 @@ public void missingVolumePageHandling() throws Exception { volume1 = null; volume2 = null; _persistit = new Persistit(_config); + /* + * The missing-volume alert is posted by JournalManager.writeForCopy when + * the journal copier tries to copy a page back to a now-deleted volume. + * For these non-transactional pages that copy runs on the background + * JOURNAL_COPIER thread, so asserting immediately after startup races it: + * on a slow/loaded runner no alert has been posted yet and getHistory() + * returns null (intermittent CI failure). Force the copy-back so the + * alert is generated deterministically. ignoreMissingVolumes is still + * false here, so the pages are retained for the ignore-behavior check + * below. + */ + _persistit.copyBackPages(); final AlertMonitor am = _persistit.getAlertMonitor(); assertTrue("Startup with missing volumes should have generated alerts", am.getHistory(AlertMonitor.MISSING_VOLUME_CATEGORY) != null);