summaryrefslogtreecommitdiff
path: root/src/mongo/db/index_builds_coordinator_mongod.cpp
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2019-03-06 17:20:17 -0500
committerBenety Goh <benety@mongodb.com>2019-03-06 17:20:17 -0500
commit495e1b44df0e29cde8711d1d72bf8a0ccc2f8607 (patch)
tree7243ba9f5246f6a3bf2143854a8b779f4d7324a9 /src/mongo/db/index_builds_coordinator_mongod.cpp
parent869270cce4af503e2441407c6a2ed6e8df254421 (diff)
downloadmongo-495e1b44df0e29cde8711d1d72bf8a0ccc2f8607.tar.gz
SERVER-39085 fix index build setup in the IndexBuildsCoordinator during secondary oplog application
New index builds are ignored if the same indexes are already being built. IndexBuildsCoordinator does not add collation defaults or filter indexes on secondaries. MultiIndexBlock adds index build info to CurOp for identification purposes.
Diffstat (limited to 'src/mongo/db/index_builds_coordinator_mongod.cpp')
-rw-r--r--src/mongo/db/index_builds_coordinator_mongod.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/index_builds_coordinator_mongod.cpp b/src/mongo/db/index_builds_coordinator_mongod.cpp
index 51d14f6eec4..cf783ab1676 100644
--- a/src/mongo/db/index_builds_coordinator_mongod.cpp
+++ b/src/mongo/db/index_builds_coordinator_mongod.cpp
@@ -145,10 +145,12 @@ IndexBuildsCoordinatorMongod::startIndexBuild(OperationContext* opCtx,
// Task in thread pool should have similar CurOp representation to the caller so that it can be
// identified as a createIndexes operation.
+ LogicalOp logicalOp = LogicalOp::opInvalid;
BSONObj opDesc;
{
stdx::unique_lock<Client> lk(*opCtx->getClient());
auto curOp = CurOp::get(opCtx);
+ logicalOp = curOp->getLogicalOp();
opDesc = curOp->opDescription().getOwned();
}
@@ -159,6 +161,7 @@ IndexBuildsCoordinatorMongod::startIndexBuild(OperationContext* opCtx,
timeoutError,
writesAreReplicated,
shouldNotConflictWithSecondaryBatchApplication,
+ logicalOp,
opDesc
]() noexcept {
auto opCtx = Client::getCurrent()->makeOperationContext();
@@ -179,6 +182,7 @@ IndexBuildsCoordinatorMongod::startIndexBuild(OperationContext* opCtx,
{
stdx::unique_lock<Client> lk(*opCtx->getClient());
auto curOp = CurOp::get(opCtx.get());
+ curOp->setLogicalOp_inlock(logicalOp);
curOp->setOpDescription_inlock(opDesc);
}