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 how flush_pos is compared to commit_lsn. #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VadimPushtaev
Copy link

When we logically replicate the message with LSN equal to exactly X, we need to wait for flush_pos of other replicas to become strictly greater than X, not greater or equal.

Both restart_lsn and confirmed_flush represent the oldest LSN that must still be kept so it can still be replicated. That means that it might NOT yet be replicated.

--

I made some trivial experiment to check how pg_failover_slots.standby_slot_names behaves and noticed that my logical replica always gets one extra record when the physical replica becomes unavailable. With this fix it works as expected: logical replica is never delayed more then necessary, but no records that were not replicated to physical replica are replicated to the logical one.

When we logically replicate the message with LSN equal to exactly X,
we need to wait for `flush_pos` of other replicas to become strictly
greater than X, not greater or equal.

Both `restart_lsn` and `confirmed_flush` represent the oldest LSN
that must still be kept so it can still be replicated. That means
that it might NOT yet be replicated.
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.

1 participant