Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-27749

Integrate LogicalTimeMetadata with metadata processing

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.5
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Sharding 2017-02-13, Sharding 2017-03-06, Sharding 2017-03-27

      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:

      1. readRequestMetadata() in metadata.cpp
      2. 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:

      1. ShardingEgressMetadataHook::writeRequestMetadata()
      2. Building command response

            Assignee:
            randolph@mongodb.com Randolph Tan
            Reporter:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: