[SERVER-77508] ReadConcern isn't propagated to DBDirectClient Created: 26/May/23  Updated: 29/Oct/23  Resolved: 30/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Jordi Olivares Provencio Assignee: Jordi Olivares Provencio
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-77507 Integrate acquisitions into Find Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2023-05-29, Execution Team 2023-06-12
Participants:

 Description   

Currently DBDirectClient doesn't propagate the read concern used by the parent operation into DBDirectClient.

This can be reproduced by performing a find operation with a $where clause. The command performs a DBDirectClient::find call to the system.js collection. Adding logging statements to get the operation read concern at the beginning of the find command shows this:

[j0:n0] | 2023-05-25T15:28:05.454+00:00 I  QUERY    0       [conn70] "opCtx level comand start","attr":{"readConcern":{"level":"majority","afterClusterTime":{"$timestamp":{"t":1685028485,"i":19}},"provenance":"clientSupplied"}}
...
[j0:n0] | 2023-05-25T15:28:05.507+00:00 I  QUERY    0       [conn70] "opCtx level comand start","attr":{"readConcern":{"provenance":"implicitDefault"}}

This can lead to potentially invalid reads performed by DBDirectClient.



 Comments   
Comment by Githook User [ 30/May/23 ]

Author:

{'name': 'Jordi Olivares Provencio', 'email': 'jordi.olivares-provencio@mongodb.com', 'username': 'jordiolivares'}

Message: SERVER-77508 Propagate readConcern to DBDirectClient
Branch: master
https://github.com/mongodb/mongo/commit/0a463a0bffec419232515841afafd849c72f9b1a

Comment by Jordi Olivares Provencio [ 26/May/23 ]

Sure, this shouldn't be difficult as it's just touching this branch

Comment by Max Hirschhorn [ 26/May/23 ]

Thanks for confirming jordi.olivares-provencio@mongodb.com! Can we make it so ServiceEntryPoint (or wherever) skips updating the ReadConcernArgs decoration when parsing a command issued with DBDirectClient? It seems incorrect that using DBDirectClient changes the decorations on the OperationContext because it is meant to be sharing the values with the parent operation.

Comment by Jordi Olivares Provencio [ 26/May/23 ]

max.hirschhorn@mongodb.com That's precisely what's happening. The new command gets parsed and resets the ReadConcernArgs on the parent's opCtx.

Comment by Max Hirschhorn [ 26/May/23 ]

jordi.olivares-provencio@mongodb.com, would you please elaborate on why the read concern needs to be propagated to the DBDirectClient? My understanding is DBDirectClient is using the same OperationContext as the parent operation and therefore already inherits the value of the ReadConcernArgs decoration on the OperationContext. Is the "opCtx level comand start" log output you've shared showing that the ReadConcernArgs decoration is having its value reset when the DBDirectClient command is being run?

Generated at Thu Feb 08 06:35:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.