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

Enable remaining commands supporting readConcern for shell CausalConsistency

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.7
    • Affects Version/s: Backlog
    • Component/s: Sharding
    • None
    • Fully Compatible

      As a follow up for SERVER-28450
      enable causal consistency for:

      aggregate command and the db.collection.aggregate() method
      distinct command
      count command
      group command
      parallelCollectionScan command
      geoNear command
      geoSearch command
      mapReduce command

      The check is done at
      https://github.com/mongodb/mongo/blob/master/src/mongo/shell/mongo.js#L46

      it should be changed to

              var commandsToForceReadConcern = [
                  "count",
                  "distinct",
                  "find",
                  "geoNear",
                  "geoSearch",
                  "group",
                  "mapReduce",
                  "parallelCollectionScan",
              ];
      
              var forceReadConcern = Array.contains(commandsToForceReadConcern, cmdName);
      
              if (cmdName === "aggregate") {
                  // Aggregate can be either a read or a write depending on whether it has a $out stage.
                  // $out is required to be the last stage of the pipeline.
                  var stages = obj.pipeline;
                  const lastStage = stages && Array.isArray(stages) && (stages.length !== 0)
                      ? stages[stages.length - 1]
                      : undefined;
                  const hasOut =
                      lastStage && (typeof lastStage === 'object') && lastStage.hasOwnProperty('$out');
                  const hasExplain = obj.hasOwnProperty("explain");
      
                  if (!hasExplain && !hasOut) {
                          forceReadConcern = true;
                  }
              }
             return forceReadConcern;
      

            Assignee:
            jack.mulrow@mongodb.com Jack Mulrow
            Reporter:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: