You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hawq.apache.org by od...@apache.org on 2016/07/21 23:56:00 UTC
incubator-hawq git commit: HAWQ-932. Fixed warning.
Repository: incubator-hawq
Updated Branches:
refs/heads/HAWQ-932 66e482120 -> 95ead0153
HAWQ-932. Fixed warning.
Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/95ead015
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/95ead015
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/95ead015
Branch: refs/heads/HAWQ-932
Commit: 95ead0153dc757d6e07d6cb926ea9a10d7aeb7ce
Parents: 66e4821
Author: Oleksandr Diachenko <od...@pivotal.io>
Authored: Thu Jul 21 16:55:51 2016 -0700
Committer: Oleksandr Diachenko <od...@pivotal.io>
Committed: Thu Jul 21 16:55:51 2016 -0700
----------------------------------------------------------------------
src/backend/access/external/libchurl.c | 34 +++++++++++++++----------
src/backend/access/external/pxfmasterapi.c | 2 +-
src/backend/catalog/external/externalmd.c | 2 +-
src/backend/utils/adt/pxf_functions.c | 3 ++-
src/include/access/libchurl.h | 1 +
5 files changed, 25 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/95ead015/src/backend/access/external/libchurl.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/libchurl.c b/src/backend/access/external/libchurl.c
index cc81076..18ba30f 100644
--- a/src/backend/access/external/libchurl.c
+++ b/src/backend/access/external/libchurl.c
@@ -312,13 +312,16 @@ CHURL_HANDLE churl_init_upload(const char* url, CHURL_HEADERS headers)
context->upload = true;
clear_error_buffer(context);
- /* needed to resolve pxf service address */
- struct curl_slist *resolve_hosts = NULL;
- char *pxf_host_entry = (char *) palloc0(strlen(pxf_service_address) + strlen(LocalhostIpV4Entry) + 1);
- strcat(pxf_host_entry, pxf_service_address);
- strcat(pxf_host_entry, LocalhostIpV4Entry);
- resolve_hosts = curl_slist_append(NULL, pxf_host_entry);
- set_curl_option(context, CURLOPT_RESOLVE, resolve_hosts);
+ /* needed to resolve localhost */
+ if (strstr(url, LocalhostIpV4) != NULL) {
+ struct curl_slist *resolve_hosts = NULL;
+ char *pxf_host_entry = (char *) palloc0(strlen(pxf_service_address) + strlen(LocalhostIpV4Entry) + 1);
+ strcat(pxf_host_entry, pxf_service_address);
+ strcat(pxf_host_entry, LocalhostIpV4Entry);
+ resolve_hosts = curl_slist_append(NULL, pxf_host_entry);
+ set_curl_option(context, CURLOPT_RESOLVE, resolve_hosts);
+ pfree(pxf_host_entry);
+ }
set_curl_option(context, CURLOPT_URL, url);
set_curl_option(context, CURLOPT_VERBOSE, (const void*)FALSE);
@@ -349,13 +352,16 @@ CHURL_HANDLE churl_init_download(const char* url, CHURL_HEADERS headers)
context->upload = false;
clear_error_buffer(context);
- /* needed to resolve pxf service address */
- struct curl_slist *resolve_hosts = NULL;
- char *pxf_host_entry = (char *) palloc0(strlen(pxf_service_address) + strlen(LocalhostIpV4Entry) + 1);
- strcat(pxf_host_entry, pxf_service_address);
- strcat(pxf_host_entry, LocalhostIpV4Entry);
- resolve_hosts = curl_slist_append(NULL, pxf_host_entry);
- set_curl_option(context, CURLOPT_RESOLVE, resolve_hosts);
+ /* needed to resolve localhost */
+ if (strstr(url, LocalhostIpV4) != NULL) {
+ struct curl_slist *resolve_hosts = NULL;
+ char *pxf_host_entry = (char *) palloc0(strlen(pxf_service_address) + strlen(LocalhostIpV4Entry) + 1);
+ strcat(pxf_host_entry, pxf_service_address);
+ strcat(pxf_host_entry, LocalhostIpV4Entry);
+ resolve_hosts = curl_slist_append(NULL, pxf_host_entry);
+ set_curl_option(context, CURLOPT_RESOLVE, resolve_hosts);
+ pfree(pxf_host_entry);
+ }
set_curl_option(context, CURLOPT_URL, url);
set_curl_option(context, CURLOPT_VERBOSE, (const void*)FALSE);
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/95ead015/src/backend/access/external/pxfmasterapi.c
----------------------------------------------------------------------
diff --git a/src/backend/access/external/pxfmasterapi.c b/src/backend/access/external/pxfmasterapi.c
index e07277e..833218a 100644
--- a/src/backend/access/external/pxfmasterapi.c
+++ b/src/backend/access/external/pxfmasterapi.c
@@ -434,5 +434,5 @@ List* get_and_cache_external_metadata(GPHDUri* hadoop_uri, char *profile, char *
List* get_no_cache_external_metadata(GPHDUri* hadoop_uri, char *profile, char *pattern, ClientContext *client_context)
{
- return get_external_metadata(hadoop_uri, profile, pattern, client_context, NULL);
+ return get_external_metadata(hadoop_uri, profile, pattern, client_context, InvalidOid);
}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/95ead015/src/backend/catalog/external/externalmd.c
----------------------------------------------------------------------
diff --git a/src/backend/catalog/external/externalmd.c b/src/backend/catalog/external/externalmd.c
index aca07c4..0e39d25 100644
--- a/src/backend/catalog/external/externalmd.c
+++ b/src/backend/catalog/external/externalmd.c
@@ -84,7 +84,7 @@ List *ParsePxfEntries(StringInfo json, char *profile, Oid dboid)
{
struct json_object *jsonItem = json_object_array_get_idx(jsonItems, i);
PxfItem *pxfItem = ParsePxfItem(jsonItem, profile);
- if (dboid != NULL)
+ if (dboid != InvalidOid)
LoadPxfItem(pxfItem, dboid);
tables = lappend(tables, pxfItem);
}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/95ead015/src/backend/utils/adt/pxf_functions.c
----------------------------------------------------------------------
diff --git a/src/backend/utils/adt/pxf_functions.c b/src/backend/utils/adt/pxf_functions.c
index 806565a..f17c9e0 100644
--- a/src/backend/utils/adt/pxf_functions.c
+++ b/src/backend/utils/adt/pxf_functions.c
@@ -19,6 +19,7 @@
#include "postgres.h"
+#include "access/hd_work_mgr.h"
#include "catalog/external/externalmd.h"
#include "fmgr.h"
#include "funcapi.h"
@@ -43,7 +44,7 @@ pxf_item_fields_enum_start(text *profile, text *pattern)
char *profile_cstr = text_to_cstring(profile);
char *pattern_cstr = text_to_cstring(pattern);
- items = get_pxf_item_metadata(profile_cstr, pattern_cstr, NULL);
+ items = get_pxf_item_metadata(profile_cstr, pattern_cstr, InvalidOid);
if (items == NIL)
return NULL;
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/95ead015/src/include/access/libchurl.h
----------------------------------------------------------------------
diff --git a/src/include/access/libchurl.h b/src/include/access/libchurl.h
index 7f7d420..c3ad17d 100644
--- a/src/include/access/libchurl.h
+++ b/src/include/access/libchurl.h
@@ -145,3 +145,4 @@ void print_http_headers(CHURL_HEADERS headers);
#endif
#define LocalhostIpV4Entry ":127.0.0.1"
+#define LocalhostIpV4 "localhost"