summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-11-28 21:41:30 -0500
committerBenety Goh <benety@mongodb.com>2018-11-28 21:41:55 -0500
commit03e13f90426a82a97cbb0f926385e09904519259 (patch)
treefea2c3374f1bf70527b8bd82e6f32b60621b6910 /jstests
parenta20abe09f605a8d6d57611a241f1d38952933748 (diff)
downloadmongo-03e13f90426a82a97cbb0f926385e09904519259.tar.gz
SERVER-37729 IndexBuilder updates CurOp using createIndexes format
Diffstat (limited to 'jstests')
-rw-r--r--jstests/multiVersion/index_bigkeys_secondary_downgrade_during_index_build_background.js15
-rw-r--r--jstests/noPassthrough/libs/index_build.js3
-rw-r--r--jstests/noPassthroughWithMongod/indexbg_drop.js21
3 files changed, 7 insertions, 32 deletions
diff --git a/jstests/multiVersion/index_bigkeys_secondary_downgrade_during_index_build_background.js b/jstests/multiVersion/index_bigkeys_secondary_downgrade_during_index_build_background.js
index 20836332643..75d62869ad6 100644
--- a/jstests/multiVersion/index_bigkeys_secondary_downgrade_during_index_build_background.js
+++ b/jstests/multiVersion/index_bigkeys_secondary_downgrade_during_index_build_background.js
@@ -7,6 +7,7 @@
'use strict';
load("jstests/libs/feature_compatibility_version.js");
+ load('jstests/noPassthrough/libs/index_build.js');
TestData.replSetFeatureCompatibilityVersion = "4.2";
const rst = new ReplSetTest({nodes: [{binVersion: 'latest'}, {binVersion: 'latest'}]});
@@ -44,19 +45,7 @@
{createIndexes: collName, indexes: [{key: {x: 1}, name: "x_1", background: true}]}));
// Make sure index build starts on the secondary.
- assert.soon(() => {
- // The currentOp entry for createIndexes looks like:
- // {...,
- // "command": {"v": 2,
- // "key": {x: 1},
- // "name": "x_1",
- // "background": true,
- // "ns": "test.index_bigkeys_downgrade_during_index_build"},
- // ...
- // }
- let res = secondaryDB.currentOp({'command.name': "x_1"});
- return res['ok'] === 1 && res["inprog"].length > 0;
- });
+ IndexBuildTest.waitForIndexBuildToStart(secondaryDB);
// Downgrade the FCV to 4.0
assert.commandWorked(primaryDB.adminCommand({setFeatureCompatibilityVersion: "4.0"}));
diff --git a/jstests/noPassthrough/libs/index_build.js b/jstests/noPassthrough/libs/index_build.js
index 545fab3c3c6..84469317d78 100644
--- a/jstests/noPassthrough/libs/index_build.js
+++ b/jstests/noPassthrough/libs/index_build.js
@@ -21,8 +21,7 @@ class IndexBuildTest {
let indexBuildOpId = -1;
result.inprog.forEach(function(op) {
- if ((op.op == 'command' && 'createIndexes' in op.command) || // primary
- (op.op == 'none' && 'background' in op.command)) { // secondary
+ if (op.op == 'command' && 'createIndexes' in op.command) {
indexBuildOpId = op.opid;
}
});
diff --git a/jstests/noPassthroughWithMongod/indexbg_drop.js b/jstests/noPassthroughWithMongod/indexbg_drop.js
index 7281f171466..738119f578c 100644
--- a/jstests/noPassthroughWithMongod/indexbg_drop.js
+++ b/jstests/noPassthroughWithMongod/indexbg_drop.js
@@ -1,7 +1,5 @@
-// TODO: SERVER-13215 move test back to replSets suite.
-
/**
- * TODO: SERVER-13204
+ * TODO: SERVER-38301
* This tests inserts a huge number of documents, initiates a background index build
* and tries to perform another task in parallel while the background index task is
* active. The problem is that this is timing dependent and the current test setup
@@ -11,6 +9,8 @@
// Index drop race
+load('jstests/noPassthrough/libs/index_build.js');
+
var dbname = 'dropbgindex';
var collection = 'jstests_feh';
var size = 500000;
@@ -59,20 +59,7 @@ masterDB.getCollection(collection).ensureIndex({b: 1});
masterDB.getCollection(collection).ensureIndex({i: 1}, {background: true});
// make sure the index build has started on secondary
-assert.soon(function() {
- var curOp = secondDB.currentOp();
- printjson(curOp);
- for (var i = 0; i < curOp.inprog.length; i++) {
- try {
- if (curOp.inprog[i].command.background) {
- return true;
- }
- } catch (e) {
- // catchem if you can
- }
- }
- return false;
-}, "waiting for secondary bg index build", 20000, 10);
+IndexBuildTest.waitForIndexBuildToStart(secondDB);
jsTest.log("dropping index");
masterDB.runCommand({dropIndexes: collection, index: "*"});