When an oplog entry contains a "tid" and an "ns" field, the parsing of the "ns" field depends on the contents of the "tid" field (and these can come in either order, and the "tid" field may not be present). We handle this since SERVER-66708 by first scanning the object looking for a "tid" field, then passing that into the parser beforehand.
Scanning a BSON object is fairly expensive so we could achieve better performance by adding a special case in the IDL for this – we could have the "ns" field in the IDL take a parameter specifying the "tid" field, and delay parsing of the "ns" field until the end of the object. We would then scan the object and parse the tid field only once.
We could also consider handling the "tid" field only when multitenant support is enabled.
(Handling an absent "tid" field is currently ~10% of the oplog parse in benchmarks)
- related to
-
SERVER-88709 Get rid of "if obj.hasElement(field) then obj[field]" antipattern
- Open