mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 08:36:30 +00:00
General code cleanup
This commit is contained in:
@@ -1138,7 +1138,11 @@ _get_primary_connection(PGconn *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (PQstatus(remote_conn) != CONNECTION_OK)
|
if (PQstatus(remote_conn) != CONNECTION_OK)
|
||||||
|
{
|
||||||
|
PQfinish(remote_conn);
|
||||||
|
remote_conn = NULL;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
recovery_type = get_recovery_type(remote_conn);
|
recovery_type = get_recovery_type(remote_conn);
|
||||||
|
|
||||||
|
|||||||
@@ -185,13 +185,15 @@ do_primary_register(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Log the event */
|
/* Log the event */
|
||||||
create_event_notification(conn,
|
create_event_notification(
|
||||||
&config_file_options,
|
conn,
|
||||||
config_file_options.node_id,
|
&config_file_options,
|
||||||
"primary_register",
|
config_file_options.node_id,
|
||||||
record_created,
|
"primary_register",
|
||||||
event_description.data);
|
record_created,
|
||||||
|
event_description.data);
|
||||||
|
|
||||||
|
termPQExpBuffer(&event_description);
|
||||||
|
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
|
||||||
|
|||||||
@@ -466,7 +466,7 @@ do_standby_clone(void)
|
|||||||
true,
|
true,
|
||||||
event_details.data);
|
event_details.data);
|
||||||
|
|
||||||
if (PQstatus(primary_conn) == CONNECTION_OK)
|
if (primary_conn != source_conn && PQstatus(primary_conn) == CONNECTION_OK)
|
||||||
PQfinish(primary_conn);
|
PQfinish(primary_conn);
|
||||||
|
|
||||||
if (PQstatus(source_conn) == CONNECTION_OK)
|
if (PQstatus(source_conn) == CONNECTION_OK)
|
||||||
@@ -1108,6 +1108,7 @@ do_standby_promote(void)
|
|||||||
exit(ERR_PROMOTION_FAIL);
|
exit(ERR_PROMOTION_FAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PQfinish(current_primary_conn);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
|
||||||
_do_standby_promote_internal(config_file_options.data_directory);
|
_do_standby_promote_internal(config_file_options.data_directory);
|
||||||
@@ -1220,6 +1221,7 @@ _do_standby_promote_internal(const char *data_dir)
|
|||||||
true,
|
true,
|
||||||
details.data);
|
details.data);
|
||||||
|
|
||||||
|
termPQExpBuffer(&details);
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -2244,6 +2246,8 @@ do_standby_switchover(void)
|
|||||||
/* TODO warn about any inactive replication slots*/
|
/* TODO warn about any inactive replication slots*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PQfinish(remote_conn);
|
||||||
|
|
||||||
log_notice(_("switchover was successful"));
|
log_notice(_("switchover was successful"));
|
||||||
log_detail(_("node \"%s\" is now primary"),
|
log_detail(_("node \"%s\" is now primary"),
|
||||||
local_node_record.node_name);
|
local_node_record.node_name);
|
||||||
@@ -2314,6 +2318,7 @@ do_standby_switchover(void)
|
|||||||
* entries in repmgr.nodes match
|
* entries in repmgr.nodes match
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
clear_node_info_list(&sibling_nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
PQfinish(local_conn);
|
PQfinish(local_conn);
|
||||||
@@ -2437,11 +2442,13 @@ check_source_server()
|
|||||||
log_error(_("unable to retrieve source node's data directory"));
|
log_error(_("unable to retrieve source node's data directory"));
|
||||||
log_hint(_("STANDBY CLONE must be run as a database superuser"));
|
log_hint(_("STANDBY CLONE must be run as a database superuser"));
|
||||||
PQfinish(source_conn);
|
PQfinish(source_conn);
|
||||||
|
source_conn = NULL;
|
||||||
if(superuser_conn != NULL)
|
if(superuser_conn != NULL)
|
||||||
PQfinish(superuser_conn);
|
PQfinish(superuser_conn);
|
||||||
|
|
||||||
exit(ERR_BAD_CONFIG);
|
exit(ERR_BAD_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(superuser_conn != NULL)
|
if(superuser_conn != NULL)
|
||||||
PQfinish(superuser_conn);
|
PQfinish(superuser_conn);
|
||||||
|
|
||||||
@@ -3782,6 +3789,16 @@ parse_node_status_is_shutdown(const char *node_status_output, XLogRecPtr *checkP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pfree(options_string);
|
||||||
|
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 0; i < argc_item + 2; i ++)
|
||||||
|
pfree(argv_array[i]);
|
||||||
|
}
|
||||||
|
pfree(argv_array);
|
||||||
|
|
||||||
|
|
||||||
return node_status;
|
return node_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user