Return-Path: X-Original-To: apmail-hawq-commits-archive@minotaur.apache.org Delivered-To: apmail-hawq-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 506DD18C60 for ; Fri, 13 Nov 2015 01:22:23 +0000 (UTC) Received: (qmail 1722 invoked by uid 500); 13 Nov 2015 01:22:23 -0000 Delivered-To: apmail-hawq-commits-archive@hawq.apache.org Received: (qmail 1682 invoked by uid 500); 13 Nov 2015 01:22:23 -0000 Mailing-List: contact commits-help@hawq.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hawq.incubator.apache.org Delivered-To: mailing list commits@hawq.incubator.apache.org Received: (qmail 1673 invoked by uid 99); 13 Nov 2015 01:22:23 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Nov 2015 01:22:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C2FBD1A2353 for ; Fri, 13 Nov 2015 01:22:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id MEqBddxsfw_P for ; Fri, 13 Nov 2015 01:22:13 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with SMTP id 9F8DB439DC for ; Fri, 13 Nov 2015 01:22:12 +0000 (UTC) Received: (qmail 197 invoked by uid 99); 13 Nov 2015 01:22:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Nov 2015 01:22:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 661DDE5E28; Fri, 13 Nov 2015 01:22:11 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: nhorn@apache.org To: commits@hawq.incubator.apache.org Message-Id: <346b921f171243a0a0fe89bec46fe3f4@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-hawq git commit: HAWQ-102. Change error message when PXF webapp is down Date: Fri, 13 Nov 2015 01:22:11 +0000 (UTC) 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 Authored: Thu Nov 12 17:21:59 2015 -0800 Committer: Noa Horn 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;