At Fri, 8 Nov 2019 16:08:47 +0300, Grigory Smolkin <g.smol...@postgrespro.ru> wrote in > While working on it, I stumbled upon something strange: > > why DisownLatch(&XLogCtl->recoveryWakeupLatch) is called before > ReadRecord(xlogreader, LastRec, PANIC, false) ? > Isn`t this latch may be accessed in WaitForWALToBecomeAvailable() if > streaming standby gets promoted?
The DisownLatch is just for the sake of tidiness and can be placed anywhere after the ShutdownWalRcv() call but the current place (just before "StandbyMode = false") seems natural. The ReadRecord call doesn't launch another wal receiver because we cleard StandbyMode just before. regards. -- Kyotaro Horiguchi NTT Open Source Software Center