Re: 001_rep_changes.pl stalls
Noah Misch <noah@leadboat.com>
From: Noah Misch <noah@leadboat.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: masao.fujii@oss.nttdata.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Date: 2020-04-20T07:59:54Z
Lists: pgsql-hackers
On Mon, Apr 20, 2020 at 04:15:40PM +0900, Kyotaro Horiguchi wrote: > At Sat, 18 Apr 2020 00:01:42 -0700, Noah Misch <noah@leadboat.com> wrote in > > On Fri, Apr 17, 2020 at 05:06:29PM +0900, Kyotaro Horiguchi wrote: > > > At Fri, 17 Apr 2020 17:00:15 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in > > > > By the way, if latch is consumed in WalSndLoop, succeeding call to > > > > WalSndWaitForWal cannot be woke-up by the latch-set. Doesn't that > > > > cause missing wakeups? (in other words, overlooking of wakeup latch). > > > > > > - Since the only source other than timeout of walsender wakeup is latch, > > > - we should avoid wasteful consuming of latch. (It is the same issue > > > - with [1]). > > > > > > + Since walsender is wokeup by LSN advancement via latch, we should > > > + avoid wasteful consuming of latch. (It is the same issue with [1]). > > > > > > > > > > If wakeup signal is not remembered on walsender (like > > > > InterruptPending), WalSndPhysical cannot enter a sleep with > > > > confidence. > > > > No; per latch.h, "What must be avoided is placing any checks for asynchronous > > events after WaitLatch and before ResetLatch, as that creates a race > > condition." In other words, the thing to avoid is calling ResetLatch() > > without next examining all pending work that a latch would signal. Each > > walsender.c WaitLatch call does follow the rules. > > I didn't meant that, of course. I thought of more or less the same > with moving the trigger from latch to signal then the handler sets a > flag and SetLatch(). If we use bare latch, we should avoid false > entering to sleep, which also makes thinks compolex. I don't understand. If there's a defect, can you write a test case or describe a sequence of events (e.g. at line X, variable Y has value Z)?
Commits
-
In caught-up logical walsender, sleep only in WalSndWaitForWal().
- f246ea3b2a5e 13.0 landed
-
Revert "When WalSndCaughtUp, sleep only in WalSndWaitForWal()."
- 72a3dc321d76 13.0 landed
-
Add a wait_for_catchup() before immediate stop of a test master.
- b33ac1a65884 11.8 landed
- ab7699e86c16 10.13 landed
- 30afff385dd2 12.3 landed
- d60cfb6bf2b4 13.0 landed
-
When WalSndCaughtUp, sleep only in WalSndWaitForWal().
- 421685812290 13.0 landed