Select a timestamp for readConcern: "snapshot" reads that don't have atClusterTime. Forward the readConcern to shards. For snapshot reads that do have atClusterTime, use that timestamp for shard targeting. Make any changes required to store atClusterTime in mongos cursors' read concerns.
Return "atClusterTime" in replies to snapshot read commands. In ClusterFindCmd::run, add:
// Build the response document. CursorResponseBuilder::Options options; options.isInitialResponse = true; + options.atClusterTime = repl::ReadConcernArgs::get(opCtx).getArgsAtClusterTime(); CursorResponseBuilder firstBatch(result, options);
In establishMergingMongosCursor(), add:
rpc::OpMsgReplyBuilder replyBuilder; CursorResponseBuilder::Options options; options.isInitialResponse = true; + options.atClusterTime = repl::ReadConcernArgs::get(opCtx).getArgsAtClusterTime(); CursorResponseBuilder responseBuilder(&replyBuilder, options);
Audit uses of the CursorResponse class as well.
In cluster_distinct_cmd.cpp and cluster_find_cmd.cpp:
result.appendArray("values", b.obj()); if (repl::ReadConcernArgs::get(opCtx).getArgsAtClusterTime()) { result.append("atClusterTime"_sd, repl::ReadConcernArgs::get(opCtx).getArgsAtClusterTime()->asTimestamp()); } return true;
Support distinct on unsharded collections with snapshot reads, for consistency with transactions. (Ban snapshot distinct on sharded collections is SERVER-47996.)
- is depended on by
-
SERVER-47996 Ban snapshot "distinct" outside transactions on sharded collections
- Closed
- related to
-
SERVER-47915 Write commands silently ignore readConcern via mongos
- Closed