class LogicalClock {
public:
...
// sets new time if the newTime > _clusterTime and the newTime passes validation.
// Return OK if time is updated
// Returns SignatureDoesNotMatch on signature mismatch.
Status advanceClusterTime(OperationContext* txn, SignedLogicalTime newTime) {
// TODO: grab mutex here
if (_lastLogicalTime.getTime() >= newTime.getTime()) {
return Status::OK();
}
if (!passesRateLimiter(newTime)) {
return {ErrorCodes::CannotAdvanceLogicalClock, ""};
}
if (autoOn) {
if (!hasEnoughPrivilege(txn)) {
auto mySignature = _hmacService->sign(newTime.getTime().serialize());
if (mySignature != newTime.getSignature()) {
return {ErrorCodes::SignatureDoesNotMatch, ""};
}
}
}
_lastLogicalTime = std::move(newTime);
}
}
processNewLogicalTime should be added to:
- readRequestMetadata() in metadata.cpp
- ShardingEgressMetadataHook::readReplyMetadata()
Distribution of the metadata means that its read/written from/to op_command and op_command_reply. This should use LogicalTimeMetadata from SERVER-27748 to append metadata to these places:
- depends on
-
SERVER-27855 Attach all NetworkInterface instances with EgressHooks
-
- Closed
-
-
SERVER-28158 SnapshotThread should stop using LogicalClock to trigger snapshots
-
- Closed
-
- is depended on by
-
SERVER-27750 Sharding component LogicalTimeMetadata distribution
-
- Closed
-
- is related to
-
SERVER-46257 OplogFetcher should run LogicalTimeMetadataHook on reply metadata
-
- Closed
-