Repository: incubator-hawq
Updated Branches:
  refs/heads/master 9476a0134 -> d1d09bfd2


HAWQ-1457. Shared memory for SegmentStatus and MetadataCache should not be 
allocated on segments.


Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/d1d09bfd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/d1d09bfd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/d1d09bfd

Branch: refs/heads/master
Commit: d1d09bfd24462da5acd67b4eb01f7f8c65ca96ef
Parents: 9476a01
Author: Paul Guo <[email protected]>
Authored: Tue May 9 15:05:05 2017 +0800
Committer: Paul Guo <[email protected]>
Committed: Wed May 10 17:27:44 2017 +0800

----------------------------------------------------------------------
 src/backend/resourcemanager/resourcemanager.c |  2 +-
 src/backend/storage/ipc/ipci.c                | 13 +++++++++----
 2 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d1d09bfd/src/backend/resourcemanager/resourcemanager.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcemanager.c 
b/src/backend/resourcemanager/resourcemanager.c
index 652c83f..1ab9bf9 100644
--- a/src/backend/resourcemanager/resourcemanager.c
+++ b/src/backend/resourcemanager/resourcemanager.c
@@ -69,7 +69,7 @@ extern bool FindMyDatabase(const char *name, Oid *db_id, Oid 
*db_tablespace);
 static char *probeDatabase = "template1";
 
 /* Bitmap to monitor segment health info (up/down). */
-bits8 *shm_segment_status;
+static bits8 *shm_segment_status;
 void MarkSegmentUp(int x);
 void MarkSegmentDown(int x);
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/d1d09bfd/src/backend/storage/ipc/ipci.c
----------------------------------------------------------------------
diff --git a/src/backend/storage/ipc/ipci.c b/src/backend/storage/ipc/ipci.c
index f65f0ff..54638d4 100644
--- a/src/backend/storage/ipc/ipci.c
+++ b/src/backend/storage/ipc/ipci.c
@@ -170,9 +170,12 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
                size = add_size(size, PersistentRelfile_ShmemSize());
                size = add_size(size, Pass2Recovery_ShmemSize());
                size = add_size(size, FSCredShmemSize());
-               size = add_size(size, SegmentStatus_ShmSize());
+               if ((AmIMaster() || AmIStandby()) && Gp_role == 
GP_ROLE_DISPATCH) {
+                       size = add_size(size, SegmentStatus_ShmSize());
+                       elog(WARNING, "add_size %d on pid %d", (int)size, 
getpid());
+               }
 
-        if (Gp_role == GP_ROLE_DISPATCH || Gp_role == GP_ROLE_UTILITY)
+               if ((AmIMaster() || AmIStandby()) && (Gp_role == 
GP_ROLE_DISPATCH || Gp_role == GP_ROLE_UTILITY))
         {
             size = add_size(size, MetadataCache_ShmemSize());
             elog(LOG, "Metadata Cache Share Memory Size : %lu", 
MetadataCache_ShmemSize());
@@ -294,7 +297,7 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
        PersistentRelation_ShmemInit();
        PersistentRelfile_ShmemInit();
        Pass2Recovery_ShmemInit();
-    if (Gp_role == GP_ROLE_DISPATCH || Gp_role == GP_ROLE_UTILITY)
+       if ((AmIMaster() || AmIStandby()) && (Gp_role == GP_ROLE_DISPATCH || 
Gp_role == GP_ROLE_UTILITY))
     {
         MetadataCache_ShmemInit();
     }
@@ -366,7 +369,9 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
 
        FSCredShmemInit();
 
-       SegmentStatusShmemInit();
+       if ((AmIMaster() || AmIStandby()) && Gp_role == GP_ROLE_DISPATCH)
+               SegmentStatusShmemInit();
+
 #ifdef EXEC_BACKEND
 
        /*

Reply via email to