Re: Found issues related with logical replication and 2PC

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Found issues related with logical replication and 2PC
Date: 2024-08-08 12:23:22
Message-ID: CAA4eK1L2VUQB0Vb-ejROLDoGKYTnYRfwkWjuQSq61BP3jHdepw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 8, 2024 at 2:37 PM Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Thanks for discussing!
>
> I reported the issue because 1) I feared the risk of data loss and 2) simply
> because the coding looked incorrect. However, per discussion, I understood that
> it wouldn't lead to loss, and adding a global variable was unacceptable in this
> case. I modified the patch completely.
>
> The attached patch avoids using the LastCommitLSN as the local_lsn while applying
> PREPARE. get_flush_position() was not changed. Also, it contains changes that
> have not been discussed yet:
>
> - Set last_commit_end to InvaldXLogPtr in the PREPARE case.
> This causes the same result as when the stream option is not "parallel."
> - XactLastCommitEnd was replaced even ROLLBACK PREPARED case.
> Since the COMMIT PREPARED record is flushed in RecordTransactionAbortPrepared(),
> there is no need to ensure the WAL must be sent.
>

The code changes look mostly good to me. I have changed/added a few
comments in the attached modified version.

--
With Regards,
Amit Kapila.

Attachment Content-Type Size
v3-0001-Change-the-misleading-local-end_lsn-for-prepared-.patch application/octet-stream 3.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-08-08 12:38:11 Re: [bug fix] prepared transaction might be lost when max_prepared_transactions is zero on the subscriber
Previous Message Abdoulaye Ba 2024-08-08 12:18:14 PATCH: Add hooks for pg_total_relation_size and pg_indexes_size