If the standby was streaming when trigger file arrives, check also in the
archive for additional WAL files. This is a corner case since it is
unlikely that we would trigger a failover while the master is still
available and sending data to standby, while at the same time running in
archive mode and also while the streaming standby has fallen behind archive.
Someone would eventually be unlucky; we must plug all gaps however small.
Fujii Masao
* five seconds like in the WAL file polling case below.
*/
if (CheckForStandbyTrigger())
- goto triggered;
+ goto retry;
/*
* Wait for more WAL to arrive, or timeout to be reached
CheckForStandbyTrigger(void)
{
struct stat stat_buf;
+ static bool triggered = false;
+
+ if (triggered)
+ return true;
if (TriggerFile == NULL)
return false;
(errmsg("trigger file found: %s", TriggerFile)));
ShutdownWalRcv();
unlink(TriggerFile);
+ triggered = true;
return true;
}
return false;