Files
mongo/jstests/replsets/trigger_initial_stable_checkpoint.js
huayu-ouyang 5c847c0485 SERVER-103982 Fix trigger_initial_stable_checkpoint.js for slow machines (#35181)
GitOrigin-RevId: 84251a393c53b1690637d6bd7168dae431e620c6
2025-04-17 20:22:19 +00:00

36 lines
1.2 KiB
JavaScript

/**
* Ensure that we properly trigger a stable checkpoint when starting up a replica set node.
*
* We don't support unclean shutdowns with restarts into a last-lts binary.
* @tags: [requires_persistence, multiversion_incompatible]
*/
import {ReplSetTest} from "jstests/libs/replsettest.js";
clearRawMongoProgramOutput();
const rst = new ReplSetTest({
nodes: 1,
nodeOptions: {
// Disable background checkpoints: a zero value disables checkpointing.
syncdelay: 0,
setParameter: {logComponentVerbosity: tojson({storage: 2})}
}
});
rst.startSet();
rst.initiate();
// By the time a node is primary it should have triggered a stable checkpoint. We subsequently kill
// and restart the node to check that the initial collections it created are durable in its
// checkpoint.
let primary = rst.getPrimary();
const subStr = "Triggering the first stable checkpoint";
assert.soon(() => (rawMongoProgramOutput(subStr).search(subStr) >= 0));
jsTestLog("Kill and restart the node.");
rst.stop(0, 9, {allowedExitCode: MongoRunner.EXIT_SIGKILL}, {forRestart: true});
rst.start(0, undefined, true /* restart */);
jsTestLog("Waiting for the node to restart and become primary again.");
rst.getPrimary();
rst.stopSet();