blob: 7e73ab6de4f56fd9b0e33e51a5a115cd971040f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
/*
* This test makes sure the 'validate' command fails correctly during rollback.
*/
(function() {
"use strict";
load("jstests/replsets/libs/rollback_test.js");
const dbName = "test";
const collName = "coll";
// Set up Rollback Test.
let rollbackTest = new RollbackTest();
let rollbackNode = rollbackTest.transitionToRollbackOperations();
assert.commandWorked(rollbackNode.adminCommand(
{configureFailPoint: "rollbackHangAfterTransitionToRollback", mode: "alwaysOn"}));
// Start rollback.
rollbackTest.transitionToSyncSourceOperationsBeforeRollback();
rollbackTest.transitionToSyncSourceOperationsDuringRollback();
// Wait for rollback to hang.
checkLog.contains(rollbackNode, "rollbackHangAfterTransitionToRollback fail point enabled.");
// Try to run the validate command on the rollback node. This should fail with a
// NotPrimaryOrSecondary error.
assert.commandFailedWithCode(rollbackNode.getDB(dbName).runCommand({"validate": collName}),
ErrorCodes.NotPrimaryOrSecondary);
assert.commandWorked(rollbackNode.adminCommand(
{configureFailPoint: "rollbackHangAfterTransitionToRollback", mode: "off"}));
rollbackTest.transitionToSteadyStateOperations();
// Check the replica set.
rollbackTest.stop();
}());
|