Skip to content

Conversation

rkistner
Copy link
Contributor

@rkistner rkistner commented Sep 17, 2025

Fixes a regression introduced in #315 / 1.14.0.

#315 introduced compacting for parameter storage, and switched to using snapshot queries associated with the checkpoint lookups. The snapshots typically give us around 5 minutes from the time we get the checkpoint until the time we do the parameter lokoups.

There is an edge case:

  1. One or more connections open.
  2. No new data replicated (no new checkpoints).
  3. After 5+ minutes, a new client connects.
  4. Parameter queries are configured.

It then uses the same snapshot for the last queried snapshot when doing the parameter queries, resulting in a SnapshotTooOld error:

[PSYNC_S2404] MongoDB server error while evaluating parameter queries: SnapshotTooOld

This fixes it by refreshing the checkpoint once a minute if the checkpoint stream is idle.

Copy link

changeset-bot bot commented Sep 17, 2025

🦋 Changeset detected

Latest commit: c17be72

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-mongodb-storage Patch
@powersync/service-core 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-tests Patch
@powersync/service-module-core Patch
@powersync/service-module-postgres-storage 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

Copy link
Collaborator

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

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

Looks good to me :)

@rkistner rkistner merged commit d976830 into main Sep 19, 2025
21 checks passed
@rkistner rkistner deleted the fix-stale-checkpoint-parameter-queries branch September 19, 2025 07:17
@rkistner
Copy link
Contributor Author

From looking at existing instances affected by this, it seems to mostly affect instances running on AWS RDS or self-hosted Postgres, although I have also seen one MySQL and one Supabase instance affected.

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