Skip to content

Commit e3c434d

Browse files
benetyevergreen
authored andcommitted
SERVER-39002 add IndexBuildsCoordinator::joinIndexBuild()
1 parent 78a6b58 commit e3c434d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/mongo/db/index_builds_coordinator.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,14 @@ StatusWith<std::pair<long long, long long>> IndexBuildsCoordinator::startIndexRe
279279
return _runIndexRebuildForRecovery(opCtx, collection, indexCatalogStats, buildUUID);
280280
}
281281

282-
Future<void> IndexBuildsCoordinator::joinIndexBuilds(const NamespaceString& nss,
283-
const std::vector<BSONObj>& indexSpecs) {
284-
// TODO: implement. This code is just to make it compile.
285-
auto pf = makePromiseFuture<void>();
286-
auto promise = std::move(pf.promise);
287-
return std::move(pf.future);
282+
void IndexBuildsCoordinator::joinIndexBuild(OperationContext* opCtx, const UUID& buildUUID) {
283+
auto replStateResult = _getIndexBuild(buildUUID);
284+
if (!replStateResult.isOK()) {
285+
return;
286+
}
287+
auto replState = replStateResult.getValue();
288+
auto fut = replState->sharedPromise.getFuture();
289+
log() << "Index build joined: " << buildUUID << ": " << fut.waitNoThrow(opCtx);
288290
}
289291

290292
void IndexBuildsCoordinator::waitForAllIndexBuildsToStopForShutdown() {

src/mongo/db/index_builds_coordinator.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,9 @@ class IndexBuildsCoordinator {
139139
const UUID& buildUUID);
140140

141141
/**
142-
* TODO: not yet implemented.
142+
* Waits for the index build identified by 'buildUUID' to complete.
143143
*/
144-
Future<void> joinIndexBuilds(const NamespaceString& nss,
145-
const std::vector<BSONObj>& indexSpecs);
144+
void joinIndexBuild(OperationContext* opCtx, const UUID& buildUUID);
146145

147146
/**
148147
* Commits the index build identified by 'buildUUID'.

0 commit comments

Comments
 (0)