hawq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Librago <...@git.apache.org>
Subject [GitHub] incubator-hawq pull request #1384: HAWQ-1628. Add HDFS protocol for external...
Date Thu, 09 Aug 2018 08:04:51 GMT
Github user Librago commented on a diff in the pull request:

    https://github.com/apache/incubator-hawq/pull/1384#discussion_r208437762
  
    --- Diff: src/backend/cdb/cdbdatalocality.c ---
    @@ -1579,7 +1700,242 @@ static void ParquetGetSegFileDataLocation(Relation relation,
     	return;
     }
     
    +static void InvokeHDFSProtocolBlockLocation(Oid    procOid,
    +                                            List  *locs,
    +                                            List **blockLocations)
    +{
    +	ExtProtocolValidatorData   *validator_data;
    +	FmgrInfo				   *validator_udf;
    +	FunctionCallInfoData		fcinfo;
    +
    +	validator_data = (ExtProtocolValidatorData *)
    +					 palloc0 (sizeof(ExtProtocolValidatorData));
    +	validator_udf = palloc(sizeof(FmgrInfo));
    +	fmgr_info(procOid, validator_udf);
    +
    +	validator_data->type 		= T_ExtProtocolValidatorData;
    +	validator_data->url_list 	= locs;
    +	validator_data->format_opts = NULL;
    +	validator_data->errmsg		= NULL;
    +	validator_data->direction 	= EXT_VALIDATE_READ;
    +	validator_data->action		= EXT_VALID_ACT_GETBLKLOC;
    +
    +	InitFunctionCallInfoData(/* FunctionCallInfoData */ fcinfo,
    +							 /* FmgrInfo */ validator_udf,
    +							 /* nArgs */ 0,
    +							 /* Call Context */ (Node *) validator_data,
    +							 /* ResultSetInfo */ NULL);
    +
    +	/* invoke validator. if this function returns - validation passed */
    +	FunctionCallInvoke(&fcinfo);
    +
    +	ExtProtocolBlockLocationData *bls =
    +		(ExtProtocolBlockLocationData *)(fcinfo.resultinfo);
    +	/* debug output block location. */
    +	if (bls != NULL)
    +	{
    +		ListCell *c;
    +		foreach(c, bls->files)
    +		{
    +			blocklocation_file *blf = (blocklocation_file *)(lfirst(c));
    +			elog(DEBUG3, "DEBUG LOCATION for %s with %d blocks",
    +					     blf->file_uri, blf->block_num);
    +			for ( int i = 0 ; i < blf->block_num ; ++i )
    +			{
    +				BlockLocation *pbl = &(blf->locations[i]);
    +				elog(DEBUG3, "DEBUG LOCATION for block %d : %d, "
    +						     INT64_FORMAT ", " INT64_FORMAT ", %d",
    +						     i,
    +						     pbl->corrupt, pbl->length, pbl->offset,
    +							 pbl->numOfNodes);
    +				for ( int j = 0 ; j < pbl->numOfNodes ; ++j )
    +				{
    +					elog(DEBUG3, "DEBUG LOCATION for block %d : %s, %s, %s",
    +							     i,
    +							     pbl->hosts[j], pbl->names[j],
    +								 pbl->topologyPaths[j]);
    +				}
    +			}
    +		}
    +	}
     
    +	elog(DEBUG3, "after invoking get block location API");
    +
    +	/* get location data from fcinfo.resultinfo. */
    +	if (bls != NULL)
    +	{
    +		Assert(bls->type == T_ExtProtocolBlockLocationData);
    +		while(list_length(bls->files) > 0)
    +		{
    +			void *v = lfirst(list_head(bls->files));
    +			bls->files = list_delete_first(bls->files);
    +			*blockLocations = lappend(*blockLocations, v);
    +		}
    +	}
    +	pfree(validator_data);
    +	pfree(validator_udf);
    +}
    +
    +Oid
    +LookupCustomProtocolBlockLocationFunc(char *protoname)
    +{
    +	List*	funcname 	= NIL;
    --- End diff --
    
    incorrect indent


---

Mime
View raw message