Logical replication origin tracking fix

Started by Petr Jelinekover 9 years ago3 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t36223
psql -h localhost -U postgres

Built from patchset v2 (message #2), July 28, 2026 at 07:35 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t36223_2 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t36223_2 && git checkout t36223_2

Patchset v2 (message #2) is on t36223_2

Jump to latest
#1Petr Jelinek
petr@2ndquadrant.com

Hi,

while discussing with Craig issues around restarting logical replication
stream related to the patch he posted [1]/messages/by-id/CAMsr+YGFvikx-U_mHQ0mAzTarqvCpwzvsPKv=7MfP9scDrMPjg@mail.gmail.com, I realized that we track
wrong origin LSN in the logical replication apply.

We currently track commit_lsn which is *start* of commit record, what we
need to track is end_lsn which is *end* of commit record otherwise we
might request transaction that was already replayed if the subscription
instance has crashed right after commit.

Attached patch fixes that.

[1]: /messages/by-id/CAMsr+YGFvikx-U_mHQ0mAzTarqvCpwzvsPKv=7MfP9scDrMPjg@mail.gmail.com
/messages/by-id/CAMsr+YGFvikx-U_mHQ0mAzTarqvCpwzvsPKv=7MfP9scDrMPjg@mail.gmail.com

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

0001-Fix-remote-position-tracking-in-logical-replication.patchbinary/octet-stream; name=0001-Fix-remote-position-tracking-in-logical-replication.patchDownload+7-7
#2Petr Jelinek
petr@2ndquadrant.com
In reply to: Petr Jelinek (#1)
Re: Logical replication origin tracking fix

On 10/03/17 05:59, Petr Jelinek wrote:

Hi,

while discussing with Craig issues around restarting logical replication
stream related to the patch he posted [1], I realized that we track
wrong origin LSN in the logical replication apply.

We currently track commit_lsn which is *start* of commit record, what we
need to track is end_lsn which is *end* of commit record otherwise we
might request transaction that was already replayed if the subscription
instance has crashed right after commit.

Attached patch fixes that.

Rebase after table copy patch got committed.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachments:

t36223_2
0001-Fix-remote-position-tracking-in-logical-replication.patchtext/x-patch; name=0001-Fix-remote-position-tracking-in-logical-replication.patchDownload+7-7
#3Peter Eisentraut
peter_e@gmx.net
In reply to: Petr Jelinek (#2)
Re: Logical replication origin tracking fix

On 3/24/17 10:48, Petr Jelinek wrote:

On 10/03/17 05:59, Petr Jelinek wrote:

while discussing with Craig issues around restarting logical replication
stream related to the patch he posted [1], I realized that we track
wrong origin LSN in the logical replication apply.

We currently track commit_lsn which is *start* of commit record, what we
need to track is end_lsn which is *end* of commit record otherwise we
might request transaction that was already replayed if the subscription
instance has crashed right after commit.

Attached patch fixes that.

Rebase after table copy patch got committed.

committed

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers