hawq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nh...@apache.org
Subject incubator-hawq git commit: HAWQ-102. Change error message when PXF webapp is down
Date Fri, 13 Nov 2015 01:22:11 GMT
Repository: incubator-hawq
Updated Branches:
  refs/heads/master e74af5450 -> 939769288


HAWQ-102. Change error message when PXF webapp is down


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

Branch: refs/heads/master
Commit: 9397692880228fe2faf0406fc472509a1cc121e0
Parents: e74af54
Author: Noa Horn <nhorn@pivotal.io>
Authored: Thu Nov 12 17:21:59 2015 -0800
Committer: Noa Horn <nhorn@pivotal.io>
Committed: Thu Nov 12 17:21:59 2015 -0800

----------------------------------------------------------------------
 .gitignore                             |  1 +
 src/backend/access/external/libchurl.c | 55 ++++++++++++++++-------------
 2 files changed, 32 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/93976928/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 7699cfe..827e838 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@ objfiles.txt
 .project
 .pydevproject
 .cproject
+.settings
 
 # Generated files
 GNUmakefile

http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/93976928/src/backend/access/external/libchurl.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/libchurl.c b/src/backend/access/external/libchurl.c
index b91a0ff..5af0ea9 100644
--- a/src/backend/access/external/libchurl.c
+++ b/src/backend/access/external/libchurl.c
@@ -115,7 +115,7 @@ size_t header_callback(char *buffer, size_t size, size_t nitems, void
*userp);
 void free_http_response(churl_context* context);
 void compact_internal_buffer(churl_buffer* buffer);
 void realloc_internal_buffer(churl_buffer* buffer, size_t required);
-bool handle_special_error(long response);
+bool handle_special_error(long response, StringInfo err);
 char* get_http_error_msg(long http_ret_code, char* msg, char* curl_error_buffer);
 char* build_header_str(const char* format, const char* key, const char* value);
 void print_http_headers(CHURL_HEADERS headers);
@@ -834,42 +834,49 @@ void check_response_code(churl_context* context)
 	}
 	else if (response_code != 200 && response_code != 100)
 	{
-		if (!handle_special_error(response_code))
-		{
-			StringInfoData err;
-			char    *http_error_msg;
-			char    *addr;
+		StringInfoData err;
+		char    *http_error_msg;
+		char    *addr;
 
-			initStringInfo(&err);
+		initStringInfo(&err);
 
-			/* prepare response text if any */
-			if (context->download_buffer->ptr)
-			{
-				context->download_buffer->ptr[context->download_buffer->top] = '\0';
-				response_text = context->download_buffer->ptr + context->download_buffer->bot;
-			}
+		/* prepare response text if any */
+		if (context->download_buffer->ptr)
+		{
+			context->download_buffer->ptr[context->download_buffer->top] = '\0';
+			response_text = context->download_buffer->ptr + context->download_buffer->bot;
+		}
 
-			/* add remote http error code */
-			appendStringInfo(&err, "remote component error (%ld)", response_code);
+		/* add remote http error code */
+		appendStringInfo(&err, "remote component error (%ld)", response_code);
 
-			addr = get_dest_address(context->curl_handle);
-			if (strlen(addr) != 0)
-				appendStringInfo(&err, " from %s", addr);
-			pfree(addr);
+		addr = get_dest_address(context->curl_handle);
+		if (strlen(addr) != 0)
+		{
+			appendStringInfo(&err, " from %s", addr);
+		}
+		pfree(addr);
 
+		if (!handle_special_error(response_code, &err))
+		{
 			/*
 			 * add detailed error message from the http response. response_text
 			 * could be NULL in some cases. get_http_error_msg checks for that.
 			 */
 			http_error_msg = get_http_error_msg(response_code, response_text, context->curl_error_buffer);
 			/* check for a specific confusing error, and replace with a clearer one */
-			if(strstr(http_error_msg, "instance does not contain any root resource classes") != NULL)
+			if (strstr(http_error_msg, "instance does not contain any root resource classes") != NULL)
+			{
 				appendStringInfo(&err, " : PXF not correctly installed in CLASSPATH");
+			}
 			else
+			{
 				appendStringInfo(&err, ": %s", http_error_msg);
-
-			elog(ERROR, "%s", err.data);
+			}
 		}
+
+		elog(ERROR, "%s", err.data);
+
 	}
 
 	free_http_response(context);
@@ -1069,12 +1076,12 @@ void realloc_internal_buffer(churl_buffer* buffer, size_t required)
 	buffer->max = n;
 }
 
-bool handle_special_error(long response)
+bool handle_special_error(long response, StringInfo err)
 {
 	switch (response)
 	{
 		case 404:
-			elog(ERROR, "GPHD component not found");
+			appendStringInfo(err, ": PXF service could not be reached. PXF is not running in the tomcat
container");
 			break;
 		default:
 			return false;


Mime
View raw message