Re: [HACKERS] logical decoding of two-phase transactions - Mailing list pgsql-hackers

From Masahiko Sawada
Subject Re: [HACKERS] logical decoding of two-phase transactions
Date
Msg-id CAD21AoD5mzZScaGPr0fDfG2WmYYrmf64=Dr2anaQc6ak7O52-A@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] logical decoding of two-phase transactions  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: [HACKERS] logical decoding of two-phase transactions
List pgsql-hackers
Hi,

On Mon, Aug 9, 2021 at 12:00 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
>
> On Wed, Aug 4, 2021 at 4:14 PM Amit Kapila <amit.kapila16@gmail.com> wrote:
> >
> > I have pushed this last patch in the series.
> >
>
> I have closed this CF entry. Thanks to everyone involved in this work!
>

I have a questoin about two_phase column of pg_replication_slots view:
with this feature, pg_replication_slots has a new column two_phase:

             View "pg_catalog.pg_replication_slots"
       Column        |  Type   | Collation | Nullable | Default
---------------------+---------+-----------+----------+---------
 slot_name           | name    |           |          |
 plugin              | name    |           |          |
 slot_type           | text    |           |          |
 datoid              | oid     |           |          |
 database            | name    |           |          |
 temporary           | boolean |           |          |
 active              | boolean |           |          |
 active_pid          | integer |           |          |
 xmin                | xid     |           |          |
 catalog_xmin        | xid     |           |          |
 restart_lsn         | pg_lsn  |           |          |
 confirmed_flush_lsn | pg_lsn  |           |          |
 wal_status          | text    |           |          |
 safe_wal_size       | bigint  |           |          |
 two_phase           | boolean |           |          |

According to the doc, the two_phase field has:

True if the slot is enabled for decoding prepared transactions. Always
false for physical slots.

It's unnatural a bit to me that replication slots have such a property
since the replication slots have been used to protect WAL and tuples
that are required for logical decoding, physical replication, and
backup, etc from removal. Also, it seems that even if a replication
slot is created with two_phase = off, it's overwritten to on if the
plugin enables two-phase option. Is there any reason why we can turn
on and off this value on the replication slot side and is there any
use case where the replication slot’s two_phase is false and the
plugin’s two-phase option is on and vice versa? I think that we can
have replication slots always have two_phase_at value and remove the
two_phase field from the view.

Regards,

--
Masahiko Sawada
EDB:  https://www.enterprisedb.com/



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Allow escape in application_name
Next
From: wenjing zeng
Date:
Subject: Re: why does reindex invalidate relcache without modifying system tables