Use FileSystem.openFile with FileStatus to reduce NameNode RPCs#6460
Use FileSystem.openFile with FileStatus to reduce NameNode RPCs#6460dlmarion wants to merge 1 commit into
Conversation
This commit changes how we open Hadoop files for reading. Instead of calling Filesystem.open this changes the code to use FileSystem.openFile. The openFile method returns a Builder object that has a setter method for a FileStatus object. HDFS-17593 adds logic to the DFSClient to use the located blocks in the FileStatus to reduce NameNode RPCs to get the block locations. This is useful in code where we happen to already have the FileStatus object for the associated file that we want to open.
|
The places in the 2.1 code that can currently take advantage of this are in the bulk import code, FileUtils, and RecoveryLogsIterator. FYI that HDFS-17593 has been merged into the un-released Hadoop 3.5.1 and 3.6.0 versions. The changes are compatible with the current Hadoop dependency, but not with older versions. We would need to change our minimum compatibility level for Hadoop from 3.0.3 to 3.3.0. |
|
This change requires #6461 to pass the build checks |
ctubbsii
left a comment
There was a problem hiding this comment.
null is used a lot. Instead of adding a nullable parameter, it'd be better to overload the forFile method with a version that requires the parameter (requireNonNull) and one that omits it. The diff would be a lot smaller that way, as code that passes null wouldn't need to change.
This commit changes how we open Hadoop files for reading. Instead of calling Filesystem.open this changes the code to use FileSystem.openFile. The openFile method returns a Builder object that has a setter method for a FileStatus object. HDFS-17593 adds logic to the DFSClient to use the located blocks in the FileStatus to reduce NameNode RPCs to get the block locations. This is useful in code where we happen to already have the FileStatus object for the associated file that we want to open.