Re: Race condition in SyncRepGetSyncStandbysPriority
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: masahiko.sawada@2ndquadrant.com, masao.fujii@oss.nttdata.com,
pgsql-hackers@lists.postgresql.org
Date: 2020-04-14T20:32:40Z
Lists: pgsql-hackers
Attachments
- syncrep-fixes-1.patch (text/x-diff) patch
I wrote: > It doesn't seem to me to be that hard to implement the desired > semantics for synchronous_standby_names with inconsistent info. > In FIRST mode you basically just need to take the N smallest > priorities you see in the array, but without assuming there are no > duplicates or holes. It might be a good idea to include ties at the > end, that is if you see 1,2,2,4 or 1,3,3,4 and you want 2 sync > standbys, include the first three of them in the calculation until > the inconsistency is resolved. In ANY mode I don't see that > inconsistent priorities matter at all. Concretely, I think we ought to do the attached, or something pretty close to it. I'm not really happy about breaking ties based on walsnd_index, but I see that there are several TAP test cases that fail if we do something else. I'm inclined to think those tests are bogus ... but I won't argue to change them right now. regards, tom lane
Commits
-
Fix race conditions in synchronous standby management.
- c65c1aa82105 9.6.18 landed
- f332241a60aa 13.0 landed
- b3fa6d016d82 11.8 landed
- 63ecdaf758c5 10.13 landed
- 00ef5d52c577 12.3 landed
-
When WalSndCaughtUp, sleep only in WalSndWaitForWal().
- 421685812290 13.0 cited