[SERVER-29096] Set readPreference to secondary in causally_consistent_jscore_passthrough suite Created: 05/May/17  Updated: 30/Oct/23  Resolved: 03/Aug/17

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 3.5.12

Type: Task Priority: Major - P3
Reporter: Misha Tyulenev Assignee: Misha Tyulenev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-07-31, Sharding 2017-08-21
Participants:

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

).



 Comments   
Comment by Githook User [ 10/Aug/17 ]

Author:

{'name': 'Misha Tyulenev', 'email': 'misha@mongodb.com'}

Message: SERVER-29096 set readPreference to secondary in causally_consistent_jscore_passthrough suite
Branch: master
https://github.com/mongodb/mongo/commit/5ab64bbe07e98b7cc0b8a88b6adb3b348e174651

Generated at Thu Feb 08 04:19:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.