mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 00:26:30 +00:00
Fix WAL level check for 9.4 and later
This commit is contained in:
38
repmgr.c
38
repmgr.c
@@ -2991,7 +2991,9 @@ check_server_version(PGconn *conn, char *server_type, bool exit_on_error, char *
|
|||||||
*
|
*
|
||||||
* Perform sanity check on upstream server configuration
|
* Perform sanity check on upstream server configuration
|
||||||
*
|
*
|
||||||
* TODO: check replication connection is possble
|
* TODO:
|
||||||
|
* - check replication connection is possble
|
||||||
|
* - check user is qualified to perform base backup
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
@@ -2999,16 +3001,40 @@ check_upstream_config(PGconn *conn, int server_version_num, bool exit_on_error)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
bool config_ok = true;
|
bool config_ok = true;
|
||||||
|
char *wal_error_message = NULL;
|
||||||
|
/* Check that WAL level is set correctly */
|
||||||
|
|
||||||
/* XXX check user is qualified to perform base backup */
|
if(server_version_num < 90300)
|
||||||
|
{
|
||||||
|
i = guc_set(conn, "wal_level", "=", "hot_standby");
|
||||||
|
wal_error_message = "needs parameter 'wal_level' to be set to 'hot_standby'";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *levels[] = {
|
||||||
|
"hot_standby",
|
||||||
|
"logical",
|
||||||
|
};
|
||||||
|
|
||||||
|
int j = 0;
|
||||||
|
wal_error_message = "needs parameter 'wal_level' to be set to 'hot_standby' or 'logical'";
|
||||||
|
|
||||||
|
for(; j < 2; j++)
|
||||||
|
{
|
||||||
|
i = guc_set(conn, "wal_level", "=", levels[j]);
|
||||||
|
if(i)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* And check if it is well configured */
|
|
||||||
i = guc_set(conn, "wal_level", "=", "hot_standby");
|
|
||||||
if (i == 0 || i == -1)
|
if (i == 0 || i == -1)
|
||||||
{
|
{
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
log_err(_("%s needs parameter 'wal_level' to be set to 'hot_standby'\n"),
|
log_err(_("%s %s\n"),
|
||||||
progname);
|
progname,
|
||||||
|
wal_error_message);
|
||||||
if(exit_on_error == true)
|
if(exit_on_error == true)
|
||||||
{
|
{
|
||||||
PQfinish(conn);
|
PQfinish(conn);
|
||||||
|
|||||||
Reference in New Issue
Block a user