-
Type:
Task
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Integration
-
Fully Compatible
-
200
-
None
-
None
-
None
-
None
-
None
-
None
-
None
reopenFetchedBucket and reopenQueriedBucket dispatch internal DBDirectClient commands with rawData: true on the outer opCtx. rpc::readRequestMetadata sets isRawDataOperation(opCtx) = true as a side effect and never resets it. This contaminates the opCtx for the lifetime of the outer INSERT command.
This is normally harmless, but if the outer INSERT gets a StaleConfig error after the reopening runs and the service entry point retries the command on the same opCtx, isTimeseriesLogicalRequest evaluates to false on the retry (since isRawDataOperation is still true). The retry then calls performInserts directly with the user's measurement documents rather than going through performTimeseriesWrites, producing a DocumentValidationFailure (code 121).
The fix saves and restores isRawDataOperation around the DBDirectClient calls in both reopen functions using ScopeGuard. Note that this is a narrow fix - it doesn't change any observable behavior for the DBDirectClient calls themselves, it just prevents the flag from leaking out.