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

source-postgres: Handle null restart_lsn values #2188

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

willdonnelly
Copy link
Member

@willdonnelly willdonnelly commented Dec 6, 2024

When querying replication slot info for an invalidated slot, the restart_lsn column is typically null which resulted in a:

error querying replication slots: can't scan into dest[5]: can not scan <nil> to LSN

warning rather than the intended behavior where the query itself succeeds and because wal_status == 'lost' we instead warn that:

replication slot was invalidated by the server, it must be deleted and all bindings backfilled

Note that in either case this is currently just a warning and the actual error today is still:

runTransactions: readMessage: error creating replication stream: unable to start replication: ERROR: cannot read from logical replication slot "flow_slot" (SQLSTATE 55000)

I would like to get the logic working reliably in warn-mode before we make it a hard error, for obvious reasons.


This change is Reviewable

When querying replication slot info for an invalidated slot, the
`restart_lsn` column is typically null which resulted in a:

```
error querying replication slots: can't scan into dest[5]: can not scan <nil> to LSN
```

warning rather than the intended behavior where the query itself
succeeds and because `wal_status == 'lost'` we instead warn that:

```
replication slot was invalidated by the server, it must be deleted and all bindings backfilled
```

Note that in either case this is currently just a warning and the
actual error today is still:

```
runTransactions: readMessage: error creating replication stream: unable to start replication: ERROR: cannot read from logical replication slot "flow_slot" (SQLSTATE 55000)
```

I would like to get the logic working reliably in warn-mode before we
make it a hard error, for obvious reasons.
@willdonnelly willdonnelly requested a review from a team December 6, 2024 18:53
Copy link
Contributor

@Alex-Bair Alex-Bair left a comment

Choose a reason for hiding this comment

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

LGTM

@willdonnelly willdonnelly merged commit bd2f944 into main Dec 6, 2024
53 checks passed
@willdonnelly willdonnelly deleted the wgd/postgres-slot-invalidation-20241206 branch December 6, 2024 21:40
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