Skip to content

Commit

Permalink
source-postgres: Handle null restart_lsn values
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
willdonnelly committed Dec 6, 2024
1 parent d2e6452 commit bd2f944
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion source-postgres/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type replicationSlotInfo struct {
Plugin string
SlotType string
Active bool
RestartLSN pglogrepl.LSN
RestartLSN *pglogrepl.LSN
ConfirmedFlushLSN pglogrepl.LSN
WALStatus string
}
Expand Down

0 comments on commit bd2f944

Please sign in to comment.