[SERVER-80364] Use original request's SerializationContext in FindKeyGenerator::reparse Created: 23/Aug/23  Updated: 20/Dec/23  Resolved: 20/Dec/23

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

Type: Task Priority: Major - P3
Reporter: Hugh Tong (Inactive) Assignee: Backlog - Service Architecture
Resolution: Cannot Reproduce Votes: 0
Labels: ntdi_must_have
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-80298 Reduce the size of SerializationContext Backlog
Assigned Teams:
Service Arch
Participants:

 Description   

FindKeyGenerator::reparse creates a new request by serializing the dbName object parsed from a _parseableQueryShape object.  The parseableQueryShape is a BSON object that is created internally via query_shape::extractQueryShape and follows serializing for storage conventions, which means the accessed nss.dbName() is correctly formed.

However, reparse builds the $db field in the new request BSONObj by calling DatabaseNameUtil::serialize(nss.dbName()) without a serialization context, which means it is subject to storage rules (ie. tenantId feature flag) and can be prefixed.  If it's not prefixed, the tenantId isn't added to the BSONObj and could potentially be lost, as boost::none is passed into the FindRequestCommand::parse() function.

We should first store the serialization context from the original request into FindKeyGenerator as this contains the context of how the tenantId was initially retrieved, then extract the tenantId from the nss and pass that into the parse() function along with the serialization context.



 Comments   
Comment by Sophia Tan [ 31/Aug/23 ]

We need a test case to uncover the issue.

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