Re: Minimal logical decoding on standbys

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Ibrar Ahmed <ibrar(dot)ahmad(at)gmail(dot)com>, Amit Khandekar <amitdkhan(dot)pg(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, Rahila Syed <rahila(dot)syed(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Minimal logical decoding on standbys
Date: 2023-04-04 09:47:46
Message-ID: af8a1fa2-c039-3c76-3614-d0ecb7767df5@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 4/4/23 9:48 AM, Masahiko Sawada wrote:
> On Tue, Apr 4, 2023 at 10:55 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>>
>>
>> Regarding 0004 patch:
>>
>> @@ -2626,6 +2626,12 @@ InitWalSenderSlot(void)
>> walsnd->sync_standby_priority = 0;
>> walsnd->latch = &MyProc->procLatch;
>> walsnd->replyTime = 0;
>> +
>> + if (MyDatabaseId == InvalidOid)
>> + walsnd->kind = REPLICATION_KIND_PHYSICAL;
>> + else
>> + walsnd->kind = REPLICATION_KIND_LOGICAL;
>> +
>>
>> I think we might want to set the replication kind when processing the
>> START_REPLICATION command. The walsender using a logical replication
>> slot is not necessarily streaming (e.g. when COPYing table data).
>>
>
> Discussing with Bertrand off-list, it's wrong as the logical
> replication slot creation also needs to read WAL records so a
> walsender who is creating a logical replication slot needs to be woken
> up. We can set it the replication kind when processing
> START_REPLICATION and CREATE_REPLICATION_SLOT, but it seems better to
> set it in one place. So I agree to set it in InitWalSenderSlot().
>

Thanks for the review and feedback!
Added a comment in 0004 in V58 just posted up-thread to explain the reason
why the walsnd->kind assignment is done InitWalSenderSlot().

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Borisov 2023-04-04 09:57:45 Re: [PATCH] Clarify the behavior of the system when approaching XID wraparound
Previous Message Drouvot, Bertrand 2023-04-04 09:42:45 Re: Minimal logical decoding on standbys