[MongoDB Storage] Checksum calculation improvements #346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up to #343. That PR implemented a "fallback" query when the checksum query timed out, which would then query each bucket individually, and limit the number of operations we aggregate on for each bucket. That approach is less likely to time out, but slower when there are many buckets.
This now merges the two approaches: We always limit the number of operations we're aggregating on, but still do the query across multiple buckets at a time. This reduces the worst-case runtime, since we don't have to wait for the first query to timeout, and can handle multiple buckets efficiently.
This fixes a specific bug in the old approach (regression in 1.15.1): The fallback query did not handle the case correctly where we already have a partial checksum for a bucket, which could result in an incorrect checksum being returned and cached. It should have been rare since it would only happen when both:
Since the query is much less likely to time out when we have partial checksums available, it should not be common.
This also adds a couple additional tests (which would have failed with the bug above), and splits some of the larger test files into smaller ones.