mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 00:46:29 +00:00
Improve handling of PostgreSQL output during "standby switchover"
Adapted from suggestion by GitHub user "ikusimakusi": https://github.com/2ndQuadrant/repmgr/pull/268
This commit is contained in:
@@ -1084,11 +1084,6 @@ should have been updated to reflect this:
|
|||||||
the `repmgrd` may try and promote a standby by itself.
|
the `repmgrd` may try and promote a standby by itself.
|
||||||
- Any other standbys attached to the old master will need to be manually
|
- Any other standbys attached to the old master will need to be manually
|
||||||
instructed to point to the new master (e.g. with `repmgr standby follow`).
|
instructed to point to the new master (e.g. with `repmgr standby follow`).
|
||||||
- You must ensure that following a server start using `pg_ctl`, log output
|
|
||||||
is not send to STDERR (the default behaviour). If logging is not configured,
|
|
||||||
we recommend setting `logging_collector=on` in `postgresql.conf` and
|
|
||||||
providing an explicit `-l/--log` setting in `repmgr.conf`'s `pg_ctl_options`
|
|
||||||
parameter.
|
|
||||||
|
|
||||||
We hope to remove some of these restrictions in future versions of `repmgr`.
|
We hope to remove some of these restrictions in future versions of `repmgr`.
|
||||||
|
|
||||||
|
|||||||
15
repmgr.c
15
repmgr.c
@@ -8423,17 +8423,12 @@ remote_command(const char *host, const char *user, const char *command, PQExpBuf
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
while (fgets(output, MAXLEN, fp) != NULL)
|
||||||
* When executed remotely, repmgr commands which execute pg_ctl (particularly
|
|
||||||
* `repmgr standby follow`) will see the pg_ctl command appear to fail with a
|
|
||||||
* non-zero return code when the output from the executed pg_ctl command
|
|
||||||
* has nowhere to go, even though the command actually succeeds. We'll consume an
|
|
||||||
* arbitrary amount of output and throw it away to work around this.
|
|
||||||
*/
|
|
||||||
int i = 0;
|
|
||||||
while (fgets(output, MAXLEN, fp) != NULL && i < 10)
|
|
||||||
{
|
{
|
||||||
i++;
|
if (!feof(fp))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user