2020-01-31 21:46:35 +00:00
|
|
|
/**
|
|
|
|
|
* Ensure that we properly trigger a stable checkpoint when starting up a replica set node.
|
|
|
|
|
*
|
2020-07-14 20:50:12 +00:00
|
|
|
* We don't support unclean shutdowns with restarts into a last-lts binary.
|
2020-03-02 11:33:02 -05:00
|
|
|
* @tags: [requires_persistence, multiversion_incompatible]
|
2020-01-31 21:46:35 +00:00
|
|
|
*/
|
2024-08-20 17:54:15 -04:00
|
|
|
import {ReplSetTest} from "jstests/libs/replsettest.js";
|
|
|
|
|
|
2025-04-17 15:50:07 -04:00
|
|
|
clearRawMongoProgramOutput();
|
2020-01-31 21:46:35 +00:00
|
|
|
const rst = new ReplSetTest({
|
|
|
|
|
nodes: 1,
|
|
|
|
|
nodeOptions: {
|
2020-05-28 20:10:48 -04:00
|
|
|
// Disable background checkpoints: a zero value disables checkpointing.
|
|
|
|
|
syncdelay: 0,
|
2025-08-21 10:17:44 -07:00
|
|
|
setParameter: {logComponentVerbosity: tojson({storage: 2})},
|
|
|
|
|
},
|
2020-01-31 21:46:35 +00:00
|
|
|
});
|
|
|
|
|
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();
|
2025-04-17 15:50:07 -04:00
|
|
|
const subStr = "Triggering the first stable checkpoint";
|
2025-08-21 10:17:44 -07:00
|
|
|
assert.soon(() => rawMongoProgramOutput(subStr).search(subStr) >= 0);
|
2020-01-31 21:46:35 +00:00
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
2025-04-17 15:50:07 -04:00
|
|
|
rst.stopSet();
|