From 4a0b7f7ebe107e4124b2679a6e1b1450df66dd7e Mon Sep 17 00:00:00 2001 From: He Xiaoqiao Date: Mon, 8 Mar 2021 12:18:46 +0800 Subject: [PATCH] HDFS-15384. Document getLocatedBlocks(String src, long start) of DFSClient only return partial blocks. Contributed by Yang Yun. --- .../main/java/org/apache/hadoop/hdfs/DFSClient.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java index c2b03cdaad..f568308aff 100755 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSClient.java @@ -861,6 +861,18 @@ public long getRefreshReadBlkLocationsInterval() { return dfsClientConf.getRefreshReadBlockLocationsMS(); } + /** + * Get locations of the blocks of the specified file `src` from offset + * `start` within the prefetch size which is related to parameter + * `dfs.client.read.prefetch.size`. DataNode locations for each block are + * sorted by the proximity to the client. Please note that the prefetch size + * is not equal file length generally. + * + * @param src the file path. + * @param start starting offset. + * @return LocatedBlocks + * @throws IOException + */ public LocatedBlocks getLocatedBlocks(String src, long start) throws IOException { return getLocatedBlocks(src, start, dfsClientConf.getPrefetchSize());