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

Fix clientXLogPos handling in pglogrepl_demo #59

Merged
merged 1 commit into from
Aug 26, 2023
Merged

Fix clientXLogPos handling in pglogrepl_demo #59

merged 1 commit into from
Aug 26, 2023

Conversation

espadolini
Copy link
Contributor

This PR changes the handling of clientXLogPos to match the one from Postgres' own pg_recvlogical:

  • keepalive messages should bump the position too, as they're only sent (from what I can tell) after any xlogdata message;
  • both the WALStart and the ServerWALEnd in logical xlogdata messages represent the position that should be reported back, and adding the length of the post-decoding data to it is meaningless;
  • relation messages have a position of zero, and in general we should match the pg_recvlogical behavior of only increasing the local position.

@espadolini
Copy link
Contributor Author

As a bonus, this fixes #20 for me; without bumping the local position on keepalive, a shutting down Postgres just keeps spamming my client with keepalive messages for 10 seconds before hard disconnecting the replication connection.

@jackc jackc merged commit 9ed16cb into jackc:master Aug 26, 2023
6 checks passed
@jackc
Copy link
Owner

jackc commented Aug 26, 2023

👍

@espadolini espadolini deleted the clientxlogpos-demo branch August 26, 2023 21:56
iskakaushik added a commit to PeerDB-io/peerdb that referenced this pull request Sep 30, 2023
iskakaushik added a commit to PeerDB-io/peerdb that referenced this pull request Sep 30, 2023
This PR is debugging an issue where schema change propagation (#368)
don't apply properly when there are parallel transactions happening
during an ALTER TABLE statement.

Borrowing from jackc/pglogrepl#59

This PR changes the handling of clientXLogPos to match the one from
Postgres' own `pg_recvlogical`:

- keepalive messages should bump the position too, as they're only sent
(from what I can tell) after any xlogdata message;
- both the WALStart and the ServerWALEnd in logical xlogdata messages
represent the position that should be reported back, and adding the
length of the post-decoding data to it is meaningless;
- relation messages have a position of zero, and in general we should
match the pg_recvlogical behavior of only increasing the local position.

---------

Co-authored-by: Kaushik Iska <iska.kaushik@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants