From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | "Maksim(dot)Melnikov" <m(dot)melnikov(at)postgrespro(dot)ru> |
Cc: | Kirill Reshke <reshkekirill(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: sync_standbys_defined read/write race on startup |
Date: | 2025-04-10 09:15:37 |
Message-ID: | Z_eMOVsxebE6X4--@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Apr 10, 2025 at 10:12:34AM +0300, Maksim.Melnikov wrote:
> but I am afraid we are loosing this.
>
> if (WalSndCtl->sync_standbys_status & SYNC_STANDBY_INIT)
> {
> if ((WalSndCtl->sync_standbys_status & SYNC_STANDBY_DEFINED) == 0 ||
> lsn <= WalSndCtl->lsn[mode])
> {
> LWLockRelease(SyncRepLock);
> return;
> }
> }
> [...]
> + else if (lsn <= WalSndCtl->lsn[mode])
> + {
> + LWLockRelease(SyncRepLock);
> + return;
> + }
>
> What do you think?
Hmm, yeah. Instead of last, it would be better to put it in second
place perhaps, for clarity? That would be the same at the end, but we
would be slightly more consistent with the past logic regarding the
ordering. Does that look OK to you?
--
Michael
Attachment | Content-Type | Size |
---|---|---|
v6-0001-Fix-sync_standbys_defined-race-on-startup.patch | text/x-diff | 9.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2025-04-10 09:43:55 | Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided. |
Previous Message | jian he | 2025-04-10 08:57:20 | wrong comments in rewriteTargetListIU |