[SERVER-33018] Report lastCommittedOpTime in all command responses on mongod Created: 30/Jan/18  Updated: 29/Oct/23  Resolved: 06/Mar/18

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.7.3

Type: Task Priority: Major - P3
Reporter: Misha Tyulenev Assignee: Jack Mulrow
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 2018-02-12, Sharding 2018-02-26, Sharding 2018-03-12
Participants:

 Description   

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/



 Comments   
Comment by Githook User [ 06/Mar/18 ]

Author:

{'email': 'jack.mulrow@mongodb.com', 'name': 'Jack Mulrow', 'username': 'jsmulrow'}

Message: SERVER-33018 Return lastCommittedOpTime in all command responses from sharding enabled mongod
Branch: master
https://github.com/mongodb/mongo/commit/90d304a5e510c4cc486abb527bb9d0a8b78720ca

Generated at Thu Feb 08 04:32:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.