Improve compacting & checksum pre-calculations #396
Merged
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.
Checksum pre-calculations
We occasionally see this error in the checksum pre-calculation step after the initial snapshot completed:
[Processing Sync Rules] [PSYNC_S2403] Query timed out while reading checksums. The pre-calculation roughly worked as follows:In certain scenarios under high load, especially if the documents themselves are large, a checksum query can timeout. And if any of the smaller batches time out, the entire larger batch is restarted.
This improves the process in two ways:
This is not a guaranteed fix, but should reduce the timeouts.
Compacting buckets
#375 introduced a change to only compact buckets with changes. However, the change in logic had another side-effect: If buckets are modified while the compact process is running, they could be repeatedly re-compacted, resulting in the compact process never finishing.
This changes the logic to:
This logic may also need further tweaks over time as we get more real-world usage data.