Skip to content

Commit

Permalink
fix: namespace/caveat changes cause an incorrect delete event
Browse files Browse the repository at this point in the history
the computation of schema change events was incorrect due to
the use of the wrong snapshot XID for changed namespaces / caveats.
It manifested itself as a change event, followed by a delete event.
  • Loading branch information
vroldanbet committed Nov 29, 2024
1 parent a5e5087 commit 369286e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/datastore/postgres/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ func (pgd *pgDatastore) loadNamespaceChanges(ctx context.Context, xmin uint64, x
}

if _, found := filter[createdXID.Uint64]; found {
err := tracked.AddChangedDefinition(ctx, txidToRevision[deletedXID.Uint64], loaded)
err := tracked.AddChangedDefinition(ctx, txidToRevision[createdXID.Uint64], loaded)
if err != nil {
return err
}
Expand Down Expand Up @@ -514,7 +514,7 @@ func (pgd *pgDatastore) loadCaveatChanges(ctx context.Context, xmin uint64, xmax
}

if _, found := filter[createdXID.Uint64]; found {
err := tracked.AddChangedDefinition(ctx, txidToRevision[deletedXID.Uint64], loaded)
err := tracked.AddChangedDefinition(ctx, txidToRevision[createdXID.Uint64], loaded)
if err != nil {
return err
}
Expand Down

0 comments on commit 369286e

Please sign in to comment.