Skip to content

Conversation

rkistner
Copy link
Contributor

@rkistner rkistner commented Sep 1, 2025

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:

  1. A partial checksum is already cached.
  2. The query still times out.

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.

Copy link

changeset-bot bot commented Sep 1, 2025

🦋 Changeset detected

Latest commit: 5833e17

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@powersync/service-module-postgres-storage Patch
@powersync/service-module-mongodb-storage Patch
@powersync/service-core-tests Patch
@powersync/service-image Patch
@powersync/service-schema Patch
@powersync/service-module-mongodb Patch
@powersync/service-module-mysql Patch
@powersync/service-module-postgres Patch
@powersync/service-core Patch
@powersync/service-module-core Patch
test-client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rkistner rkistner requested a review from simolus3 September 1, 2025 10:44
Copy link
Contributor

@simolus3 simolus3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look good to me apart from two nits. I also think this make the checksum behavior much easier to understand 👍

@rkistner rkistner merged commit 725daa1 into main Sep 1, 2025
21 checks passed
@rkistner rkistner deleted the checksum-stability branch September 1, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants