-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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] : Advance Postgres LSN for PG 14 & below #33605
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
Before Merging a Connector Pull RequestWow! What a great pull request you have here! 🎉 To merge this PR, ensure the following has been done/considered for each connector added or updated:
If the checklist is complete, but the CI check is failing,
|
Coverage report for source-postgres
|
// Attempt to advance LSN past the target position. For versions of Postgres before PG15, this | ||
// ensures that there is an event that debezium will | ||
// receive that is after the target LSN. | ||
PostgresUtils.advanceLsn(database); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we make that only execute on postgres <15 ? That allows us to request less access right post 15, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't have the correct access, we'll just fail in the advanceLsn
method and log that scenario. Success/failure of this advancement should not block the sync from proceeding.
For PG14, the query that I've added in this PR requires no additional permissions. For PG15+, this same query will just fail because of permissions issues and move on.
Phase 2 hopes to address this with additional steps for the user to setup a heartbeat table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change will make things better for 14 and below.
But for 15 and above even if we can make this query, it will not be effective in bumping the LSN.
So maybe it makes sense to avoid a constant error or questions from customers about it.
We already have code doing "legacy" ctid for postgres <14.
You can utilize that function to do things <15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See CtidUtils.isTidRangeScanCapableDBServer()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a check
// Attempt to advance LSN past the target position. For versions of Postgres before PG15, this | ||
// ensures that there is an event that debezium will | ||
// receive that is after the target LSN. | ||
PostgresUtils.advanceLsn(database); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this there is no need to ever wait for a timeout as we know the WAL got past target lsn.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true - however I did want to protect against cases where this query fails for whatever reason
Context : https://docs.google.com/document/d/1LLRQ6bCLI8dE1yXzU_GCssDLJBb-ZD-0P97gd3RtRdE/edit
Closes #33426
Local testing : https://www.loom.com/share/c3d98f792e7d44c3a30ecf986fc8958c