diff options
author | Benety Goh <benety@mongodb.com> | 2019-10-09 03:55:35 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-09 03:55:35 +0000 |
commit | e3c434d49714eb460b5c35b9d9202cf88082b743 (patch) | |
tree | 0d3a532f4411429b641932eba7ea1df9d664f96b | |
parent | 78a6b5895d43ba751a6f87127af30ab7e61cf79a (diff) | |
download | mongo-e3c434d49714eb460b5c35b9d9202cf88082b743.tar.gz |
SERVER-39002 add IndexBuildsCoordinator::joinIndexBuild()
-rw-r--r-- | src/mongo/db/index_builds_coordinator.cpp | 14 | ||||
-rw-r--r-- | src/mongo/db/index_builds_coordinator.h | 5 |
2 files changed, 10 insertions, 9 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp index 0de11ccb24a..80a192fb078 100644 --- a/src/mongo/db/index_builds_coordinator.cpp +++ b/src/mongo/db/index_builds_coordinator.cpp @@ -279,12 +279,14 @@ StatusWith<std::pair<long long, long long>> IndexBuildsCoordinator::startIndexRe return _runIndexRebuildForRecovery(opCtx, collection, indexCatalogStats, buildUUID); } -Future<void> IndexBuildsCoordinator::joinIndexBuilds(const NamespaceString& nss, - const std::vector<BSONObj>& indexSpecs) { - // TODO: implement. This code is just to make it compile. - auto pf = makePromiseFuture<void>(); - auto promise = std::move(pf.promise); - return std::move(pf.future); +void IndexBuildsCoordinator::joinIndexBuild(OperationContext* opCtx, const UUID& buildUUID) { + auto replStateResult = _getIndexBuild(buildUUID); + if (!replStateResult.isOK()) { + return; + } + auto replState = replStateResult.getValue(); + auto fut = replState->sharedPromise.getFuture(); + log() << "Index build joined: " << buildUUID << ": " << fut.waitNoThrow(opCtx); } void IndexBuildsCoordinator::waitForAllIndexBuildsToStopForShutdown() { diff --git a/src/mongo/db/index_builds_coordinator.h b/src/mongo/db/index_builds_coordinator.h index 17b506c7d37..68670be5263 100644 --- a/src/mongo/db/index_builds_coordinator.h +++ b/src/mongo/db/index_builds_coordinator.h @@ -139,10 +139,9 @@ public: const UUID& buildUUID); /** - * TODO: not yet implemented. + * Waits for the index build identified by 'buildUUID' to complete. */ - Future<void> joinIndexBuilds(const NamespaceString& nss, - const std::vector<BSONObj>& indexSpecs); + void joinIndexBuild(OperationContext* opCtx, const UUID& buildUUID); /** * Commits the index build identified by 'buildUUID'. |