The task is to add support for readConcern level snapshot for sharded aggregate command. The implementation assumes that shards also support it by properly establishing snapshots per the passed atClusterTime argument.
1. Compute atClusterTime: ACT
the algorithm: compute the greatest lastCommitedOpTime from the targeted shards.
should be added to cluster_commands_helpers.h as this function will be used by other cluster commands.
The call to this function should be done when targeted shards are determined:
once the ACT is computed need to verify that the targeted shards had the chunks at the ACT moment. This will use multi-version routing table. Should be added to cluster_commands_helpers.h
if the function returns false then use the current cluster time on mongos.
https://github.com/mongodb/mongo/blob/r3.7.2/src/mongo/s/commands/cluster_aggregate.cpp#L426 is the calling point the createCommandForTagetedShards needs to add missing info
Snapshot may return a SnapshotError error class. It needs to cause the restart of the read attempt up to configured # of retries
Add catching the error here: https://github.com/mongodb/mongo/blob/r3.7.2/src/mongo/s/commands/cluster_aggregate.cpp#L316
Make sure that the aggPassthrought that calls https://github.com/mongodb/mongo/blob/r3.7.3/src/mongo/s/client/shard.cpp#L154 retries via changing https://github.com/mongodb/mongo/blob/r3.7.3/src/mongo/s/client/shard_remote.cpp#L103
send command with batch size 1, establish cursors
add a few inserts
send getMore - this getMores should not return the inserted data as its in the other snapshot.