From fc692a02dde02b0c8ddfee56310391731ad7f313 Mon Sep 17 00:00:00 2001 From: Marc Munro Date: Thu, 12 Nov 2015 16:32:32 -0800 Subject: [PATCH] Fixes for issue raised by Craig Ringer, re use of shared_preload_libraries --- regress/regress.sh | 8 +++++--- src/veil_shmem.c | 10 +++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/regress/regress.sh b/regress/regress.sh index 96b094c..867313b 100755 --- a/regress/regress.sh +++ b/regress/regress.sh @@ -1162,8 +1162,10 @@ preload_library_message() if [ "x$1" = "x1" -o "x$1" = "x2" ]; then echo " WARNING: The veil shared library is not defined in shared_preload_libraries -(which is defined in postgresql.conf) Without this definition Veil will not run -" +(which is defined in postgresql.conf) Without this definition you will be +unable to define veil.dbs_in_cluster, veil.shared_hash_elems, and +veil.shmem_context_size which will limit the amount of shared memory +available to veil." elif [ "x$1" = "x3" ]; then echo " WARNING: The version of veil.so in shared_preload_libraries (defined in @@ -1233,4 +1235,4 @@ but does not reference an up to date veil shared library." 1>&2 preload_library_message ${preload_status} fi -exit ${STATUS} \ No newline at end of file +exit ${STATUS} diff --git a/src/veil_shmem.c b/src/veil_shmem.c index 3ae1086..ccefe8b 100644 --- a/src/veil_shmem.c +++ b/src/veil_shmem.c @@ -82,14 +82,14 @@ static bool prepared_for_switch = false; * shared memory. It is initialised in _PG_init() to a lock id that is * distinct from any that will be dynamically allocated. */ -static LWLockId VeilLWLock; +static LWLockId VeilLWLock = 0; /** * The LWLock to be used while initially setting up shared memory and * allocating a veil database-specific LWLock. Initialised in * _PG_Init() */ -static LWLockId InitialLWLock; +static LWLockId InitialLWLock = 0; /** * Return the index of the other context from the one supplied. @@ -111,13 +111,14 @@ _PG_init() int veil_dbs; /* See definitions of the following two variables, for comments. */ + fprintf(stderr, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"); VeilLWLock = AddinShmemInitLock; InitialLWLock = AddinShmemInitLock; /* Define GUCs for veil */ veil_config_init(); veil_dbs = veil_dbs_in_cluster(); - + /* Request a Veil-specific shared memory context */ RequestAddinShmemSpace(2 * veil_shmem_context_size() * veil_dbs); @@ -406,6 +407,9 @@ vl_free(void *mem) static void shmalloc_init(void) { + VeilLWLock = AddinShmemInitLock; + InitialLWLock = AddinShmemInitLock; + if (!shared_meminfo) { VarEntry *var; MemContext *context0; -- 2.39.5