summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2019-07-05 17:19:37 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-19 01:59:04 +0000
commit2b80ad915ef25d9d5f4044fac0156f261d7f97a4 (patch)
tree4bb8a3e87898f77ac4c04db6a833a3b6f5783382
parentad0f72c1e5c452d7869fd829736179092b7ab88f (diff)
downloadmongo-2b80ad915ef25d9d5f4044fac0156f261d7f97a4.tar.gz
SERVER-41968 IndexBuildTest.getIndexBuildOpId() accepts optional db.currentOp() filter
(cherry picked from commit 335a4e981228156ebc92e87065b817244e5084d6)
-rw-r--r--jstests/noPassthrough/libs/index_build.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/jstests/noPassthrough/libs/index_build.js b/jstests/noPassthrough/libs/index_build.js
index dc30ad1ce16..dc79503ab9c 100644
--- a/jstests/noPassthrough/libs/index_build.js
+++ b/jstests/noPassthrough/libs/index_build.js
@@ -16,6 +16,7 @@ class IndexBuildTest {
* Returns the op id for the running index build on the provided 'collectionName' and
* 'indexName', or any index build if either is undefined. Returns -1 if there is no current
* index build.
+ * Accepts optional filter that can be used to customize the db.currentOp() query.
*/
static getIndexBuildOpId(database, collectionName, indexName, filter) {
@@ -51,12 +52,16 @@ class IndexBuildTest {
/**
* Wait for index build to start and return its op id.
+ * Accepts optional filter that can be used to customize the db.currentOp() query.
+ * The filter may be necessary in situations when the index build is delegated to a thread pool
+ * managed by the IndexBuildsCoordinator and it is necessary to differentiate between the
+ * client connection thread and the IndexBuildsCoordinator thread actively building the index.
*/
- static waitForIndexBuildToStart(database, collectionName, indexName) {
+ static waitForIndexBuildToStart(database, collectionName, indexName, filter) {
let opId;
assert.soon(function() {
return (opId = IndexBuildTest.getIndexBuildOpId(
- database, collectionName, indexName)) !== -1;
+ database, collectionName, indexName, filter)) !== -1;
}, "Index build operation not found after starting via parallelShell");
return opId;
}