0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00
mongodb/jstests/replsets/initial_sync_read_concern_no_oplog.js
William Schultz eb08c1db38 SERVER-45087 Check oplog commitment condition on replica set reconfig
create mode 100644 jstests/replsets/reconfig_waits_for_oplog_commitment_condition.js
 create mode 100644 jstests/replsets/reconfig_waits_for_oplog_commitment_condition_when_leaving_force.js
2020-02-26 04:37:04 +00:00

31 lines
852 B
JavaScript

// Test that if an afterClusterTime query is issued to a node in initial sync that has not yet
// created its oplog, the node returns an error rather than crashing.
(function() {
'use strict';
load("jstests/libs/fail_point_util.js");
const replSet = new ReplSetTest({nodes: 1});
replSet.startSet();
replSet.initiate();
const primary = replSet.getPrimary();
const secondary = replSet.add({rsConfig: {votes: 0, priority: 0}});
const failPoint = configureFailPoint(secondary, 'initialSyncHangBeforeCreatingOplog');
replSet.reInitiate();
failPoint.wait();
assert.commandFailedWithCode(
secondary.getDB('local').runCommand(
{find: 'coll', limit: 1, readConcern: {afterClusterTime: Timestamp(1, 1)}}),
ErrorCodes.NotYetInitialized);
failPoint.off();
replSet.awaitReplication();
replSet.awaitSecondaryNodes();
replSet.stopSet();
})();