diff options
author | Randolph Tan <randolph@10gen.com> | 2015-12-23 11:02:30 -0500 |
---|---|---|
committer | Randolph Tan <randolph@10gen.com> | 2016-01-06 16:55:48 -0500 |
commit | 75f38ab0e95f5702c01945aacef81609d55df277 (patch) | |
tree | a7d7aa09ee2754b3d808e9da79b553cb16136287 | |
parent | 52b55a45f29829d868695ffec0ce4b07c3b24438 (diff) | |
download | mongo-75f38ab0e95f5702c01945aacef81609d55df277.tar.gz |
SERVER-21758 Test behavior when 'nearest' config server has severe replication lag
-rw-r--r-- | jstests/sharding/replset_config/lagged_config_secondary.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/jstests/sharding/replset_config/lagged_config_secondary.js b/jstests/sharding/replset_config/lagged_config_secondary.js new file mode 100644 index 00000000000..82e9f44bdc5 --- /dev/null +++ b/jstests/sharding/replset_config/lagged_config_secondary.js @@ -0,0 +1,35 @@ +/** + * Test that mongos times out when the config server replica set only contains nodes that + * are behind the majority opTime. + */ +(function(){ +var st = new ShardingTest({ shards: 1 }); + +var configSecondaryList = st.configRS.getSecondaries(); +var configSecondaryToKill = configSecondaryList[0]; +var delayedConfigSecondary = configSecondaryList[1]; + +delayedConfigSecondary.getDB('admin').adminCommand({ configureFailPoint: 'rsSyncApplyStop', + mode: 'alwaysOn' }); + +var testDB = st.s.getDB('test'); +testDB.adminCommand({ enableSharding: 'test' }); +testDB.adminCommand({ shardCollection: 'test.user', key: { _id: 1 }}); + +testDB.user.insert({ _id: 1 }); + +st.configRS.stopMaster(); +MongoRunner.stopMongod(configSecondaryToKill.port); + +// Clears all cached info so mongos will be forced to query from the config. +st.s.adminCommand({ flushRouterConfig: 1 }); + +var exception = assert.throws(function() { + testDB.user.findOne(); +}); + +assert.eq(ErrorCodes.ExceededTimeLimit, exception.code); + +st.stop(); + +}()); |