blob: 27142a71c5f7901f63d5a4f7c48d3bcad0c73bf3 (
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
|
/**
* Tests that out-of-order keys are detected by validation during both the collection and index scan
* phases.
*/
(function() {
"use strict";
const rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();
let primary = rst.getPrimary();
let coll = primary.getCollection('test.out_of_order');
assert.commandWorked(coll.createIndex({x: 1}));
for (let i = 0; i < 5; i++) {
assert.commandWorked(coll.insert({x: i}));
}
// Test record store out-of-order detection.
assert.commandWorked(
primary.adminCommand({configureFailPoint: "WTRecordStoreUassertOutOfOrder", mode: "alwaysOn"}));
let res = assert.commandWorked(coll.validate());
assert(!res.valid);
assert.commandWorked(
primary.adminCommand({configureFailPoint: "WTRecordStoreUassertOutOfOrder", mode: "off"}));
// Test index entry out-of-order detection.
assert.commandWorked(
primary.adminCommand({configureFailPoint: "failIndexKeyOrdering", mode: "alwaysOn"}));
res = assert.commandWorked(coll.validate());
assert(!res.valid);
assert.commandWorked(
primary.adminCommand({configureFailPoint: "failIndexKeyOrdering", mode: "off"}));
rst.stopSet();
})();
|