mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Add check for wal_level = logical so we don't fail on 9.4
On 9.4 we have logical decoding, which introduced a new wal_level called logical. This level includes all the previous ones, so you can run a hot_standby if wal_level = logical, because the relevant information for hot_standby will be there, plus other information needed for logical decoding. We fix this be adding a second check when wal_level is not hot_standby.
This commit is contained in:
29
repmgr.c
29
repmgr.c
@@ -812,7 +812,7 @@ do_standby_clone(void)
|
|||||||
|
|
||||||
int r = 0,
|
int r = 0,
|
||||||
retval = SUCCESS;
|
retval = SUCCESS;
|
||||||
int i,
|
int i,j,
|
||||||
is_standby_retval;
|
is_standby_retval;
|
||||||
bool flag_success = false;
|
bool flag_success = false;
|
||||||
bool test_mode = false;
|
bool test_mode = false;
|
||||||
@@ -890,11 +890,30 @@ do_standby_clone(void)
|
|||||||
i = guc_set(conn, "wal_level", "=", "hot_standby");
|
i = guc_set(conn, "wal_level", "=", "hot_standby");
|
||||||
if (i == 0 || i == -1)
|
if (i == 0 || i == -1)
|
||||||
{
|
{
|
||||||
PQfinish(conn);
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
log_err(_("%s needs parameter 'wal_level' to be set to 'hot_standby'\n"),
|
{
|
||||||
progname);
|
/* We could be using PG 9.4 with log_level logical, which is good enough for
|
||||||
exit(ERR_BAD_CONFIG);
|
hot standby replication.
|
||||||
|
We should check if the wal_level is set to that value, in which case we are
|
||||||
|
good to proceed.
|
||||||
|
No need to check if we are in 9.4 first, as the query used in guc_set will just
|
||||||
|
return zero rows if on < 9.4, and so will work anyway.
|
||||||
|
*/
|
||||||
|
j = guc_set(conn, "wal_level", "=", "logical");
|
||||||
|
if (j == 0 || j == -1)
|
||||||
|
{
|
||||||
|
PQfinish(conn);
|
||||||
|
if (j == 0)
|
||||||
|
log_err(_("%s needs parameter 'wal_level' to be set to at least 'hot_standby'\n"),
|
||||||
|
progname);
|
||||||
|
exit(ERR_BAD_CONFIG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (i == -1)
|
||||||
|
{
|
||||||
|
PQfinish(conn);
|
||||||
|
exit(ERR_BAD_CONFIG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i = guc_set_typed(conn, "wal_keep_segments", ">=",
|
i = guc_set_typed(conn, "wal_keep_segments", ">=",
|
||||||
|
|||||||
Reference in New Issue
Block a user