hdfsGetHosts()

Supported by libMapRClient for hadoop-2.x

Gets hostnames where a particular block, as determined by the offset and block size, is stored. Due to replication, a single block could be present on multiple hosts.

This function can be useful for understanding the performance implications of file access, and to validate or verify changes to the replication factor.

Signature

char*** hdfsGetHosts(hdfsFS fs, const char* path, tOffset start, tOffset length)

Parameters

Parameter Description
fs The handle of the filesystem where the file is located. Obtain this handle with one of the hdfsConnect() APIs.
path The path of the file.
start The start of the block.
length The length of the block.

Return Value

If successful, returns a dynamically-allocated two-dimensional array of hostnames. The last element in the array is NULL.

Returns NULL on error.

Check errno for error codes and meanings.