diff options
author | Louis Williams <louis.williams@mongodb.com> | 2019-02-05 13:05:27 -0500 |
---|---|---|
committer | Louis Williams <louis.williams@mongodb.com> | 2019-02-12 13:15:24 +1100 |
commit | 7defb111584754daefece019f9045e1f0e1811ef (patch) | |
tree | 31c63fcffcdd8a6eaf4e5c614eeef54d381224a2 /src/mongo/db/index_builder.cpp | |
parent | e4f593b3dee7808d27c9db54c517ab198f5d9f89 (diff) | |
download | mongo-7defb111584754daefece019f9045e1f0e1811ef.tar.gz |
SERVER-39068 Replicate startIndexBuild and commitIndexBuild oplog entrires
Diffstat (limited to 'src/mongo/db/index_builder.cpp')
-rw-r--r-- | src/mongo/db/index_builder.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp index 754848ae5cd..d73a31ab4e2 100644 --- a/src/mongo/db/index_builder.cpp +++ b/src/mongo/db/index_builder.cpp @@ -224,10 +224,13 @@ Status IndexBuilder::_build(OperationContext* opCtx, } Status status = Status::OK(); + { TimestampBlock tsBlock(opCtx, _initIndexTs); - status = writeConflictRetry( - opCtx, "Init index build", ns.ns(), [&] { return indexer.init(_index).getStatus(); }); + status = writeConflictRetry(opCtx, "Init index build", ns.ns(), [&] { + return indexer.init(_index, MultiIndexBlock::makeTimestampedIndexOnInitFn(opCtx, coll)) + .getStatus(); + }); } if (status == ErrorCodes::IndexAlreadyExists || @@ -309,10 +312,12 @@ Status IndexBuilder::_build(OperationContext* opCtx, status = writeConflictRetry(opCtx, "Commit index build", ns.ns(), [opCtx, coll, &indexer, &ns] { WriteUnitOfWork wunit(opCtx); - auto status = indexer.commit([opCtx, coll, &ns](const BSONObj& indexSpec) { - opCtx->getServiceContext()->getOpObserver()->onCreateIndex( - opCtx, ns, *(coll->uuid()), indexSpec, false); - }); + auto status = indexer.commit( + [opCtx, coll, &ns](const BSONObj& indexSpec) { + opCtx->getServiceContext()->getOpObserver()->onCreateIndex( + opCtx, ns, *(coll->uuid()), indexSpec, false); + }, + MultiIndexBlock::kNoopOnCommitFn); if (!status.isOK()) { return status; } |