SERVER-118535 Deflake step_down_during_draining*.js tests (#47295)

GitOrigin-RevId: 5396fd686f1d1d242c53bf155b0971488e4015e4
This commit is contained in:
Pierre Turin 2026-01-30 11:09:41 -08:00 committed by MongoDB Bot
parent 1c7fae5d61
commit 7dacce4db6
5 changed files with 4 additions and 47 deletions

View File

@ -63,16 +63,7 @@ primaryAdminDB.adminCommand({
logComponentVerbosity: {command: {verbosity: 3}},
});
let primaryOplogWriterFP = configureFailPoint(primary, "rsSyncApplyStop");
try {
primaryOplogWriterFP.wait();
// Ensure Oplog Applier is stopped on the FP.
assert.soon(
() => rawMongoProgramOutput("21229.*Oplog Applier - rsSyncApplyStop fail point enabled."),
"mongod did not log that OplogApplier stopped at FP",
10 * 1000, // 10sec
);
{
const currentOpResults = primaryAdminDB.currentOp({"$all": true});
const oplogWriterOp = currentOpResults.inprog.filter(function (op) {
@ -80,22 +71,7 @@ try {
});
assert.gte(oplogWriterOp.length, 1, "Did not find any NoopWriter operation: " + tojson(currentOpResults));
const oplogApplierOp = currentOpResults.inprog.filter(function (op) {
return op.desc && op.desc == "OplogApplier-0";
});
assert.gte(oplogApplierOp.length, 1, "Did not find any OplogApplier operation: " + tojson(currentOpResults));
assert.commandWorked(primaryAdminDB.killOp(oplogWriterOp[0].opid));
assert.commandWorked(primaryAdminDB.killOp(oplogApplierOp[0].opid));
assert.soon(
() => rawMongoProgramOutput("11227300.*Not killing exempt op").match('.*"opId":' + oplogApplierOp[0].opid),
"mongod did not log that it ignored killOp attempt on OplogApplier with opId=" + oplogApplierOp[0].opid,
10 * 1000, // 10sec
);
} finally {
// Ensure the failpoint is turned off so the server cannot hang on shutdown.
primaryOplogWriterFP.off();
}
// Make sure both nodes are still alive
@ -115,18 +91,13 @@ secondaryAdminDB.adminCommand({
let secondaryOplogWriterFP = configureFailPoint(secondary, "rsSyncApplyStop");
try {
// Ensure Oplog Writer is stopped on the FP.
secondaryOplogWriterFP.wait();
// Ensure Oplog Writer and Applier are stopped on the FP.
assert.soon(
() => rawMongoProgramOutput("8543102.*Oplog Writer - rsSyncApplyStop fail point enabled."),
"mongod did not log that OplogWriter stopped at FP",
10 * 1000, // 10sec
);
assert.soon(
() => rawMongoProgramOutput("21229.*Oplog Applier - rsSyncApplyStop fail point enabled."),
"mongod did not log that OplogApplier stopped at FP",
10 * 1000, // 10sec
);
doInserts();
@ -137,24 +108,13 @@ try {
});
assert.gte(oplogWriterOp.length, 1, "Did not find any OplogWriter operation: " + tojson(currentOpResults));
const oplogApplierOp = currentOpResults.inprog.filter(function (op) {
return op.desc && op.desc == "OplogApplier-0";
});
assert.gte(oplogApplierOp.length, 1, "Did not find any OplogApplier operation: " + tojson(currentOpResults));
assert.commandWorked(secondaryAdminDB.killOp(oplogWriterOp[0].opid));
assert.commandWorked(secondaryAdminDB.killOp(oplogApplierOp[0].opid));
assert.soon(
() => rawMongoProgramOutput("11227300.*Not killing exempt op").match('.*"opId":' + oplogWriterOp[0].opid),
"mongod did not log that it ignored killOp attempt on OplogWriter with opId=" + oplogWriterOp[0].opid,
10 * 1000, // 10sec
);
assert.soon(
() => rawMongoProgramOutput("11227300.*Not killing exempt op").match('.*"opId":' + oplogApplierOp[0].opid),
"mongod did not log that it ignored killOp attempt on OplogApplier with opId=" + oplogApplierOp[0].opid,
10 * 1000, // 10sec
);
} finally {
// Ensure the failpoint is turned off so the server cannot hang on shutdown.
secondaryOplogWriterFP.off();

View File

@ -14,7 +14,6 @@ import {ReplSetTest} from "jstests/libs/replsettest.js";
import {reconnect} from "jstests/replsets/rslib.js";
let replSet = new ReplSetTest({name: "testSet", nodes: 3});
let nodes = replSet.nodeList();
replSet.startSet();
let conf = replSet.getReplSetConfig();
conf.members[2].priority = 0;

View File

@ -16,7 +16,6 @@ import {ReplSetTest} from "jstests/libs/replsettest.js";
import {reconnect} from "jstests/replsets/rslib.js";
let replSet = new ReplSetTest({name: "testSet", nodes: 3});
let nodes = replSet.nodeList();
replSet.startSet();
let conf = replSet.getReplSetConfig();
conf.members[2].priority = 0;

View File

@ -5,7 +5,6 @@ import {ReplSetTest} from "jstests/libs/replsettest.js";
import {reconnect} from "jstests/replsets/rslib.js";
let replSet = new ReplSetTest({name: "testSet", nodes: 3});
let nodes = replSet.nodeList();
replSet.startSet();
let conf = replSet.getReplSetConfig();
conf.members[2].priority = 0;

View File

@ -529,7 +529,7 @@ void OplogApplierImpl::_run(OplogBuffer* oplogBuffer) {
&opCtx, AdmissionContext::Priority::kExempt);
// For pausing replication in tests.
if (MONGO_unlikely(rsSyncApplyStop.shouldFail())) {
if (MONGO_unlikely(!useOplogWriter && rsSyncApplyStop.shouldFail())) {
LOGV2(21229,
"Oplog Applier - rsSyncApplyStop fail point enabled. Blocking until fail "
"point is disabled");
@ -544,7 +544,7 @@ void OplogApplierImpl::_run(OplogBuffer* oplogBuffer) {
// Shut down and exit oplog application loop.
return;
}
if (MONGO_unlikely(rsSyncApplyStop.shouldFail())) {
if (MONGO_unlikely(!useOplogWriter && rsSyncApplyStop.shouldFail())) {
continue;
}
if (ops.termWhenExhausted()) {