Prevent "invalid LSN returned from node..." infinite loop

Currently in repmgrd3, if a repmgrd enters failover, but one or more other
repmgrds do not (e.g. partial primary invisibility), the repmgrd in failover
may enter an infinite loop waiting for the repmgrd(s) not in failover to
update shared memory.
This commit is contained in:
Ian Barwick
2019-02-21 14:18:50 +09:00
parent a4f572a1ff
commit 24a354c0a7
4 changed files with 82 additions and 29 deletions

View File

@@ -4201,27 +4201,13 @@ stop_backup:
exit(retval);
}
static void
parse_lsn(XLogRecPtr *ptr, const char *str)
{
uint32 high, low;
if (sscanf(str, "%x/%x", &high, &low) != 2)
return;
*ptr = (((XLogRecPtr)high) << 32) + (XLogRecPtr)low;
return;
}
static XLogRecPtr
parse_label_lsn(const char *label_key, const char *label_value)
{
XLogRecPtr ptr = InvalidXLogRecPtr;
XLogRecPtr ptr = parse_lsn(label_value);
parse_lsn(&ptr, label_value);
/* parse_lsn() will not modify ptr if it can't parse the label value */
/* parse_lsn() will return InvalidXLogRecPtr if it can't parse the label value */
if (ptr == InvalidXLogRecPtr)
{
log_err(_("Couldn't parse backup label entry \"%s: %s\" as lsn"),