hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From y...@apache.org
Subject incubator-hawq git commit: HAWQ-600. Remove dead code in resource manager communication component
Date Tue, 29 Mar 2016 03:06:29 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master 1eda4c1d9 -> bb749ebb4


HAWQ-600. Remove dead code in resource manager communication component


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

Branch: refs/heads/master
Commit: bb749ebb4bda2e01618ad7f5b4781cee0e1113c3
Parents: 1eda4c1
Author: YI JIN <yjin@pivotal.io>
Authored: Tue Mar 29 14:06:13 2016 +1100
Committer: YI JIN <yjin@pivotal.io>
Committed: Tue Mar 29 14:06:13 2016 +1100

----------------------------------------------------------------------
 .../communication/rmcomm_RM2RMSEG.c             | 46 ------------
 .../communication/rmcomm_RMSEG2RM.c             | 79 ++++----------------
 .../include/communication/rmcomm_RM2RMSEG.h     | 27 -------
 .../include/communication/rmcomm_RMSEG2RM.h     | 29 -------
 src/backend/resourcemanager/resourcemanager.c   |  2 -
 .../resourcemanager/resourcemanager_RMSEG.c     |  2 -
 6 files changed, 14 insertions(+), 171 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bb749ebb/src/backend/resourcemanager/communication/rmcomm_RM2RMSEG.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/communication/rmcomm_RM2RMSEG.c b/src/backend/resourcemanager/communication/rmcomm_RM2RMSEG.c
index 7baab7d..85629a8 100644
--- a/src/backend/resourcemanager/communication/rmcomm_RM2RMSEG.c
+++ b/src/backend/resourcemanager/communication/rmcomm_RM2RMSEG.c
@@ -29,8 +29,6 @@
 #include "utils/simplestring.h"
 #include "utils/linkedlist.h"
 
-#define DRMRM2RMSEG_MEMORY_CONTEXT_NAME  "RM to RMSEG communication"
-
 void receivedRUAliveResponse(AsyncCommMessageHandlerContext  context,
 							 uint16_t						 messageid,
 							 uint8_t						 mark1,
@@ -64,50 +62,6 @@ void sentDecreaseMemoryQuotaCleanup(AsyncCommMessageHandlerContext context);
 void processContainersAfterIncreaseMemoryQuota(GRMContainerSet ctns, bool accepted);
 void processContainersAfterDecreaseMemoryQuota(GRMContainerSet cts, bool kicked);
 
-/******************************************************************************
- *
- * Global Variables.
- *
- * Postmaster side global variables saving the data not necessarily always sent
- * from resource manager.
- *
- ******************************************************************************/
-
-MemoryContext			RM2RMSEG_CommContext;
-RM2RMSEGContextData		RM2RMSEG_Context;
-
-void initializeRM2RMSEGComm(void)
-{
-
-	/* Ask for new memory context for this postmaster side memory consumption.*/
-	MEMORY_CONTEXT_SWITCH_TO(TopMemoryContext)
-
-	RM2RMSEG_CommContext = NULL;
-
-	RM2RMSEG_CommContext = AllocSetContextCreate( CurrentMemoryContext,
-											      DRMRM2RMSEG_MEMORY_CONTEXT_NAME,
-											      ALLOCSET_DEFAULT_MINSIZE,
-											      ALLOCSET_DEFAULT_INITSIZE,
-											      ALLOCSET_DEFAULT_MAXSIZE);
-	Assert( RM2RMSEG_CommContext != NULL );
-	MEMORY_CONTEXT_SWITCH_BACK
-
-	/* Create communication context. */
-	RM2RMSEG_Context.RM2RMSEG_Conn_FD = -1;
-
-	initializeSelfMaintainBuffer(&(RM2RMSEG_Context.SendBuffer),
-								 RM2RMSEG_CommContext);
-	initializeSelfMaintainBuffer(&(RM2RMSEG_Context.RecvBuffer),
-								 RM2RMSEG_CommContext);
-}
-
-int cleanupRM2RMSEGComm(void)
-{
-	destroySelfMaintainBuffer(&(RM2RMSEG_Context.SendBuffer));
-	destroySelfMaintainBuffer(&(RM2RMSEG_Context.RecvBuffer));
-	return FUNC_RETURN_OK;
-}
-
 int sendRUAlive(char *seghostname)
 {
 	int 			res 			= FUNC_RETURN_OK;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bb749ebb/src/backend/resourcemanager/communication/rmcomm_RMSEG2RM.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/communication/rmcomm_RMSEG2RM.c b/src/backend/resourcemanager/communication/rmcomm_RMSEG2RM.c
index 77ea201..92946c8 100644
--- a/src/backend/resourcemanager/communication/rmcomm_RMSEG2RM.c
+++ b/src/backend/resourcemanager/communication/rmcomm_RMSEG2RM.c
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
+#include "envswitch.h"
 #include "communication/rmcomm_RMSEG2RM.h"
 #include "communication/rmcomm_Message.h"
 #include "communication/rmcomm_MessageHandler.h"
@@ -26,8 +26,6 @@
 #include "utils/simplestring.h"
 #include "utils/linkedlist.h"
 
-#define DRMRMSEG2RM_MEMORY_CONTEXT_NAME  "RMSEG to RM communication"
-
 void receivedIMAliveResponse(AsyncCommMessageHandlerContext  context,
 							 uint16_t						 messageid,
 							 uint8_t						 mark1,
@@ -37,49 +35,6 @@ void receivedIMAliveResponse(AsyncCommMessageHandlerContext  context,
 void sentIMAlive(AsyncCommMessageHandlerContext context);
 void sentIMAliveError(AsyncCommMessageHandlerContext context);
 void sentIMAliveCleanUp(AsyncCommMessageHandlerContext context);
-/******************************************************************************
- *
- * Global Variables.
- *
- * Postmaster side global variables saving the data not necessarily always sent
- * from resource manager.
- *
- ******************************************************************************/
-
-MemoryContext			RMSEG2RM_CommContext;
-RMSEG2RMContextData		RMSEG2RM_Context;
-
-void initializeRMSEG2RMComm(void)
-{
-	/* Ask for new memory context for this postmaster side memory consumption.*/
-	MEMORY_CONTEXT_SWITCH_TO(TopMemoryContext)
-
-	RMSEG2RM_CommContext 	= NULL;
-
-	RMSEG2RM_CommContext = AllocSetContextCreate( CurrentMemoryContext,
-											      DRMRMSEG2RM_MEMORY_CONTEXT_NAME,
-											      ALLOCSET_DEFAULT_MINSIZE,
-											      ALLOCSET_DEFAULT_INITSIZE,
-											      ALLOCSET_DEFAULT_MAXSIZE );
-	Assert( RMSEG2RM_CommContext != NULL );
-	MEMORY_CONTEXT_SWITCH_BACK
-
-	/* Create communication context. */
-	RMSEG2RM_Context.RMSEG2RM_Conn_FD = -1;
-
-	initializeSelfMaintainBuffer(&(RMSEG2RM_Context.SendBuffer),
-								 RMSEG2RM_CommContext);
-	initializeSelfMaintainBuffer(&(RMSEG2RM_Context.RecvBuffer),
-								 RMSEG2RM_CommContext);
-}
-
-int cleanupRMSEG2RMComm(void)
-{
-	destroySelfMaintainBuffer(&(RMSEG2RM_Context.SendBuffer));
-	destroySelfMaintainBuffer(&(RMSEG2RM_Context.RecvBuffer));
-
-	return FUNC_RETURN_OK;
-}
 
 /******************************************************************************
  * I aM Alive.
@@ -173,13 +128,6 @@ int sendIMAlive(int  *errorcode,
 	return FUNC_RETURN_OK;
 }
 
-
-
-int sendIShutdown(void)
-{
-	return FUNC_RETURN_OK;
-}
-
 void receivedIMAliveResponse(AsyncCommMessageHandlerContext  context,
 							 uint16_t						 messageid,
 							 uint8_t						 mark1,
@@ -190,18 +138,17 @@ void receivedIMAliveResponse(AsyncCommMessageHandlerContext  context,
 	RPCResponseIMAlive response = (RPCResponseIMAlive)buffer;
 	if ( messageid != RESPONSE_RM_IMALIVE ||
 		 buffersize != sizeof(RPCResponseIMAliveData) ) {
-		elog(WARNING, "Segment's resource manager received wrong response for heart-beat request.");
-		return;
-	}
-	if ( response->Result == FUNC_RETURN_OK ) {
-		elog(DEBUG5, "Segment's resource manager gets response of heart-beat request successfully.");
+		elog(WARNING, "Segment's resource manager received wrong response for "
+					  "heart-beat request.");
+		DRMGlobalInstance->SendToStandby = !DRMGlobalInstance->SendToStandby;
 	}
-	else {
-		elog(LOG, "Segment's resource manager gets error code %d as the response of "
-				  "heart-beat request.",
-				  response->Result);
+	else
+	{
+		/* Should always be a FUNC_RETURN_OK result. */
+		Assert(response->Result == FUNC_RETURN_OK);
+		elog(DEBUG5, "Segment's resource manager gets response of heart-beat "
+					 "request successfully.");
 	}
-
 	closeFileDesc(context->AsyncBuffer);
 }
 
@@ -213,9 +160,11 @@ void sentIMAlive(AsyncCommMessageHandlerContext context)
 void sentIMAliveError(AsyncCommMessageHandlerContext context)
 {
 	if(DRMGlobalInstance->SendToStandby)
-		elog(WARNING, "Segment's resource manager sending IMAlive message switches from standby
to master");
+		elog(WARNING, "Segment's resource manager sending IMAlive message "
+					  "switches from standby to master");
 	else
-		elog(WARNING, "Segment's resource manager sending IMAlive message switches from master
to standby");
+		elog(WARNING, "Segment's resource manager sending IMAlive message "
+					  "switches from master to standby");
 	DRMGlobalInstance->SendToStandby = !DRMGlobalInstance->SendToStandby;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bb749ebb/src/backend/resourcemanager/include/communication/rmcomm_RM2RMSEG.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/communication/rmcomm_RM2RMSEG.h b/src/backend/resourcemanager/include/communication/rmcomm_RM2RMSEG.h
index ecb2dc0..84e6eb4 100644
--- a/src/backend/resourcemanager/include/communication/rmcomm_RM2RMSEG.h
+++ b/src/backend/resourcemanager/include/communication/rmcomm_RM2RMSEG.h
@@ -20,35 +20,8 @@
 #ifndef RESOURCE_MAMANGER_INTER_PROCESS_COMMUNICATION_RM2RMSEG_H
 #define RESOURCE_MAMANGER_INTER_PROCESS_COMMUNICATION_RM2RMSEG_H
 #include "envswitch.h"
-#include "utils/linkedlist.h"
-#include "utils/simplestring.h"
 #include "dynrm.h"
 
-extern MemoryContext RM2RMSEG_CommContext;
-/******************************************************************************
- * This header file contains the APIs for resource manager master process.
- ******************************************************************************/
-
-struct RM2RMSEGContextData
-{
-	int						RM2RMSEG_Conn_FD;
-
-	/* Reusable buffer to build request messages */
-	SelfMaintainBufferData	SendBuffer;
-
-	/* Reusable buffer to build response messages */
-	SelfMaintainBufferData	RecvBuffer;
-};
-
-typedef struct RM2RMSEGContextData  RM2RMSEGContextData;
-typedef struct RM2RMSEGContextData *RM2RMSEGContext;
-
-/* Initialize environment to HAWQ RM */
-void initializeRM2RMSEGComm(void);
-
-/* Clean up and reset resource information and do necessary return to HAWQ RM */
-int cleanupRM2RMSEGComm(void);
-
 int sendRUAlive(char *seghostname);
 
 /* Update memory quota on specific machine */

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bb749ebb/src/backend/resourcemanager/include/communication/rmcomm_RMSEG2RM.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/communication/rmcomm_RMSEG2RM.h b/src/backend/resourcemanager/include/communication/rmcomm_RMSEG2RM.h
index a8c31ce..68ae9ae 100644
--- a/src/backend/resourcemanager/include/communication/rmcomm_RMSEG2RM.h
+++ b/src/backend/resourcemanager/include/communication/rmcomm_RMSEG2RM.h
@@ -19,37 +19,8 @@
 
 #ifndef RESOURCE_MAMANGER_INTER_PROCESS_COMMUNICATION_RMSEG2RM_H
 #define RESOURCE_MAMANGER_INTER_PROCESS_COMMUNICATION_RMSEG2RM_H
-#include "envswitch.h"
-#include "utils/linkedlist.h"
-#include "utils/simplestring.h"
-#include "dynrm.h"
-
-extern MemoryContext RMSEG2RM_CommContext;
-/******************************************************************************
- * This header file contains the APIs for resource manager segment process.
- ******************************************************************************/
-
-struct RMSEG2RMContextData {
-	int				RMSEG2RM_Conn_FD;
-
-	/* Reusable buffer for building request messages & receiving response
-	 * messages.*/
-	SelfMaintainBufferData 	SendBuffer;
-	SelfMaintainBufferData  RecvBuffer;
-};
-
-typedef struct RMSEG2RMContextData  RMSEG2RMContextData;
-typedef struct RMSEG2RMContextData *RMSEG2RMContext;
-
-/* Initialize environment to HAWQ RM */
-void initializeRMSEG2RMComm(void);
-
-/* Clean up all reset resource information and do necessary return to HAWQ RM.*/
-int cleanupRMSEG2RMComm(void);
 
 int sendIMAlive(int  *errorcode,
 				char *errorbuf,
 				int	  errorbufsize);
-
-int sendIShutdown(void);
 #endif /* RESOURCE_MAMANGER_INTER_PROCESS_COMMUNICATION_RMSEG2RM_H */

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bb749ebb/src/backend/resourcemanager/resourcemanager.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcemanager.c b/src/backend/resourcemanager/resourcemanager.c
index b840789..6175cf2 100644
--- a/src/backend/resourcemanager/resourcemanager.c
+++ b/src/backend/resourcemanager/resourcemanager.c
@@ -467,8 +467,6 @@ int ResManagerMainServer2ndPhase(void)
 		elog(FATAL, "Fail to initialize socket server.");
 	}
 
-	initializeRM2RMSEGComm();
-
 	/*
 	 * Notify postmaster that HAWQ RM is ready. Ignore the possible problem that
 	 * the parent process quits. HAWQ RM will automatically detect if its parent

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/bb749ebb/src/backend/resourcemanager/resourcemanager_RMSEG.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/resourcemanager_RMSEG.c b/src/backend/resourcemanager/resourcemanager_RMSEG.c
index 737d523..ca43f87 100644
--- a/src/backend/resourcemanager/resourcemanager_RMSEG.c
+++ b/src/backend/resourcemanager/resourcemanager_RMSEG.c
@@ -53,8 +53,6 @@ int ResManagerMainSegment2ndPhase(void)
 		MainHandler_RMSEGDummyLoop();
 	}
 
-	initializeRMSEG2RMComm();
-
 	/*
 	 * Resource enforcement: initialize, cleanup, and rebuild CGroup hash table
 	 * when segment resource manager starts/restarts


Mime
View raw message