Wake up backends immediately when sync standbys decrease - Mailing list pgsql-hackers

From Shinya Kato
Subject Wake up backends immediately when sync standbys decrease
Date
Msg-id CAOzEurSRii0tEYhu5cePmRcvS=ZrxTLEvxm3Kj0d7_uKGdM23g@mail.gmail.com
Whole thread Raw
Responses Re: Wake up backends immediately when sync standbys decrease
List pgsql-hackers
Hi hackers,

I have noticed an issue where backends waiting for synchronous
replication are not woken up immediately when the number of required
synchronous standbys is reduced in a multiple synchronous standby
environment.

When synchronous_standby_names is updated to require fewer standbys
(for example, changing from "FIRST 2 (s1, s2)" to "FIRST 1 (s1)"), the
backends currently waiting for replication remain blocked even after a
config reload (SIGHUP). They are only released when a new message
eventually arrives from a standby, despite the fact that the new
requirements are already satisfied.

The attached patch adds SyncRepReleaseWaiters() calls within
walsender.c immediately after the configuration is reloaded and
SyncRepInitConfig() is called. This ensures that any backends whose
waiting conditions are now met by the new configuration are released
without unnecessary delay.

Thoughts?

-- 
Best regards,
Shinya Kato
NTT OSS Center

Attachment

pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: Improve pg_sync_replication_slots() to wait for primary to advance
Next
From: Boris Mironov
Date:
Subject: Re: Idea to enhance pgbench by more modes to generate data (multi-TXNs, UNNEST, COPY BINARY)