blob: af77f1191c969755d5cfb65df75393034f6c0bfd (
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
|
/**
* Test that WT log compressor settings can be changed between clean shutdowns.
*
* @tags: [requires_wiredtiger, requires_replication, requires_persistence]
*/
(function() {
'use strict';
const initOpt = {
wiredTigerEngineConfigString: 'log=(compressor=snappy)'
};
const replSetTest = new ReplSetTest({nodes: 2, nodeOptions: initOpt});
replSetTest.startSet();
replSetTest.initiate();
// Perform a write larger than 128 bytes so to ensure there is a compressed journal entry. Not
// really necessary as the oplog is filled with system entries just by starting up the replset, but
// in case somethings changes in the future. 10kb value used in case this threshold is modified.
const testDB = replSetTest.getPrimary().getDB('test');
testDB.coll.insert({a: 'a'.repeat(10 * 1024)});
const restartNodeWithOpts = function(node, opts) {
// Mongod clean shutdown by SIGINT.
replSetTest.stop(node, 2, {allowedExitCode: MongoRunner.EXIT_CLEAN});
replSetTest.start(node, opts);
};
const optChangeJournal = {
noCleanData: true, // Keep dbpath data from previous start.
wiredTigerEngineConfigString: 'log=(compressor=zstd)'
};
// Restart nodes in a rolling fashion, none should crash due to decompression errors.
for (const node of replSetTest.getSecondaries()) {
restartNodeWithOpts(node, optChangeJournal);
}
restartNodeWithOpts(replSetTest.getPrimary(), optChangeJournal);
replSetTest.stopSet();
})();
|