blob: 3ede60b4aa34a8e0fd148651f4b821ec5018bb16 (
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
|
(function() {
'use strict';
var runTest = function(compressor) {
var mongo = MongoRunner.runMongod({networkMessageCompressors: compressor});
let shell = startParallelShell(function() {
var collName = 'exhaustCollection';
var fp = 'beforeCompressingExhaustResponse';
db[collName].drop();
const kDocumentCount = 10;
for (var i = 0; i < kDocumentCount; i++) {
assert.commandWorked(db.runCommand({insert: collName, documents: [{a: i}]}));
}
const preRes =
assert.commandWorked(db.adminCommand({configureFailPoint: fp, mode: "alwaysOn"}));
db.exhaustCollection.find({}).batchSize(2).addOption(DBQuery.Option.exhaust).toArray();
const postRes =
assert.commandWorked(db.adminCommand({configureFailPoint: fp, mode: "off"}));
assert.eq(preRes.count + 1, postRes.count, "Exhaust messages are not compressed");
}, mongo.port, false, "--networkMessageCompressors", compressor);
shell();
MongoRunner.stopMongod(mongo);
};
runTest("snappy");
}());
|