Miscellaneous comment and logging cleanup1

This commit is contained in:
Ian Barwick
2019-05-23 09:31:46 +09:00
parent 2bce1b371c
commit 8ead0042ad
2 changed files with 13 additions and 11 deletions

View File

@@ -766,9 +766,8 @@ repmgrd_pause(PG_FUNCTION_ARGS)
if (file == NULL) if (file == NULL)
{ {
elog(DEBUG1, "unable to allocate %s", REPMGRD_STATE_FILE); elog(WARNING, "unable to allocate %s", REPMGRD_STATE_FILE);
// XXX anything else we can do? log?
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
@@ -783,8 +782,10 @@ repmgrd_pause(PG_FUNCTION_ARGS)
pause ? 1 : 0); pause ? 1 : 0);
LWLockRelease(shared_state->lock); LWLockRelease(shared_state->lock);
// XXX check success if (fwrite(buf.data, strlen(buf.data) + 1, 1, file) != strlen(buf.data) + 1)
fwrite(buf.data, strlen(buf.data) + 1, 1, file); {
elog(WARNING, _("unable to write to file %s"), REPMGRD_STATE_FILE);
}
resetStringInfo(&buf); resetStringInfo(&buf);

View File

@@ -933,11 +933,10 @@ try_reconnect(PGconn **conn, t_node_info *node_info)
log_notice(_("node %i has recovered, reconnecting"), node_info->node_id); log_notice(_("node %i has recovered, reconnecting"), node_info->node_id);
/* /*
* XXX we should also handle the case where node is pingable but * Note: we could also handle the case where node is pingable but
* connection denied due to connection exhaustion - fall back to * connection denied due to connection exhaustion, by falling back to
* degraded monitoring? - make that configurable * degraded monitoring (make configurable)
*/ */
our_conn = establish_db_connection_by_params(&conninfo_params, false); our_conn = establish_db_connection_by_params(&conninfo_params, false);
if (PQstatus(our_conn) == CONNECTION_OK) if (PQstatus(our_conn) == CONNECTION_OK)
@@ -948,7 +947,7 @@ try_reconnect(PGconn **conn, t_node_info *node_info)
if (PQstatus(*conn) == CONNECTION_BAD) if (PQstatus(*conn) == CONNECTION_BAD)
{ {
log_verbose(LOG_INFO, "original connection handle returned CONNECTION_BAD, using new connection"); log_verbose(LOG_INFO, _("original connection handle returned CONNECTION_BAD, using new connection"));
close_connection(conn); close_connection(conn);
*conn = our_conn; *conn = our_conn;
} }
@@ -960,7 +959,7 @@ try_reconnect(PGconn **conn, t_node_info *node_info)
if (ping_result != PGRES_TUPLES_OK) if (ping_result != PGRES_TUPLES_OK)
{ {
log_info("original connection no longer available, using new connection"); log_info(_("original connection no longer available, using new connection"));
close_connection(conn); close_connection(conn);
*conn = our_conn; *conn = our_conn;
} }
@@ -978,7 +977,9 @@ try_reconnect(PGconn **conn, t_node_info *node_info)
} }
close_connection(&our_conn); close_connection(&our_conn);
log_notice(_("unable to reconnect to node %i"), node_info->node_id); log_notice(_("unable to reconnect to node \"%s\" (ID: %i)"),
node_info->node_name,
node_info->node_id);
} }
if (i + 1 < max_attempts) if (i + 1 < max_attempts)