Repository: incubator-hawq Updated Branches: refs/heads/master 5ce4130b4 -> 775597818
HAWQ-644. Fix for dispatching dfs filespace for PXF tables Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/77559781 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/77559781 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/77559781 Branch: refs/heads/master Commit: 7755978183ccff28ff5fc7ccbda995f2bb21002f Parents: 5ce4130 Author: Shivram Mani <[email protected]> Authored: Fri Apr 15 13:47:13 2016 -0700 Committer: Shivram Mani <[email protected]> Committed: Fri Apr 15 13:47:13 2016 -0700 ---------------------------------------------------------------------- src/backend/cdb/cdbquerycontextdispatching.c | 15 +++++++++++---- src/bin/gpfusion/gpbridgeapi.c | 10 ---------- 2 files changed, 11 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/77559781/src/backend/cdb/cdbquerycontextdispatching.c ---------------------------------------------------------------------- diff --git a/src/backend/cdb/cdbquerycontextdispatching.c b/src/backend/cdb/cdbquerycontextdispatching.c index c6647cd..efc6079 100644 --- a/src/backend/cdb/cdbquerycontextdispatching.c +++ b/src/backend/cdb/cdbquerycontextdispatching.c @@ -779,21 +779,24 @@ static void RebuildNamespace(QueryContextInfo *cxt) { + MemoryContext oldContext; int len; char buffer[4], *binary; + oldContext = MemoryContextSwitchTo(MessageContext); ReadData(cxt, buffer, sizeof(buffer), TRUE); len = (int) ntohl(*(uint32 *) buffer); binary = palloc(len); if(ReadData(cxt, binary, len, TRUE)) { - StringInfoData buffer; - initStringInfoOfString(&buffer, binary, len); - dfs_address = strdup(buffer.data); + dfs_address = pstrdup(binary); } else { + pfree(binary); + MemoryContextSwitchTo(oldContext); elog(ERROR, "Couldn't rebuild Namespace"); } pfree(binary); + MemoryContextSwitchTo(oldContext); } /* @@ -3031,7 +3034,11 @@ prepareDfsAddressForDispatch(QueryContextInfo* cxt) if (!enable_secure_filesystem) return; const char *namespace = cxt->sharedPath; - int size = strlen(namespace); + elog(DEBUG2, "*********************** MASTER SHARED PATH VALUE %s *********************", cxt->sharedPath); + /* + * Need to account for '\0' when dispatching length + */ + int size = strlen(namespace) + 1; StringInfoData buffer; initStringInfo(&buffer); http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/77559781/src/bin/gpfusion/gpbridgeapi.c ---------------------------------------------------------------------- diff --git a/src/bin/gpfusion/gpbridgeapi.c b/src/bin/gpfusion/gpbridgeapi.c index bd304ac..011b0fc 100644 --- a/src/bin/gpfusion/gpbridgeapi.c +++ b/src/bin/gpfusion/gpbridgeapi.c @@ -62,7 +62,6 @@ void build_uri_for_write(gphadoop_context* context, PxfServer* rest_server); size_t fill_buffer(gphadoop_context* context, char* start, size_t size); void add_delegation_token(PxfInputData *inputData); void free_token_resources(PxfInputData *inputData); -void free_dfs_address(); /* Custom protocol entry point for read */ @@ -242,8 +241,6 @@ void gpbridge_import_start(PG_FUNCTION_ARGS) /* read some bytes to make sure the connection is established */ churl_read_check_connectivity(context->churl_handle); - - free_dfs_address(); } void gpbridge_export_start(PG_FUNCTION_ARGS) @@ -273,8 +270,6 @@ void gpbridge_export_start(PG_FUNCTION_ARGS) context->churl_handle = churl_init_upload(context->uri.data, context->churl_headers); - - free_dfs_address(); } /* @@ -537,8 +532,3 @@ void free_token_resources(PxfInputData *inputData) pfree(inputData->token); } - -void free_dfs_address() -{ - free(dfs_address); -}
