diff options
-rw-r--r-- | src/mongo/db/op_observer_impl.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp index cb9bab81b09..498c2002056 100644 --- a/src/mongo/db/op_observer_impl.cpp +++ b/src/mongo/db/op_observer_impl.cpp @@ -156,20 +156,20 @@ struct OpTimeBundle { */ OpTimeBundle replLogUpdate(OperationContext* opCtx, const OplogUpdateEntryArgs& args, - MutableOplogEntry oplogEntry) { - oplogEntry.setNss(args.nss); - oplogEntry.setUuid(args.uuid); + MutableOplogEntry* oplogEntry) { + oplogEntry->setNss(args.nss); + oplogEntry->setUuid(args.uuid); repl::OplogLink oplogLink; - repl::appendOplogEntryChainInfo(opCtx, &oplogEntry, &oplogLink, args.updateArgs.stmtId); + repl::appendOplogEntryChainInfo(opCtx, oplogEntry, &oplogLink, args.updateArgs.stmtId); OpTimeBundle opTimes; const auto storePreImageInOplogForRetryableWrite = (args.updateArgs.storeDocOption == CollectionUpdateArgs::StoreDocOption::PreImage && - opCtx->getTxnNumber() && !oplogEntry.getNeedsRetryImage()); + opCtx->getTxnNumber() && !oplogEntry->getNeedsRetryImage()); if (storePreImageInOplogForRetryableWrite || args.updateArgs.preImageRecordingEnabledForCollection) { - MutableOplogEntry noopEntry = oplogEntry; + MutableOplogEntry noopEntry = *oplogEntry; invariant(args.updateArgs.preImageDoc); noopEntry.setOpType(repl::OpTypeEnum::kNoop); noopEntry.setObject(*args.updateArgs.preImageDoc); @@ -181,8 +181,8 @@ OpTimeBundle replLogUpdate(OperationContext* opCtx, // This case handles storing the post image for retryable findAndModify's. if (args.updateArgs.storeDocOption == CollectionUpdateArgs::StoreDocOption::PostImage && - opCtx->getTxnNumber() && !oplogEntry.getNeedsRetryImage()) { - MutableOplogEntry noopEntry = oplogEntry; + opCtx->getTxnNumber() && !oplogEntry->getNeedsRetryImage()) { + MutableOplogEntry noopEntry = *oplogEntry; noopEntry.setOpType(repl::OpTypeEnum::kNoop); noopEntry.setObject(args.updateArgs.updatedDoc); oplogLink.postImageOpTime = logOperation(opCtx, &noopEntry); @@ -190,14 +190,14 @@ OpTimeBundle replLogUpdate(OperationContext* opCtx, opTimes.prePostImageOpTime = oplogLink.postImageOpTime; } - oplogEntry.setOpType(repl::OpTypeEnum::kUpdate); - oplogEntry.setObject(args.updateArgs.update); - oplogEntry.setObject2(args.updateArgs.criteria); - oplogEntry.setFromMigrateIfTrue(args.updateArgs.fromMigrate); + oplogEntry->setOpType(repl::OpTypeEnum::kUpdate); + oplogEntry->setObject(args.updateArgs.update); + oplogEntry->setObject2(args.updateArgs.criteria); + oplogEntry->setFromMigrateIfTrue(args.updateArgs.fromMigrate); // oplogLink could have been changed to include pre/postImageOpTime by the previous no-op write. - repl::appendOplogEntryChainInfo(opCtx, &oplogEntry, &oplogLink, args.updateArgs.stmtId); - opTimes.writeOpTime = logOperation(opCtx, &oplogEntry); - opTimes.wallClockTime = oplogEntry.getWallClockTime(); + repl::appendOplogEntryChainInfo(opCtx, oplogEntry, &oplogLink, args.updateArgs.stmtId); + opTimes.writeOpTime = logOperation(opCtx, oplogEntry); + opTimes.wallClockTime = oplogEntry->getWallClockTime(); return opTimes; } @@ -548,7 +548,7 @@ void OpObserverImpl::onUpdate(OperationContext* opCtx, const OplogUpdateEntryArg } } - opTime = replLogUpdate(opCtx, args, oplogEntry); + opTime = replLogUpdate(opCtx, args, &oplogEntry); if (oplogEntry.getNeedsRetryImage()) { // If the oplog entry has `needsRetryImage`, copy the image into image collection. |