summaryrefslogtreecommitdiff
path: root/jstests/sharding/lagged_config_secondary.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/lagged_config_secondary.js')
-rw-r--r--jstests/sharding/lagged_config_secondary.js92
1 files changed, 46 insertions, 46 deletions
diff --git a/jstests/sharding/lagged_config_secondary.js b/jstests/sharding/lagged_config_secondary.js
index df23946dee4..35e38722edb 100644
--- a/jstests/sharding/lagged_config_secondary.js
+++ b/jstests/sharding/lagged_config_secondary.js
@@ -8,64 +8,64 @@
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
(function() {
- var st = new ShardingTest(
- {shards: 1, configReplSetTestOptions: {settings: {chainingAllowed: false}}});
- var testDB = st.s.getDB('test');
+var st =
+ new ShardingTest({shards: 1, configReplSetTestOptions: {settings: {chainingAllowed: false}}});
+var testDB = st.s.getDB('test');
- assert.commandWorked(testDB.adminCommand({enableSharding: 'test'}));
- assert.commandWorked(testDB.adminCommand({shardCollection: 'test.user', key: {_id: 1}}));
+assert.commandWorked(testDB.adminCommand({enableSharding: 'test'}));
+assert.commandWorked(testDB.adminCommand({shardCollection: 'test.user', key: {_id: 1}}));
- // Ensures that all metadata writes thus far have been replicated to all nodes
- st.configRS.awaitReplication();
+// Ensures that all metadata writes thus far have been replicated to all nodes
+st.configRS.awaitReplication();
- var configSecondaryList = st.configRS.getSecondaries();
- var configSecondaryToKill = configSecondaryList[0];
- var delayedConfigSecondary = configSecondaryList[1];
+var configSecondaryList = st.configRS.getSecondaries();
+var configSecondaryToKill = configSecondaryList[0];
+var delayedConfigSecondary = configSecondaryList[1];
- assert.writeOK(testDB.user.insert({_id: 1}));
+assert.writeOK(testDB.user.insert({_id: 1}));
- delayedConfigSecondary.getDB('admin').adminCommand(
- {configureFailPoint: 'rsSyncApplyStop', mode: 'alwaysOn'});
+delayedConfigSecondary.getDB('admin').adminCommand(
+ {configureFailPoint: 'rsSyncApplyStop', mode: 'alwaysOn'});
- // Do one metadata write in order to bump the optime on mongos
- assert.writeOK(st.getDB('config').TestConfigColl.insert({TestKey: 'Test value'}));
+// Do one metadata write in order to bump the optime on mongos
+assert.writeOK(st.getDB('config').TestConfigColl.insert({TestKey: 'Test value'}));
- st.configRS.stopMaster();
- MongoRunner.stopMongod(configSecondaryToKill);
+st.configRS.stopMaster();
+MongoRunner.stopMongod(configSecondaryToKill);
- // Clears all cached info so mongos will be forced to query from the config.
- st.s.adminCommand({flushRouterConfig: 1});
+// Clears all cached info so mongos will be forced to query from the config.
+st.s.adminCommand({flushRouterConfig: 1});
- print('Attempting read on a sharded collection...');
- var exception = assert.throws(function() {
- testDB.user.find({}).maxTimeMS(15000).itcount();
- });
+print('Attempting read on a sharded collection...');
+var exception = assert.throws(function() {
+ testDB.user.find({}).maxTimeMS(15000).itcount();
+});
- assert(ErrorCodes.isExceededTimeLimitError(exception.code));
+assert(ErrorCodes.isExceededTimeLimitError(exception.code));
- let msgAA = 'command config.$cmd command: find { find: "databases"';
- let msgAB = 'errCode:' + ErrorCodes.ClientDisconnect;
- let msgB = 'Command on database config timed out waiting for read concern to be satisfied.';
- assert.soon(
- function() {
- var logMessages =
- assert.commandWorked(delayedConfigSecondary.adminCommand({getLog: 'global'})).log;
- for (var i = 0; i < logMessages.length; i++) {
- if ((logMessages[i].indexOf(msgAA) != -1 && logMessages[i].indexOf(msgAB) != -1) ||
- logMessages[i].indexOf(msgB) != -1) {
- return true;
- }
+let msgAA = 'command config.$cmd command: find { find: "databases"';
+let msgAB = 'errCode:' + ErrorCodes.ClientDisconnect;
+let msgB = 'Command on database config timed out waiting for read concern to be satisfied.';
+assert.soon(
+ function() {
+ var logMessages =
+ assert.commandWorked(delayedConfigSecondary.adminCommand({getLog: 'global'})).log;
+ for (var i = 0; i < logMessages.length; i++) {
+ if ((logMessages[i].indexOf(msgAA) != -1 && logMessages[i].indexOf(msgAB) != -1) ||
+ logMessages[i].indexOf(msgB) != -1) {
+ return true;
}
- return false;
- },
- 'Did not see any log entries containing the following message: ' + msgAA + ' ... ' + msgAB +
- ' or ' + msgB,
- 60000,
- 300);
+ }
+ return false;
+ },
+ 'Did not see any log entries containing the following message: ' + msgAA + ' ... ' + msgAB +
+ ' or ' + msgB,
+ 60000,
+ 300);
- // Can't do clean shutdown with this failpoint on.
- delayedConfigSecondary.getDB('admin').adminCommand(
- {configureFailPoint: 'rsSyncApplyStop', mode: 'off'});
+// Can't do clean shutdown with this failpoint on.
+delayedConfigSecondary.getDB('admin').adminCommand(
+ {configureFailPoint: 'rsSyncApplyStop', mode: 'off'});
- st.stop();
+st.stop();
}());