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