-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Service Arch
-
Fully Compatible
-
Service Arch 2023-10-02, Service Arch 2023-10-16, Service Arch 2023-10-30, Service Arch 2023-11-13, Service Arch 2023-11-27, Service Arch 2023-12-11, Service Arch 2023-12-25, Service Arch 2024-01-08, Service Arch 2024-01-22, Service Arch 2024-02-05
There are several calls to BSONObj::getField that are made by functions called by ExecCommandDatabase::_initiateCommand and ExecCommandDatabase::run.
They come from the following places:
- Multiple calls to OpMsgRequest::getDbName
- _extractReadConcern
- commandSpecifiesWriteConcern
- searches for "shardVersion" and "databaseVersion"
- ReadPreferenceSetting::fromInnerBSON
- VectorClock::PlainComponentFormat::in and VectorClock::SignedComponentFormat::in
Additionally, there are two manual loops over BSONOjb fields:
- readRequestMetadata
- ExecCommandDatabase::_initiateCommand
Finally, we invoke 2 IDL parser in addition to the one for the command
- APIParametersFromClient
- OperationSessionInfoFromClient
Example of the request fields that can be consolidated in an IDL definition:
structs: CommonRequestArgs: description: TODO strict: false unsafe_dangerous_disable_extra_field_duplicate_checks: true chained_structs: APIParametersFromClient: APIParametersFromClient OperationSessionInfoFromClientBase: OperationSessionInfoFromClientBase ClusterTimesCommon: ClusterTimesCommon fields: readConcern: type: object optional: true databaseVersion: type: database_version optional: true shardVersion: type: shard_version optional: true writeConcern: type: IDLAnyType optional: true $readPreference: type: IDLAnyType cpp_name: readPreference optional: true $client: type: IDLAnyType cpp_name: clientMetadata optional: true tracking_info: type: IDLAnyType optional: true $audit: cpp_name: impersonation type: IDLAnyType optional: true clientOperationKey: type: uuid optional: true mayBypassWriteBlocking: type: IDLAnyType optional: true maxTimeMS: type: maxTimeMS optional: true validator: { gte: 0 } maxTimeMSOpOnly: type: maxTimeMS optional: true validator: { gte: 0 } help: type: safeBool optional: true comment: type: IDLAnyType optional: true $maxTimeMS: type: IDLAnyType cpp_name: queryOptionMaxTimeMS optional: true
Note: There may be opportunity to align with the request fields defined in src/mongo/idl/generic_argument.idl. On the other hand, a more narrow parser for this error handling will be better then a wider parser handling all generic request fields.
POC: https://github.com/markbenvenuto/mongo/tree/tiger_perf_bson
- related to
-
SERVER-80295 Refactor command reply processing path to reduce BSON parsing passes
- Closed
-
SERVER-85791 Only parse command request once in command processing path
- Closed