diff options
-rw-r--r-- | src/mongo/db/pipeline/process_interface/common_process_interface.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/repl/repl_client_info.h | 18 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_mongod.cpp | 2 |
4 files changed, 14 insertions, 12 deletions
diff --git a/src/mongo/db/pipeline/process_interface/common_process_interface.cpp b/src/mongo/db/pipeline/process_interface/common_process_interface.cpp index 871ce4a70a6..bcb419f6c17 100644 --- a/src/mongo/db/pipeline/process_interface/common_process_interface.cpp +++ b/src/mongo/db/pipeline/process_interface/common_process_interface.cpp @@ -163,8 +163,8 @@ void CommonProcessInterface::updateClientOperationTime(OperationContext* opCtx) auto replCoord = repl::ReplicationCoordinator::get(opCtx); if (replCoord) { auto operationTime = OperationTimeTracker::get(opCtx)->getMaxOperationTime(); - repl::OpTime opTime(operationTime.asTimestamp(), replCoord->getTerm()); - repl::ReplClientInfo::forClient(opCtx->getClient()).setLastProxyWriteOpTimeForward(opTime); + repl::ReplClientInfo::forClient(opCtx->getClient()) + .setLastProxyWriteTimestampForward(operationTime.asTimestamp()); } } diff --git a/src/mongo/db/repl/repl_client_info.h b/src/mongo/db/repl/repl_client_info.h index 51b953d2875..070e3ff6caa 100644 --- a/src/mongo/db/repl/repl_client_info.h +++ b/src/mongo/db/repl/repl_client_info.h @@ -61,20 +61,22 @@ public: * Stores the operation time of the latest proxy write, that is, a write that was forwarded * to and executed on a different node instead of being executed locally. */ - void setLastProxyWriteOpTimeForward(const OpTime& opTime) { + void setLastProxyWriteTimestampForward(const Timestamp& timestamp) { // Only advance the operation time of the latest proxy write if it is greater than the one // currently stored. - if (opTime > _lastProxyWriteOpTime) { - _lastProxyWriteOpTime = opTime; + if (timestamp > _lastProxyWriteTimestamp) { + _lastProxyWriteTimestamp = timestamp; } } /** - * Returns the greater of the times set by 'setLastOp()' and - * 'setLastProxiedWriteOpTimeForward()'. + * Returns the greater of the timestamps set by 'setLastOp()' and + * 'setLastProxyWriteTimestampForward()'. */ - OpTime getMaxKnownOpTime() const { - return _lastOp > _lastProxyWriteOpTime ? _lastOp : _lastProxyWriteOpTime; + Timestamp getMaxKnownOperationTime() const { + auto lastOpTimestamp = _lastOp.getTimestamp(); + return lastOpTimestamp > _lastProxyWriteTimestamp ? lastOpTimestamp + : _lastProxyWriteTimestamp; } /** @@ -109,7 +111,7 @@ private: OpTime _lastOp = OpTime(); - OpTime _lastProxyWriteOpTime; + Timestamp _lastProxyWriteTimestamp; }; } // namespace repl diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp index 4796bd20a44..13844e8ee82 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -390,7 +390,7 @@ LogicalTime getClientOperationTime(OperationContext* opCtx) { } return LogicalTime( - repl::ReplClientInfo::forClient(opCtx->getClient()).getMaxKnownOpTime().getTimestamp()); + repl::ReplClientInfo::forClient(opCtx->getClient()).getMaxKnownOperationTime()); } /** diff --git a/src/mongo/db/service_entry_point_mongod.cpp b/src/mongo/db/service_entry_point_mongod.cpp index aafb190a3f1..b2b5bff551d 100644 --- a/src/mongo/db/service_entry_point_mongod.cpp +++ b/src/mongo/db/service_entry_point_mongod.cpp @@ -236,7 +236,7 @@ public: if (isReplSet) { // Attach our own last opTime. repl::OpTime lastOpTimeFromClient = - repl::ReplClientInfo::forClient(opCtx->getClient()).getMaxKnownOpTime(); + repl::ReplClientInfo::forClient(opCtx->getClient()).getLastOp(); replCoord->prepareReplMetadata(request.body, lastOpTimeFromClient, metadataBob); if (isShardingAware || isConfig) { |