mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 17:06:29 +00:00
node action: don't attempt to issue a CHECKPOINT as non-superuser
Raise a warning instead.
This commit is contained in:
@@ -2025,12 +2025,6 @@ do_node_service(void)
|
|||||||
|
|
||||||
|
|
||||||
if ((action == ACTION_STOP || action == ACTION_RESTART) && runtime_options.checkpoint == true)
|
if ((action == ACTION_STOP || action == ACTION_RESTART) && runtime_options.checkpoint == true)
|
||||||
{
|
|
||||||
if (runtime_options.dry_run == true)
|
|
||||||
{
|
|
||||||
log_info(_("a CHECKPOINT would be issued here"));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
PGconn *conn = NULL;
|
PGconn *conn = NULL;
|
||||||
|
|
||||||
@@ -2039,15 +2033,38 @@ do_node_service(void)
|
|||||||
else
|
else
|
||||||
conn = establish_db_connection_by_params(&source_conninfo, true);
|
conn = establish_db_connection_by_params(&source_conninfo, true);
|
||||||
|
|
||||||
|
if (is_superuser_connection(conn, NULL) == false)
|
||||||
|
{
|
||||||
|
if (runtime_options.dry_run == true)
|
||||||
|
{
|
||||||
|
log_warning(_("a CHECKPOINT would be issued here but no superuser connection is available"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_warning(_("a superuser connection is required to issue a CHECKPOINT"));
|
||||||
|
}
|
||||||
|
|
||||||
|
log_hint(_("provide a superuser with -S/--superuser"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (runtime_options.dry_run == true)
|
||||||
|
{
|
||||||
|
log_info(_("a CHECKPOINT would be issued here"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
log_notice(_("issuing CHECKPOINT"));
|
log_notice(_("issuing CHECKPOINT"));
|
||||||
|
|
||||||
/* check superuser conn! */
|
|
||||||
checkpoint(conn);
|
checkpoint(conn);
|
||||||
|
|
||||||
PQfinish(conn);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PQfinish(conn);
|
||||||
|
}
|
||||||
|
|
||||||
get_server_action(action, command, data_dir);
|
get_server_action(action, command, data_dir);
|
||||||
|
|
||||||
if (runtime_options.dry_run == true)
|
if (runtime_options.dry_run == true)
|
||||||
|
|||||||
Reference in New Issue
Block a user