[SERVER-29091] Stop putting $readPreference inside of $queryOptions in mongos Created: 05/May/17  Updated: 30/Jan/24

Status: Open
Project: Core Server
Component/s: Internal Code, Sharding
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Mathias Stearn Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: PM-315
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-59302 Remove shell support for $query/query... Closed
Assigned Teams:
Query Execution
Sprint: QE 2023-02-06, QE 2023-02-20, QE 2023-07-24, QE 2023-08-07, QE 2023-08-21, QE 2023-09-04
Participants:

 Description   

Mongos currently wraps the $readPreference field inside of a $queryOptions object. Instead it should just put $readPreference at the top-level of the command, matching the format used by OP_MSG.



 Comments   
Comment by David Storch [ 22/Feb/23 ]

I don't think I'm going to get to this given my current queue of tickets. We could consider it as a quick win nomination, so I'll request it to be re-triaged.

Comment by David Storch [ 13/Dec/22 ]

brenda.rodriguez@mongodb.com I've looked at this a bit already and it wasn't as simple I was hoping. However, I did complete related ticket SERVER-59302, which might make this a bit easier. I'm going to bump this ahead a few sprints. At some point when I get time I'd like to have another look at this to see if there's something relatively easy that I can do to at least move in the direction of eliminating $queryOptions.

Comment by Brenda Rodriguez [ 12/Dec/22 ]

david.storch@mongodb.com are you still planning to do this during this sprint?

Comment by David Storch [ 16/Nov/22 ]

I looked into this a bit and found that there are still quite a few uses of "$queryOptions" in the code base. It also looks like we might be sending "$queryOptions" over the wire between nodes in a few cases which, if true, would require the work to be staged across multiple LTS releases. I also concluded that it is in fact easier to do SERVER-59302 before this ticket as opposed to the other way around. I am pausing work on this ticket at least until SERVER-59302 is resolved.

Comment by David Storch [ 17/Oct/22 ]

I think this should be a lot easier to do now that the OP_QUERY wire protocol message is no longer supported. I'm also wondering if doing this will make SERVER-59302 easier to do.

Comment by Mathias Stearn [ 03/May/18 ]
  1. Grep the codebase for $queryOptions (or \$queryOptions depending on your tool of choice)
  2. Remove all uses (down to 29 at the moment, mostly in query and agg)
  3. Fix everything that breaks
    1. One particular problem is code that appends $readPreference twice. That will get caught quickly in --dbg=on builds.
    2. Tests using $queryOptions should be migrated to just put $readPreference as a top-level command argument. This isn't a supported format we are supposed to see on the wire, so we don't need tests to make sure it works. Most of the tests still using it are doing so because it is testing code that expects that format.
Comment by Gregory McKeon (Inactive) [ 13/Nov/17 ]

redbeard0531 can you clarify what needs to be done here?

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