mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-46961 Test sync source in quiesce mode
This commit is contained in:
parent
f85e94d5ad
commit
43e969a4b5
52
jstests/replsets/sync_source_enters_quiesce_mode.js
Normal file
52
jstests/replsets/sync_source_enters_quiesce_mode.js
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Tests that reading from an existing sync source continues uninterrupted when the sync source
|
||||
* enters quiesce mode.
|
||||
*
|
||||
* @tags: [requires_fcv_46]
|
||||
*/
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
load("jstests/libs/fail_point_util.js");
|
||||
|
||||
// Set the oplog fetcher batch size to 1, in order to test fetching multiple batches while the sync
|
||||
// source is in quiesce mode.
|
||||
const rst = new ReplSetTest(
|
||||
{nodes: 3, useBridge: true, nodeOptions: {setParameter: "bgSyncOplogFetcherBatchSize=1"}});
|
||||
rst.startSet();
|
||||
rst.initiateWithHighElectionTimeout();
|
||||
|
||||
const primary = rst.getPrimary();
|
||||
assert.eq(primary, rst.nodes[0]);
|
||||
|
||||
const syncSource = rst.nodes[1];
|
||||
const syncingNode = rst.nodes[2];
|
||||
|
||||
jsTestLog("Ensure syncingNode is syncing from syncSource.");
|
||||
syncingNode.disconnect(primary);
|
||||
assert.commandWorked(primary.getDB("test").c.insert({a: 1}, {writeConcern: {w: 3}}));
|
||||
|
||||
jsTestLog("Ensure syncingNode is behind syncSource.");
|
||||
// Do not use stopServerReplication(), since this can cause the node to change sync source.
|
||||
let hangOplogQueryFailPoint =
|
||||
configureFailPoint(syncSource, "planExecutorHangBeforeShouldWaitForInserts");
|
||||
hangOplogQueryFailPoint.wait();
|
||||
assert.commandWorked(primary.getDB("test").c.insert([{a: 2}, {a: 3}, {a: 4}]),
|
||||
{writeConcern: {w: 2}});
|
||||
|
||||
jsTestLog("Transition syncSource to quiesce mode.");
|
||||
let quiesceModeFailPoint = configureFailPoint(syncSource, "hangDuringQuiesceMode");
|
||||
// We must skip validation due to the failpoint that hangs awaitData queries.
|
||||
rst.stop(syncSource, null /*signal*/, {skipValidation: true}, {forRestart: true, waitpid: false});
|
||||
quiesceModeFailPoint.wait();
|
||||
|
||||
jsTestLog("Check that syncing continues uninterrupted.");
|
||||
hangOplogQueryFailPoint.off();
|
||||
rst.awaitReplication();
|
||||
|
||||
jsTestLog("Finish test.");
|
||||
syncingNode.reconnect(primary);
|
||||
quiesceModeFailPoint.off();
|
||||
rst.restart(syncSource);
|
||||
rst.stopSet();
|
||||
})();
|
Loading…
Reference in New Issue
Block a user