[SERVER-27773] Add operationTime to command response Created: 20/Jan/17  Updated: 24/Aug/17  Resolved: 28/Feb/17

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

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

Issue Links:
Duplicate
is duplicated by SERVER-27719 Add Operation logical time to response Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-03-06
Participants:

 Description   

The goal is to put the "operationTime" filed in the command response. Therefore it will be

  operationTime: <ClusterTime for this operation> 

The method should return just a clusterTime known to the node, the actual implementation will be done in SERVER-27786.

1. add to commands.[h cpp]

// adds operationTime to command bob
void appendOperationTime(Timestamp operationTime, BSONObjBuilder* resultBob)

2. add to dbcommands.[h cpp]

// computes operationTime 
Timestamp getOperationTime(OperationContext* txn,
                  const rpc::RequestInterface& request)

3. The appendOperationTime should be called in the Command::run() with the inPlaceReplyBob as an argument.

4. Add unit tests



 Comments   
Comment by Ramon Fernandez Marina [ 24/Aug/17 ]

SERVER-27773 add operationTime field to the command response
Branch:master
https://github.com/mongodb/mongo/commit/6fe8c420da0c1071bfb8abfd7e936059d4977472

Comment by Randolph Tan [ 21/Feb/17 ]

misha I was initially confused because I interprted the api in the decription as "every command will need it's own implementation of appendOperationTime" and it looks like that's not the case. I just wanted to say that we already have get last client opTime and it looks like that's what you are going to use.

Comment by Misha Tyulenev [ 19/Feb/17 ]

renctan the appendOpTimeMetadata modifies the replMetadata. The design spec (page9) requests to add it to the
command's response. appendOpTimeMetadata vs this approach was discussed in the design process.

Here is the recap: the operationTime value will be used in the follow up read request arguments
while the cluster time lives in the metadata and is "automatic" i.e. its gossiped but not exposed to the public interface.
so the argument goes that as the operationTime needs to be used as the readConcern arg
it should be returned in the command argument.

In the follow up txn I plan to use the same repl::ReplClientInfo::forClient(txn->getClient()).getLastOp(); value as used in the appendOpTimeMetadata - but this will be discussed separately.

Comment by Misha Tyulenev [ 17/Feb/17 ]

milkie, renctan , can you please review this change when its implemented? Are you agree with the approach detailed in the ticket description?
Thanks!

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