Skip to content

Commit

Permalink
try see if conn closed earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Feb 15, 2024
1 parent 1183f84 commit 3bc529b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions flow/connectors/postgres/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ func (p *PostgresCDCSource) PullRecords(ctx context.Context, req *model.PullReco
waitingForCommit := false

for {
_, err := p.getCurrentLSN(ctx)
if err != nil {
return fmt.Errorf("!!! current LSN: %w", err)
}

if pkmRequiresResponse {
err := pglogrepl.SendStandbyStatusUpdate(ctx, conn,
pglogrepl.StandbyStatusUpdate{WALWritePosition: consumedXLogPos})
Expand Down
6 changes: 6 additions & 0 deletions flow/connectors/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,12 @@ func (c *PostgresConnector) PullRecords(ctx context.Context, catalogPool *pgxpoo
if err != nil {
return err
}

_, err = c.getCurrentLSN(ctx)
if err != nil {
return fmt.Errorf("??? current LSN: %w", err)
}

req.RecordStream.Close()
c.replState.Offset = req.RecordStream.GetLastCheckpoint()

Expand Down

0 comments on commit 3bc529b

Please sign in to comment.