Enable repmgr to be compiled with PostgreSQL 9.6

This commit is contained in:
Ian Barwick
2016-04-04 12:41:03 +09:00
committed by Ian Barwick
parent 70d398cd47
commit 683c54325e
2 changed files with 33 additions and 5 deletions

View File

@@ -83,7 +83,12 @@ _PG_init(void)
* resources in repmgr_shmem_startup().
*/
RequestAddinShmemSpace(repmgr_memsize());
#if (PG_VERSION_NUM >= 90600)
RequestNamedLWLockTranche("repmgr", 1);
#else
RequestAddinLWLocks(1);
#endif
/*
* Install hooks.
@@ -128,7 +133,11 @@ repmgr_shmem_startup(void)
if (!found)
{
/* First time through ... */
#if (PG_VERSION_NUM >= 90600)
shared_state->lock = &(GetNamedLWLockTranche("repmgr"))->lock;
#else
shared_state->lock = LWLockAssign();
#endif
snprintf(shared_state->location,
sizeof(shared_state->location), "%X/%X", 0, 0);
}