RE: promotion related handling in pg_sync_replication_slots()

From: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
To: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: promotion related handling in pg_sync_replication_slots()
Date: 2024-04-16 03:57:44
Message-ID: OS0PR01MB5716BD38012C29E9D9EC2E0F94082@OS0PR01MB5716.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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:

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"

2.

+ if (worker_pid != InvalidPid)
+ Assert(SlotSyncCtx->pid == InvalidPid);

We could merge the checks into one Assert().
Assert(SlotSyncCtx->pid == InvalidPid || worker_pid == InvalidPid);

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.

Best Regards,
Hou zj

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2024-04-16 04:16:18 Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)
Previous Message Tom Lane 2024-04-16 03:56:40 Re: Time to back-patch libxml deprecation fixes?