Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG: emits Watch API checkpoints outside of changes #2063

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions internal/datastore/postgres/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,6 @@
optionalNanosTimestamp: currentTxn.optionalNanosTimestamp,
}
}

// If checkpoints were requested, output a checkpoint. While the Postgres datastore does not
// move revisions forward outside of changes, these could be necessary if the caller is
// watching only a *subset* of changes.
if options.Content&datastore.WatchCheckpoints == datastore.WatchCheckpoints {
if !sendChange(&datastore.RevisionChanges{
Revision: currentTxn,
IsCheckpoint: true,
}) {
return
}
}
} else {
sleep := time.NewTimer(watchSleep)

Expand All @@ -181,6 +169,18 @@
return
}
}

// If checkpoints were requested, output a checkpoint. While the Postgres datastore does not
// move revisions forward outside of changes, these could be necessary if the caller is
// watching only a *subset* of changes.
if options.Content&datastore.WatchCheckpoints == datastore.WatchCheckpoints {
if !sendChange(&datastore.RevisionChanges{
Revision: currentTxn,
IsCheckpoint: true,
}) {
return
}
}
}
}()

Expand Down Expand Up @@ -402,7 +402,7 @@
return nil
}

func (pgd *pgDatastore) loadCaveatChanges(ctx context.Context, min uint64, max uint64, txidToRevision map[uint64]postgresRevision, filter map[uint64]int, tracked *common.Changes[postgresRevision, uint64]) error {

Check failure on line 405 in internal/datastore/postgres/watch.go

View workflow job for this annotation

GitHub Actions / Lint Go

param min has same name as predeclared identifier (predeclared)
sql, args, err := queryChangedCaveats.Where(sq.Or{
sq.And{
sq.LtOrEq{colCreatedXid: max},
Expand Down
Loading