Re: Found issues related with logical replication and 2PC - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Found issues related with logical replication and 2PC
Date
Msg-id CAA4eK1+6N9TE3YOrpNTGtfAnO58nUcbd5q_f4sF7gckwaiLgKQ@mail.gmail.com
Whole thread Raw
In response to Re: Found issues related with logical replication and 2PC  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Found issues related with logical replication and 2PC
List pgsql-hackers
On Wed, Aug 7, 2024 at 3:32 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> I also think so. Additionally, I feel a test case (or some description
> of the bug that can arise) should be provided for issue-1.
>

IIUC, the problem could be that we would end up updating the wrong
local_end LSN in lsn_mappings via store_flush_position(). Then
get_flush_position() could end up computing the wrong flush position
and send the confirmation of flush to the publisher even when it is
not flushed. This ideally could lead to a situation where the prepared
transaction is not flushed to disk on the subscriber and because
publisher would have gotten the confirmation earlier than required, it
won't send the prepared transaction again. I think this theory is not
true for prepare transactions because we always flush WAL of prepare
even for asynchronous commit mode. See EndPrepare(). So, if my
analysis is correct, this shouldn't be a bug and ideally, we should
update local_end LSN as InvalidXLogRecPtr and add appropriate
comments.

--
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Little cleanup of ShmemInit function names
Next
From: Fujii Masao
Date:
Subject: Cross-version Compatibility of postgres_fdw