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-602. Remove unused code for utility components in resource manager
Date Wed, 30 Mar 2016 02:43:02 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master adbf7c549 -> 64db1b400


HAWQ-602. Remove unused code for utility components in resource manager


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

Branch: refs/heads/master
Commit: 64db1b400a877f32b1d3474d823a9d6ba80c61fe
Parents: adbf7c5
Author: YI JIN <yjin@pivotal.io>
Authored: Wed Mar 30 13:42:50 2016 +1100
Committer: YI JIN <yjin@pivotal.io>
Committed: Wed Mar 30 13:42:50 2016 +1100

----------------------------------------------------------------------
 .../resourcemanager/include/utils/balancedbst.h |  3 -
 .../include/utils/simplestring.h                |  7 +-
 src/backend/resourcemanager/utils/balancedbst.c | 44 ---------
 .../resourcemanager/utils/kvproperties.c        | 94 ++++++--------------
 .../resourcemanager/utils/simplestring.c        |  4 +
 5 files changed, 38 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/64db1b40/src/backend/resourcemanager/include/utils/balancedbst.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/utils/balancedbst.h b/src/backend/resourcemanager/include/utils/balancedbst.h
index fe67ad8..00f43cf 100644
--- a/src/backend/resourcemanager/include/utils/balancedbst.h
+++ b/src/backend/resourcemanager/include/utils/balancedbst.h
@@ -96,9 +96,6 @@ int      removeBBSTNode(BBST tree, BBSTNode *node);
 
 int		 reorderBBSTNodeData(BBST tree, void *data);
 
-/* Get count of node with no less value than specified criterion */
-int countBBSTNodeNoLessThan(BBST tree, void * critirion);
-
 /*
 void     freeBBSTNode(BBST tree, BBSTNode node);
 void     freeBBST(BBST tree);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/64db1b40/src/backend/resourcemanager/include/utils/simplestring.h
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/include/utils/simplestring.h b/src/backend/resourcemanager/include/utils/simplestring.h
index d039de4..4218d08 100644
--- a/src/backend/resourcemanager/include/utils/simplestring.h
+++ b/src/backend/resourcemanager/include/utils/simplestring.h
@@ -62,13 +62,16 @@ void SimpleStringFill(SimpStringPtr str, int start, int length, uint8_t
val);
 bool SimpleStringEmpty(SimpStringPtr str);
 int  SimpleStringLocateChar(SimpStringPtr str, char target, int *location);
 /* string to the other number values. */
-int  SimpleStringToInt8(SimpStringPtr str, int8_t *value);
 int  SimpleStringToInt32(SimpStringPtr str, int32_t *value);
-int  SimpleStringToUInt32(SimpStringPtr str, uint32_t *value);
 int  SimpleStringToInt64(SimpStringPtr str, int64_t *value);
 int  SimpleStringToDouble(SimpStringPtr str, double *value);
 int  SimpleStringToBool(SimpStringPtr str, bool *value);
 
+/*
+int  SimpleStringToInt8(SimpStringPtr str, int8_t *value);
+int  SimpleStringToUInt32(SimpStringPtr str, uint32_t *value);
+*/
+
 /* convert different types of value into string. */
 int SimpleStringSetOid(SimpStringPtr str, Oid value);
 int SimpleStringSetName(SimpStringPtr str, Name value);

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/64db1b40/src/backend/resourcemanager/utils/balancedbst.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/utils/balancedbst.c b/src/backend/resourcemanager/utils/balancedbst.c
index 69a90f7..772acd5 100644
--- a/src/backend/resourcemanager/utils/balancedbst.c
+++ b/src/backend/resourcemanager/utils/balancedbst.c
@@ -594,50 +594,6 @@ int	reorderBBSTNodeData(BBST tree, void *data)
 	return res;
 }
 
-/* 
- * Return the number of nodes that has no less value than critirion. This is de-
- * signed to support the requirement that how many data objects are qualified to
- * contain expected volume of resource. BBST supports O(logN) time complexity of
- * searching. 
- */
-int countBBSTNodeNoLessThan(BBST tree, void *critirion)
-{
-
-    BBSTNode p = NULL;
-    int res = 0;
-    int comp = 0;
-    
-    Assert( tree != NULL );
-	Assert( critirion != NULL );
-	Assert( tree->DataCompFunc != NULL );
-    
-    p = tree->Root;
-    
-	while( p != NULL ) {
-		comp = tree->DataCompFunc( tree->DataCompArg,
-								   p,
-								   critirion);
-		/* Case 1: p is larger than critirion. Go to left child tree. */
-		if ( comp > 0 ) {
-			p = p->Left;
-			continue;
-		}
-		/* Current code and all left nodes are qualifying nodes. */
-		res += 1;
-		res += (p->Left != NULL) ? p->Left->NodeCount : 0;
-        
-		/* Case 2: p is equal to the critirion. Finish searching. */
-		if ( comp == 0 ) {
-			break;
-		}
-		/* Case 3: p is smaller than the critirion. Go to right child tree. */
-		else {
-			p = p->Right;
-		}
-	}
-	return res;
-}
-
 int getBBSTNodeCount(BBST tree)
 {
 	return tree->Root == NULL ? 0 : tree->Root->NodeCount;

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/64db1b40/src/backend/resourcemanager/utils/kvproperties.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/utils/kvproperties.c b/src/backend/resourcemanager/utils/kvproperties.c
index c7233b4..226c09e 100644
--- a/src/backend/resourcemanager/utils/kvproperties.c
+++ b/src/backend/resourcemanager/utils/kvproperties.c
@@ -70,53 +70,40 @@ void processXMLNode(xmlTextReaderPtr reader, MCTYPE context, List **properties)
     {
     	if ( xmlDepth == 0 && xmlType  == XML_READER_TYPE_ELEMENT )
     	{
-    		if ( countConfiguration > 0 )
-    		{
-    			resultCode = UTIL_PROPERTIES_ELEMENT_MULTI_CONFIGURATION;
-    			return;
-    		}
     		countConfiguration++;
     	}
     	else if ( xmlDepth == 0 && xmlType == XML_READER_TYPE_END_ELEMENT )
     	{
-    		if ( countConfiguration != 1 )
-    		{
-    			/* Allow one configuration element. Should not occur. */
-    			resultCode = UTIL_PROPERTIES_ELEMENT_INTERNAL_ERROR;
-    			return;
-    		}
     		countConfiguration--;
     	}
     	else
     	{
     		/* Wrong level or wrong node type. */
     		resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_CONFIGURATION;
+    		elog(WARNING, "Wrong element <configuration> is parsed.");
     		return;
     	}
     }
     else if ( strcmp((const char *)name, "property") == 0 )
     {
-    	/* Must be in element <configuration> */
-    	if ( countConfiguration != 1 )
-    	{
-    		resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_PROPERTY;
-    		return;
-    	}
+    	/*
+    	 * Must be in element <configuration>, suppose this is guaranteed by
+    	 * hawq control scripts.
+    	 */
+    	Assert(countConfiguration == 1);
     	if ( xmlDepth == 1 && xmlType  == XML_READER_TYPE_ELEMENT )
     	{
-    		if ( countProperty != 0 )
-    		{
-    			resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_PROPERTY;
-    			return;
-    		}
     		countProperty++;
     	}
     	else if ( xmlDepth == 1 && xmlType == XML_READER_TYPE_END_ELEMENT )
     	{
-    		/* In property element, there is only one <name> element, one <value>
-    		 * element as a pair. */
+    		/*
+    		 * In property element, there is only one <name> element, one <value>
+    		 * element as a pair.
+    		 */
     		if ( countProperty != 1 || countName != 1 || countValue != 1 )
     		{
+    			elog(WARNING, "Element <property> is not correctly defined.");
 				resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_PROPERTY;
 				return;
     		}
@@ -152,6 +139,7 @@ void processXMLNode(xmlTextReaderPtr reader, MCTYPE context, List **properties)
     	{
     		/* Wrong level or wrong node type. */
     		resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_PROPERTY;
+    		elog(WARNING, "Wrong element <property> is parsed.");
     		return;
     	}
     }
@@ -160,30 +148,23 @@ void processXMLNode(xmlTextReaderPtr reader, MCTYPE context, List **properties)
     	if ( countConfiguration != 1 || countProperty != 1 )
     	{
     		resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_NAME;
+    		elog(WARNING, "Element <name> is not correctly defined.");
     		return;
     	}
 
     	if ( xmlDepth == 2 && xmlType  == XML_READER_TYPE_ELEMENT )
     	{
-    		if ( countName != 0 )
-    		{
-				resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_NAME;
-				return;
-    		}
     	    countName++;
 		}
 		else if ( xmlDepth == 2 && xmlType == XML_READER_TYPE_END_ELEMENT )
 		{
-			if ( countName != 1 )
-			{
-				resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_NAME;
-				return;
-			}
+			/* Do nothing here. */
 		}
 		else
 		{
 			/* Wrong level or wrong node type. */
 			resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_NAME;
+			elog(WARNING, "Wrong element <name> is parsed.");
 			return;
 		}
 
@@ -193,26 +174,21 @@ void processXMLNode(xmlTextReaderPtr reader, MCTYPE context, List **properties)
     	if ( countConfiguration != 1 || countProperty != 1 || countName != 1)
     	{
     		resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_VALUE;
+    		elog(WARNING, "Element <value> is not correctly defined.");
     		return;
     	}
     	if ( xmlDepth == 2 && xmlType  == XML_READER_TYPE_ELEMENT )
     	{
-    		if ( countValue != 0 )
-    		{
-				resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_VALUE;
-				return;
-    		}
     	    countValue++;
 		}
 		else if ( xmlDepth == 2 && xmlType == XML_READER_TYPE_END_ELEMENT ) {
-			if ( countValue != 1 ) {
-				resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_VALUE;
-				return;
-			}
+			/* Do nothing here. */
 		}
-		else {
+		else
+		{
 			/* Wrong level or wrong node type. */
 			resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_VALUE;
+			elog(WARNING, "Wrong element <value> is parsed.");
 			return;
 		}
     }
@@ -221,32 +197,14 @@ void processXMLNode(xmlTextReaderPtr reader, MCTYPE context, List **properties)
     	if ( countConfiguration != 1 || countProperty != 1 )
     	{
     		resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_DESC;
+    		elog(WARNING, "Element <description> is not correctly defined.");
     		return;
     	}
 
     	if ( xmlDepth == 2 && xmlType  == XML_READER_TYPE_ELEMENT )
     	{
-    		if ( countDesc != 0 )
-    		{
-				resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_DESC;
-				return;
-    		}
     	    countDesc++;
 		}
-		else if ( xmlDepth == 2 && xmlType == XML_READER_TYPE_END_ELEMENT )
-		{
-			if ( countDesc != 1 )
-			{
-				resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_DESC;
-				return;
-			}
-		}
-		else
-		{
-			/* Wrong level or wrong node type. */
-			resultCode = UTIL_PROPERTIES_ELEMENT_WRONG_DESC;
-			return;
-		}
     }
     else if ( xmlDepth == 3 &&
     		  xmlType == XML_READER_TYPE_TEXT &&
@@ -294,7 +252,7 @@ int processXMLPropertyFile(const char   *filename,
 	countName			= 0;
 	countValue			= 0;
 	countDesc			= 0;
-	resultCode			= 0;
+	resultCode			= FUNC_RETURN_OK;
 	posNodeLine			= -1;
 	posNodeColumn		= -1;
 
@@ -302,12 +260,18 @@ int processXMLPropertyFile(const char   *filename,
 	initSimpleString(&currentValueString, context);
 
 	readerres = xmlTextReaderRead(reader);
-	while (readerres == 1)
+	while (readerres == 1 && resultCode == FUNC_RETURN_OK)
 	{
 		processXMLNode(reader, context, properties);
 		readerres = xmlTextReaderRead(reader);
 	}
 
+	if ( resultCode != FUNC_RETURN_OK )
+	{
+		res = UTIL_PROPERTIES_INVALID_XML;
+		goto exit;
+	}
+
 	readerres = xmlTextReaderIsValid(reader);
 	if ( !(countConfiguration == 0 &&
 		   countProperty == 0 &&

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/64db1b40/src/backend/resourcemanager/utils/simplestring.c
----------------------------------------------------------------------
diff --git a/src/backend/resourcemanager/utils/simplestring.c b/src/backend/resourcemanager/utils/simplestring.c
index 2c4edd6..a03698b 100644
--- a/src/backend/resourcemanager/utils/simplestring.c
+++ b/src/backend/resourcemanager/utils/simplestring.c
@@ -231,6 +231,7 @@ int  SimpleStringToBool(SimpStringPtr str, bool *value)
 	return FUNC_RETURN_OK;
 }
 
+/*
 int  SimpleStringToInt8(SimpStringPtr str, int8_t *value)
 {
 	int val;
@@ -242,6 +243,7 @@ int  SimpleStringToInt8(SimpStringPtr str, int8_t *value)
 	return UTIL_SIMPSTRING_WRONG_FORMAT;
 
 }
+*/
 
 int  SimpleStringToInt32(SimpStringPtr str, int32_t *value)
 {
@@ -254,6 +256,7 @@ int  SimpleStringToInt32(SimpStringPtr str, int32_t *value)
 	return UTIL_SIMPSTRING_WRONG_FORMAT;
 }
 
+/*
 int  SimpleStringToUInt32(SimpStringPtr str, uint32_t *value)
 {
 	uint32_t val;
@@ -264,6 +267,7 @@ int  SimpleStringToUInt32(SimpStringPtr str, uint32_t *value)
 	}
 	return UTIL_SIMPSTRING_WRONG_FORMAT;
 }
+*/
 
 int  SimpleStringToInt64(SimpStringPtr str, int64_t *value)
 {


Mime
View raw message