From: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
---|---|
To: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com> |
Subject: | Re: promotion related handling in pg_sync_replication_slots() |
Date: | 2024-04-16 04:30:04 |
Message-ID: | CAJpy0uAd359z-3dmf4=NC7jzpZ6SHSYV0jQZByMAX4E6TPHHjg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Apr 16, 2024 at 9:27 AM Zhijie Hou (Fujitsu)
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Monday, April 15, 2024 6:09 PM shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
> >
> > Please find v4 addressing the above comments.
>
> Thanks for the patch.
>
> Here are few comments:
Thanks for reviewing the patch.
>
> 1.
>
> + ereport(ERROR,
> + errmsg("promotion in progress, can not synchronize replication slots"));
> + }
>
> I think an errcode is needed.
>
> The style of the error message seems a bit unnatural to me. I suggest:
> "cannot synchronize replication slots when standby promotion is ongoing"
Modified.
>
> 2.
>
> + if (worker_pid != InvalidPid)
> + Assert(SlotSyncCtx->pid == InvalidPid);
>
> We could merge the checks into one Assert().
> Assert(SlotSyncCtx->pid == InvalidPid || worker_pid == InvalidPid);
Modified.
>
> 3.
>
> - pqsignal(SIGINT, SignalHandlerForShutdownRequest);
>
> I realized that we should register this before setting SlotSyncCtx->pid,
> otherwise if the standby is promoted after setting pid and before registering
> signal handle function, the slotsync worker could miss to handle SIGINT sent by
> startup process(ShutDownSlotSync). This is an existing issue for slotsync
> worker, but maybe we could fix it together with the patch.
Yes, it seems like a problem. Fixed it. Also to be consistent, moved
other signal handlers' registration as well before we set pid.
Please find v5 addressing above comments.
thanks
Shveta
Attachment | Content-Type | Size |
---|---|---|
v5-0001-Handle-stopSignaled-during-sync-function-call.patch | application/octet-stream | 10.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2024-04-16 04:44:23 | Re: Time to back-patch libxml deprecation fixes? |
Previous Message | David Rowley | 2024-04-16 04:24:33 | Re: Differential code coverage between 16 and HEAD |