tpalfy commented on a change in pull request #3652: NIFI-5452: Allow For
Ignoring Block Locality When Writing to HDFS
URL: https://github.com/apache/nifi/pull/3652#discussion_r314691315
##########
File path:
nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
##########
@@ -313,8 +328,18 @@ public void process(InputStream in) throws IOException {
if
(conflictResponse.equals(APPEND_RESOLUTION_AV.getValue()) && destinationExists)
{
fos = hdfs.append(copyFile, bufferSize);
} else {
- fos = hdfs.create(tempCopyFile, true,
bufferSize, replication, blockSize);
- }
+ final EnumSet<CreateFlag> cflags =
EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE);
+
+ final Boolean ignoreLocality =
context.getProperty(IGNORE_LOCALITY).asBoolean();
+ if (ignoreLocality.booleanValue()) {
+
cflags.add(CreateFlag.IGNORE_CLIENT_LOCALITY);
+ }
+
+ fos = hdfs.create(tempCopyFile,
FsCreateModes.applyUMask(FsPermission.getFileDefault(),
+ FsPermission.getUMask(hdfs.getConf())),
cflags, bufferSize, replication, blockSize,
+ null, null);
+ }
Review comment:
Minor: The indentation of this closing curly bracket is off.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services