mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
repmgrd: check "repmgr" extension is installed before starting
Implements GitHub #361.
This commit is contained in:
@@ -3391,8 +3391,11 @@ check_source_server()
|
||||
{
|
||||
if (!runtime_options.force)
|
||||
{
|
||||
/* this is unlikely to happen */
|
||||
if (extension_status == REPMGR_UNKNOWN)
|
||||
{
|
||||
log_error(_("unable to determine status of \"repmgr\" extension"));
|
||||
log_detail("%s", PQerrorMessage(primary_conn));
|
||||
PQfinish(source_conn);
|
||||
exit(ERR_DB_QUERY);
|
||||
}
|
||||
@@ -3407,10 +3410,10 @@ check_source_server()
|
||||
}
|
||||
else if (extension_status == REPMGR_UNAVAILABLE)
|
||||
{
|
||||
log_detail(_("repmgr extension is not available on the upstream server"));
|
||||
log_detail(_("repmgr extension is not available on the upstream node"));
|
||||
}
|
||||
|
||||
log_hint(_("check that the upstream server is part of a repmgr cluster"));
|
||||
log_hint(_("check that the upstream node is part of a repmgr cluster"));
|
||||
PQfinish(source_conn);
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
32
repmgrd.c
32
repmgrd.c
@@ -89,6 +89,7 @@ main(int argc, char **argv)
|
||||
bool cli_monitoring_history = false;
|
||||
|
||||
RecordStatus record_status;
|
||||
ExtensionStatus extension_status = REPMGR_UNKNOWN;
|
||||
|
||||
FILE *fd;
|
||||
|
||||
@@ -318,6 +319,37 @@ main(int argc, char **argv)
|
||||
* repmgr has not been properly configured.
|
||||
*/
|
||||
|
||||
/* Check "repmgr" the extension is installed */
|
||||
extension_status = get_repmgr_extension_status(local_conn);
|
||||
|
||||
if (extension_status != REPMGR_INSTALLED)
|
||||
{
|
||||
/* this is unlikely to happen */
|
||||
if (extension_status == REPMGR_UNKNOWN)
|
||||
{
|
||||
log_error(_("unable to determine status of \"repmgr\" extension"));
|
||||
log_detail("%s", PQerrorMessage(local_conn));
|
||||
PQfinish(local_conn);
|
||||
exit(ERR_DB_QUERY);
|
||||
}
|
||||
|
||||
log_error(_("repmgr extension not found on this node"));
|
||||
|
||||
if (extension_status == REPMGR_AVAILABLE)
|
||||
{
|
||||
log_detail(_("repmgr extension is available but not installed in database \"%s\""),
|
||||
PQdb(local_conn));
|
||||
}
|
||||
else if (extension_status == REPMGR_UNAVAILABLE)
|
||||
{
|
||||
log_detail(_("repmgr extension is not available on this node"));
|
||||
}
|
||||
|
||||
log_hint(_("check that this node is part of a repmgr cluster"));
|
||||
PQfinish(local_conn);
|
||||
exit(ERR_BAD_CONFIG);
|
||||
}
|
||||
|
||||
/* Retrieve record for this node from the local database */
|
||||
record_status = get_node_record(local_conn, config_file_options.node_id, &local_node_info);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user