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

Set readPreference to secondary in causally_consistent_jscore_passthrough suite

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.12
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • Sharding 2017-07-31, Sharding 2017-08-21
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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: ...}

      ).

            Assignee:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Reporter:
            misha.tyulenev@mongodb.com Misha Tyulenev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: