Fixes for issue raised by Craig Ringer, re use of shared_preload_libraries
authorMarc Munro <marc@bloodnok.com>
Fri, 13 Nov 2015 00:32:32 +0000 (16:32 -0800)
committerMarc Munro <marc@bloodnok.com>
Fri, 13 Nov 2015 00:32:32 +0000 (16:32 -0800)
regress/regress.sh
src/veil_shmem.c

index 96b094c9015614dc632de1d5bbf93fd92086bd61..867313bbd37d5e7d4e38f6ce5e05aad070681ae3 100755 (executable)
@@ -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}
index 3ae10864a68e06f072f1a0a39baa4e2c7a8f8ff6..ccefe8b8f1931e118e6a591df98229c61ecadaa7 100644 (file)
@@ -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;