mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-26 16:46:28 +00:00
Enable repmgr to be compiled with PostgreSQL 9.6
This commit is contained in:
29
repmgr.c
29
repmgr.c
@@ -5052,22 +5052,41 @@ check_upstream_config(PGconn *conn, int server_version_num, bool exit_on_error)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *levels[] = {
|
char *levels_pre96[] = {
|
||||||
"hot_standby",
|
"hot_standby",
|
||||||
"logical",
|
"logical",
|
||||||
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
int j = 0;
|
char *levels_96plus[] = {
|
||||||
wal_error_message = _("parameter 'wal_level' must be set to 'hot_standby' or 'logical'");
|
"replica",
|
||||||
|
"logical",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
for(; j < 2; j++)
|
char **levels;
|
||||||
|
int j = 0;
|
||||||
|
|
||||||
|
if (server_version_num < 90500)
|
||||||
|
{
|
||||||
|
levels = (char **)levels_pre96;
|
||||||
|
wal_error_message = _("parameter 'wal_level' must be set to 'hot_standby' or 'logical'");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
levels = (char **)levels_96plus;
|
||||||
|
wal_error_message = _("parameter 'wal_level' must be set to 'replica' or 'logical'");
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
{
|
{
|
||||||
i = guc_set(conn, "wal_level", "=", levels[j]);
|
i = guc_set(conn, "wal_level", "=", levels[j]);
|
||||||
if (i)
|
if (i)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
j++;
|
||||||
|
} while (levels[j] != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0 || i == -1)
|
if (i == 0 || i == -1)
|
||||||
|
|||||||
@@ -83,7 +83,12 @@ _PG_init(void)
|
|||||||
* resources in repmgr_shmem_startup().
|
* resources in repmgr_shmem_startup().
|
||||||
*/
|
*/
|
||||||
RequestAddinShmemSpace(repmgr_memsize());
|
RequestAddinShmemSpace(repmgr_memsize());
|
||||||
|
|
||||||
|
#if (PG_VERSION_NUM >= 90600)
|
||||||
|
RequestNamedLWLockTranche("repmgr", 1);
|
||||||
|
#else
|
||||||
RequestAddinLWLocks(1);
|
RequestAddinLWLocks(1);
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Install hooks.
|
* Install hooks.
|
||||||
@@ -128,7 +133,11 @@ repmgr_shmem_startup(void)
|
|||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
/* First time through ... */
|
/* First time through ... */
|
||||||
|
#if (PG_VERSION_NUM >= 90600)
|
||||||
|
shared_state->lock = &(GetNamedLWLockTranche("repmgr"))->lock;
|
||||||
|
#else
|
||||||
shared_state->lock = LWLockAssign();
|
shared_state->lock = LWLockAssign();
|
||||||
|
#endif
|
||||||
snprintf(shared_state->location,
|
snprintf(shared_state->location,
|
||||||
sizeof(shared_state->location), "%X/%X", 0, 0);
|
sizeof(shared_state->location), "%X/%X", 0, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user