summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2019-11-20 22:21:44 +0000
committerevergreen <evergreen@mongodb.com>2019-11-20 22:21:44 +0000
commitd410d3733c768e4bbcc0e009cb4d48a7a653c7cf (patch)
treee357c4cc03a8a3a825e739a8a9d4d49ba22077f7
parent0c398983e0d63ac13b03e8136e0126af537ca311 (diff)
downloadmongo-d410d3733c768e4bbcc0e009cb4d48a7a653c7cf.tar.gz
SERVER-43642 createIndexesForApplyOps() uses IndexBuildsCoordinator for foreground index builds
-rw-r--r--src/mongo/db/repl/oplog.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 60d5a3dd60c..3b83398df30 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -66,7 +66,6 @@
#include "mongo/db/dbhelpers.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_descriptor.h"
-#include "mongo/db/index_builder.h"
#include "mongo/db/index_builds_coordinator.h"
#include "mongo/db/keypattern.h"
#include "mongo/db/namespace_string.h"
@@ -256,24 +255,22 @@ void createIndexForApplyOps(OperationContext* opCtx,
const auto constraints =
ReplicationCoordinator::get(opCtx)->shouldRelaxIndexConstraints(opCtx, indexNss)
- ? IndexBuilder::IndexConstraints::kRelax
- : IndexBuilder::IndexConstraints::kEnforce;
+ ? IndexBuildsManager::IndexConstraints::kRelax
+ : IndexBuildsManager::IndexConstraints::kEnforce;
- const auto replicatedWrites = opCtx->writesAreReplicated()
- ? IndexBuilder::ReplicatedWrites::kReplicated
- : IndexBuilder::ReplicatedWrites::kUnreplicated;
+ auto indexBuildsCoordinator = IndexBuildsCoordinator::get(opCtx);
if (shouldBuildInForeground(opCtx, indexSpec, indexNss, mode)) {
- IndexBuilder builder(indexSpec, constraints, replicatedWrites);
- Status status = builder.buildInForeground(opCtx, db, indexCollection);
- uassertStatusOK(status);
+ IndexBuildsCoordinator::updateCurOpOpDescription(opCtx, indexNss, {indexSpec});
+ auto fromMigrate = false;
+ indexBuildsCoordinator->createIndexes(
+ opCtx, indexCollection->uuid(), {indexSpec}, constraints, fromMigrate);
} else {
Lock::TempRelease release(opCtx->lockState());
// TempRelease cannot fail because no recursive locks should be taken.
invariant(!opCtx->lockState()->isLocked());
auto collUUID = indexCollection->uuid();
auto indexBuildUUID = UUID::gen();
- auto indexBuildsCoordinator = IndexBuildsCoordinator::get(opCtx);
// We don't pass in a commit quorum here because secondary nodes don't have any knowledge of
// it.