The ClearReshardingFilteringMetadata extends from the ReshardingDonorRecipientCommonTest fixture which registers the resharding PrimaryOnlyServices.
The test creates this recipient document, which lacks a FetchTimestamp field. If rebuilding the primary only service reads this state document (when rebuilding on stepup), we'll hit this invariant for lacking a fetchTimestamp.
We can hit this failure if the two conditions are met:
- The unittest runs before RecipientStateMachine onStepUp is run. (such that it would see the bad document).
- The RecipientStateMachine onStepUp method is run prior to the unittest completion which triggers POS::onShutDown (which would cause the onStepUp to cooperatively early-exit prior to hitting the invariant).