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

Set readPreference to secondary in causally_consistent_jscore_passthrough suite

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 3.5.12
    • None
    • Sharding
    • None
    • Fully Compatible
    • Sharding 2017-07-31, Sharding 2017-08-21

    Description

      Currently all the reads in jscore suite run under causally_consistent_jscore_passthrough executor send to the primary. Once the safe secondary reads project is completed it should send the reads to secondary. For that
      1. enable_causal_consitency.js need to add the following line

      db.getMongo().setReadPref("secondary");
      

      2. As setReadPref("secondary") doesn't actually do anything
      on the underlying DBClientReplicaSet instance to ensure all appropriate
      operations are routed to the secondary. The value is read via getReadPrefMode()
      when calling DB.prototype.runReadCommand() and causes the command object to be
      wrapped as

      {query: cmdObj, $readPreference: getReadPref()}

      .

      https://github.com/mongodb/mongo/blob/r3.5.6/src/mongo/shell/db.js#L100

      Hence, need override Mongo.prototype.runCommand() to
      ensure that the command object is getting wrapped for all appropriate
      operations. For example, in tests such as
      https://github.com/mongodb/mongo/blob/r3.5.6/jstests/core/find_getmore_cmd.js
      that explicitly do runCommand(

      {find: ...}

      ).

      Attachments

        Activity

          People

            misha.tyulenev@mongodb.com Misha Tyulenev
            misha.tyulenev@mongodb.com Misha Tyulenev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: