mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 00:26:30 +00:00
repmgr: miscelleanous code cleanup
This commit is contained in:
@@ -1436,10 +1436,11 @@ create_event_record(PGconn *conn, t_configuration_options *options, int node_id,
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
struct tm ts;
|
struct tm ts;
|
||||||
|
|
||||||
/* Only attempt to write a record if a connection handle was provided.
|
/*
|
||||||
Also check that the repmgr schema has been properly intialised - if
|
* Only attempt to write a record if a connection handle was provided.
|
||||||
not it means no configuration file was provided, which can happen with
|
* Also check that the repmgr schema has been properly initialised - if
|
||||||
e.g. `repmgr standby clone`, and we won't know which schema to write to.
|
* not it means no configuration file was provided, which can happen with
|
||||||
|
* e.g. `repmgr standby clone`, and we won't know which schema to write to.
|
||||||
*/
|
*/
|
||||||
if (conn != NULL && strcmp(repmgr_schema, DEFAULT_REPMGR_SCHEMA_PREFIX) != 0)
|
if (conn != NULL && strcmp(repmgr_schema, DEFAULT_REPMGR_SCHEMA_PREFIX) != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
26
repmgr.c
26
repmgr.c
@@ -1841,7 +1841,15 @@ do_cluster_cleanup(void)
|
|||||||
sqlquery_snprintf(sqlquery, "VACUUM %s.repl_monitor", get_repmgr_schema_quoted(master_conn));
|
sqlquery_snprintf(sqlquery, "VACUUM %s.repl_monitor", get_repmgr_schema_quoted(master_conn));
|
||||||
res = PQexec(master_conn, sqlquery);
|
res = PQexec(master_conn, sqlquery);
|
||||||
|
|
||||||
/* XXX There is any need to check this VACUUM happens without problems? */
|
if (PQresultStatus(res) != PGRES_COMMAND_OK)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Unlikely to happen and not a problem per-se, but we'll issue a warning
|
||||||
|
* just in case
|
||||||
|
*/
|
||||||
|
log_warning(_("Unable to vacuum table %s.repl_monitor"), get_repmgr_schema_quoted(master_conn));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
PQfinish(master_conn);
|
PQfinish(master_conn);
|
||||||
@@ -2519,17 +2527,19 @@ get_tablespace_data(PGconn *upstream_conn, TablespaceDataList *list)
|
|||||||
res = PQexec(upstream_conn, sqlquery);
|
res = PQexec(upstream_conn, sqlquery);
|
||||||
|
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
{
|
{
|
||||||
log_err(_("unable to execute tablespace query: %s\n"),
|
log_err(_("unable to execute tablespace query: %s\n"),
|
||||||
PQerrorMessage(upstream_conn));
|
PQerrorMessage(upstream_conn));
|
||||||
|
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|
||||||
return ERR_DB_QUERY;
|
return ERR_DB_QUERY;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < PQntuples(res); i++)
|
for (i = 0; i < PQntuples(res); i++)
|
||||||
tablespace_data_append(list, PQgetvalue(res, i, 0), PQgetvalue(res, i, 1),
|
tablespace_data_append(list,
|
||||||
|
PQgetvalue(res, i, 0),
|
||||||
|
PQgetvalue(res, i, 1),
|
||||||
PQgetvalue(res, i, 2));
|
PQgetvalue(res, i, 2));
|
||||||
|
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user