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: Don't use IDENTIFY_SYSTEM #2430

Merged
merged 1 commit into from
Feb 19, 2025
Merged
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
11 changes: 4 additions & 7 deletions source-postgres/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,12 @@ func (db *postgresDatabase) ReplicationStream(ctx context.Context, startCursor s
logrus.WithField("err", err).Debug("error recreating replication slot")
}

// Obtain the current WAL flush location via an IDENTIFY_SYSTEM command.
// Note: We use IDENTIFY_SYSTEM here for legacy reasons, it might be cleaner
// to get this information from the newly-recreated slot's confirmed_flush_lsn
// now that we do it that way.
var sysident, err = pglogrepl.IdentifySystem(ctx, conn)
// Obtain the current WAL flush location on the server and initialize the cursor to that point.
var flushLSN, err = queryLatestServerLSN(ctx, db.conn)
if err != nil {
return nil, fmt.Errorf("unable to read WAL flush LSN from database: %w", err)
return nil, fmt.Errorf("unable to initialize cursor to current server LSN: %w", err)
}
startLSN = sysident.XLogPos
startLSN = flushLSN
}

// Check that the slot's `confirmed_flush_lsn` is less than or equal to our resume cursor value.
Expand Down
Loading