-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue a checkpoint when head revision moved outside an application tr…
…ansaction it's possible for `pg_current_snapshot()` (used for HeadRevision) in PG to return a new xmin:xmax outside of application transactions. For example, running `ANALYZE;` could bump it. In this situation, we need to emit a Checkpoint, in case clients triggered a call to Watch API based on a different HeadRevision from what they had cached locally (e.g. relevant to compute change deltas between revisions). The proposal is to compute head revision in the same transaction where we compute new revisions, but only if checkpoints were requested as an optimization. If the transaction determines there are no new SpiceDB transactions, we return the compute head revision, if and only if checkpoints were requested. This Watch API poll loop into 2 queries instead of 1, which can add an extra load to the database, but at least it only happens when checkpoints are being requested.
- Loading branch information
1 parent
880b536
commit 74dc7b2
Showing
3 changed files
with
131 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters