blob: 020b09015623773be41dd177f2a3f2429cc7facc (
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
|
/**
* Ensures that a createIndexes command request fails when the available disk space is below the
* indexBuildMinAvailableDiskSpaceMB threshold.
* @tags: [
* requires_fcv_71,
* requires_replication,
* ]
*/
(function() {
"use strict";
load('jstests/libs/fail_point_util.js');
const rst = new ReplSetTest({nodes: 1});
rst.startSet();
rst.initiate();
const primary = rst.getPrimary();
const primaryDB = primary.getDB('test');
const primaryColl = primaryDB.getCollection('test');
const simulateDiskSpaceFp =
configureFailPoint(primaryDB, 'simulateAvailableDiskSpace', {bytes: 450 * 1024 * 1024});
// Empty collections do not start index builds, and should succeed.
assert.commandWorked(primaryColl.createIndex({b: 1}));
// Populate collection.
assert.commandWorked(primaryColl.insert({a: 1}));
// Index build should fail to start.
assert.commandFailedWithCode(primaryColl.createIndex({a: 1}), [ErrorCodes.OutOfDiskSpace]);
rst.stopSet();
})();
|