Logical replication origin tracking fix

Started by Petr Jelinekalmost 9 years ago3 messages
#1Petr Jelinek
Petr Jelinek
petr.jelinek@2ndquadrant.com
1 attachment(s)

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.patch
#2Petr Jelinek
Petr Jelinek
petr.jelinek@2ndquadrant.com
In reply to: Petr Jelinek (#1)
1 attachment(s)
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:

0001-Fix-remote-position-tracking-in-logical-replication.patchtext/x-patch; name=0001-Fix-remote-position-tracking-in-logical-replication.patch
#3Peter Eisentraut
Peter Eisentraut
peter.eisentraut@2ndquadrant.com
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