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 confirmed_flush_lsn #2436

Merged
merged 1 commit into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion source-postgres/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type replicationSlotInfo struct {
SlotType string
Active bool
RestartLSN *pglogrepl.LSN
ConfirmedFlushLSN pglogrepl.LSN
ConfirmedFlushLSN *pglogrepl.LSN
WALStatus string
}

Expand Down
4 changes: 3 additions & 1 deletion source-postgres/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ func (db *postgresDatabase) ReplicationStream(ctx context.Context, startCursor s
logrus.WithField("slot", slot).Warn("replication slot is already active (is another capture already running against this database?)")
} else if slotInfo.WALStatus == "lost" {
logrus.WithField("slot", slot).Warn("replication slot was invalidated by the server, it must be deleted and all bindings backfilled")
} else if startLSN < slotInfo.ConfirmedFlushLSN {
} else if slotInfo.ConfirmedFlushLSN == nil {
logrus.WithField("slot", slot).Warn("replication slot has no confirmed_flush_lsn and is likely still being created (but waiting on a long-running transaction)")
} else if startLSN < *slotInfo.ConfirmedFlushLSN {
logrus.WithFields(logrus.Fields{
"slot": slot,
"confirmedLSN": slotInfo.ConfirmedFlushLSN.String(),
Expand Down
Loading