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

mongos changes for snapshot reads

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.7.0
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Repl 2020-05-18

      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.)

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: