Hi hackers,

When we enable hot standby, HotStandbyActive() returns true on hot standby.
Then, we promote the hot standby, the SHM variable 
`XLogCtl->SharedHotStandbyActive`
remains true. So, HotStandbyActive() still returns true until the next call of
`XLOGShmemInit()` even if the data node was promoted.
`XLogWalRcvSendHSFeedback()` is the only caller of HotStandbyActive,
it's probably not covered by the test cases.

Is it the expected behavior or a bug in postgres? Probably a bug.
I haven't much knowledge of hot-standby, a simple fix might be
to set XLogCtl->SharedHotStandbyActive to false when
the recovery process almost finishes. See the attachment.

Regards,
Hao Wu

Attachment: fix-hot-standby.diff
Description: fix-hot-standby.diff

Reply via email to