diff --git a/persistit/core/src/test/java/com/persistit/TreeTransactionalLifetimeTest.java b/persistit/core/src/test/java/com/persistit/TreeTransactionalLifetimeTest.java index 2f9109dbc..55e3a49c2 100644 --- a/persistit/core/src/test/java/com/persistit/TreeTransactionalLifetimeTest.java +++ b/persistit/core/src/test/java/com/persistit/TreeTransactionalLifetimeTest.java @@ -1,6 +1,8 @@ /** * Copyright 2013 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 @@ -235,6 +237,21 @@ private void createRemoveByStepHelper(final String treeName, final boolean primo if (crash || restart) { _persistit = new Persistit(_config); _persistit.initialize(); + /* + * Recovery itself completes synchronously inside initialize(), but + * two maintenance tasks are asynchronous after it: the + * TransactionIndex's active-transaction-cache updater thread and + * the CleanupManager's timer-driven pruneTimelyResources(). If the + * next helper iteration starts a transaction before those settle, + * residual tree-version state from this iteration's crash/restart + * can leak into its step-based MVCC visibility -- e.g. a tree + * created at step 1 shows up at step 0 -- producing an intermittent + * ComparisonFailure ("expected:<0[]...> but was:<0[:]...>") seen on + * CI. Force both here, the same way the sibling tests quiesce MVCC + * state before asserting. + */ + _persistit.getTransactionIndex().updateActiveTransactionCache(); + _persistit.pruneTimelyResources(); } assertEquals("Expected contents at steps", expected2, computeCreateRemoveState(treeName, 1)); }