mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
Fix CLUSTER CLEANUP, it needs to establish a local connection in order
to look for the master
This commit is contained in:
9
repmgr.c
9
repmgr.c
@@ -423,19 +423,26 @@ do_cluster_show(void)
|
||||
do_cluster_cleanup(void)
|
||||
{
|
||||
int master_id;
|
||||
PGconn *conn = NULL;
|
||||
PGconn *master_conn = NULL;
|
||||
PGresult *res;
|
||||
char sqlquery[QUERY_STR_LEN];
|
||||
|
||||
/* We need to connect to check configuration */
|
||||
log_info(_("%s connecting to database\n"), progname);
|
||||
conn = establishDBConnection(options.conninfo, true);
|
||||
|
||||
/* check if there is a master in this cluster */
|
||||
log_info(_("%s connecting to master database\n"), progname);
|
||||
master_conn = getMasterConnection(master_conn, repmgr_schema, options.cluster_name,
|
||||
master_conn = getMasterConnection(conn, repmgr_schema, options.cluster_name,
|
||||
&master_id, NULL);
|
||||
if (!master_conn)
|
||||
{
|
||||
log_err(_("cluster cleanup: cannot connect to master\n"));
|
||||
PQfinish(conn);
|
||||
exit(ERR_DB_CON);
|
||||
}
|
||||
PQfinish(conn);
|
||||
|
||||
if (runtime_options.keep_history > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user