mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-24 07:36:30 +00:00
fix: fail when repmgr_funcs is not pre-loaded
when repmgr_funcs is not pre-loaded `repmgr_update_standby_location()` will return false and `repmgr_get_last_standby_location()` will return an empty string. Thus we may end in an endless loop. To avoid that we fail.
This commit is contained in:
17
repmgrd.c
17
repmgrd.c
@@ -951,8 +951,18 @@ do_failover(void)
|
||||
}
|
||||
|
||||
if (sscanf(PQgetvalue(res, 0, 0), "%X/%X", &uxlogid, &uxrecoff) != 2)
|
||||
{
|
||||
log_info(_("could not parse transaction log location \"%s\"\n"), PQgetvalue(res, 0, 0));
|
||||
|
||||
/* we can't do anything but fail at this point... */
|
||||
if (*PQgetvalue(res, 0, 0) == '\0')
|
||||
{
|
||||
log_crit("Whoops, seems as if shared_preload_libraries=repmgr_funcs is not set!\n");
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PQclear(res);
|
||||
PQfinish(nodeConn);
|
||||
/* If position is 0/0, keep checking */
|
||||
@@ -1314,6 +1324,13 @@ update_shared_memory(char *last_wal_standby_applied)
|
||||
log_warning(_("Cannot update this standby's shared memory: %s\n"), PQerrorMessage(myLocalConn));
|
||||
/* XXX is this enough reason to terminate this repmgrd? */
|
||||
}
|
||||
else if (strcmp(PQgetvalue(res, 0, 0), "f") == 0)
|
||||
{
|
||||
/* this surely is more than enough reason to exit */
|
||||
log_warning(_("Cannot update this standby's shared memory, maybe shared_preload_libraries=repmgr_funcs is not set?\n"));
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
PQclear(res);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user