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

Report lastCommittedOpTime in all command responses on mongod

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.7.3
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Sharding 2018-02-12, Sharding 2018-02-26, Sharding 2018-03-12

      Summary:

      On commands from mongos, mongod should return its lastCommittedOpTime (i.e. the timestamp from the opTime of its last committed write).

      Design:

      Inside appendReplyMetadata and appendReplyMetadataOnError in src/mongo/db/service_entry_point_mongod.cpp, check if the node's ShardingState is enabled (which means its in a sharded cluster) or that it is a config server, and get the lastCommittedOpTime from the replication coordinator and append it to the metadata BSONObjBuilder.

      if (ShardingState::get(opCtx)->enabled() || serverGlobalParams.clusterRole == ClusterRole::ConfigServer) {
          auto lastCommittedOpTime =
              repl::ReplicationCoordinator::get(opCtx)->getLastCommittedOpTime();
          metadataBob->append(kLastCommittedOpTimeFieldName, lastCommittedOpTime.getTimestamp());
      }
      

      Open Questions:

      • Should config servers return their lastCommittedOpTime?
        • Decision: Yes they should

      POC: https://mongodbcr.appspot.com/188020001/

            Assignee:
            jack.mulrow@mongodb.com Jack Mulrow
            Reporter:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: