[SERVER-53293] DBClientCursor not properly applying readConcern when passed in as an argument Created: 09/Dec/20 Updated: 06/Dec/22 Resolved: 10/Dec/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 4.9 Required |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Jason Chan | Assignee: | Backlog - Replication Team |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Assigned Teams: |
Replication
|
||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
We use DBClientCursor to facilitate many of the calls supported by the DBClientBase interface (eg. DBClientBase::query). DBClientCursor accepts a readConcernObj as an optional argument. However, the readConcernObj passed in will always be overwritten to be empty due to the following: Since we use DBClientCursor for many of our DBClientConnection and DBDirectClient calls, having a readConcern field that doesn't actually append the readConcern is very misleading. Instead we should add an invariant to ensure that no readConcernObj is passed into DBClientCursor. We should also investigate whether the optional argument can be removed altogether. We already have a similar invariant for DBDirectClient::query but we should probably move it further down the chain to avoid confusion. |
| Comments |
| Comment by Jason Chan [ 10/Dec/20 ] |
|
This fix will be addressed as part of |
| Comment by Jason Chan [ 09/Dec/20 ] |
|
From
This explains that we want an explicit readConcern to be passed from internal clients (but not DBDirectClient, which is why we have the invariant described). This leads me to believe this is actually a bug that we are unable to pass in a non-empty readconcern to DBClientConnection calls that use DBClientCursor. |
| Comment by Jason Chan [ 09/Dec/20 ] |
|
Adding an invariant will also serve as an audit of our code for places where we might not be using the readConcern that we expect when making DBClient calls. |