blob: f5bf02d0886ef384aee3d577465d80571daa7957 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/**
* Ensures that if the config servers are blackholed from the point of view of MongoS, metadata
* operations do not get stuck forever.
*
* Checking UUID and index consistency involves talking to config servers through mongos, but mongos
* is blackholed from the config servers in this test.
*/
TestData.skipCheckingUUIDsConsistentAcrossCluster = true;
TestData.skipCheckingIndexesConsistentAcrossCluster = true;
TestData.skipCheckOrphans = true;
TestData.skipCheckRoutingTableConsistency = true;
TestData.skipCheckShardFilteringMetadata = true;
(function() {
'use strict';
var st = new ShardingTest({
shards: 2,
mongos: 1,
useBridge: true,
bridgeOptions: {verbose: 'vvv'},
});
var testDB = st.s.getDB('BlackHoleDB');
assert.commandWorked(testDB.adminCommand({enableSharding: 'BlackHoleDB'}));
assert.commandWorked(
testDB.adminCommand({shardCollection: testDB.ShardedColl.getFullName(), key: {_id: 1}}));
assert.commandWorked(testDB.ShardedColl.insert({a: 1}));
jsTest.log('Making all the config servers appear as a blackhole to mongos');
st.forEachConfigServer((configSvr) => {
configSvr.discardMessagesFrom(st.s, 1.0);
});
assert.commandWorked(testDB.adminCommand({flushRouterConfig: 1}));
// This shouldn't stall
jsTest.log('Doing read operation on the sharded collection');
assert.throws(function() {
testDB.ShardedColl.find({}).maxTimeMS(15000).itcount();
});
// This should fail, because the primary is not available
jsTest.log('Doing write operation on a new database and collection');
assert.writeError(
st.s.getDB('NonExistentDB')
.TestColl.insert({_id: 0, value: 'This value will never be inserted'}, {maxTimeMS: 15000}));
st.stop();
}());
|