You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2021/12/13 18:43:08 UTC
[nifi] 04/22: NIFI-9436 - In AbstractPutHDFSRecord make sure the record writers use the FileSystem object the processor already has.
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch support/nifi-1.15
in repository https://gitbox.apache.org/repos/asf/nifi.git
commit ddf3a81125694c41d1a3b5906b0a59875d7a82a5
Author: Tamas Palfy <ta...@gmail.com>
AuthorDate: Thu Dec 2 18:56:40 2021 +0100
NIFI-9436 - In AbstractPutHDFSRecord make sure the record writers use the FileSystem object the processor already has.
---
.../nifi/processors/hadoop/AbstractPutHDFSRecord.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java b/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
index a595128..c2fb3bd 100644
--- a/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
+++ b/nifi-nar-bundles/nifi-extension-utils/nifi-record-utils/nifi-hadoop-record-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractPutHDFSRecord.java
@@ -279,8 +279,18 @@ public abstract class AbstractPutHDFSRecord extends AbstractHadoopProcessor {
createDirectory(fileSystem, directoryPath, remoteOwner, remoteGroup);
// write to tempFile first and on success rename to destFile
- final Path tempFile = new Path(directoryPath, "." + filenameValue);
- final Path destFile = new Path(directoryPath, filenameValue);
+ final Path tempFile = new Path(directoryPath, "." + filenameValue) {
+ @Override
+ public FileSystem getFileSystem(Configuration conf) throws IOException {
+ return fileSystem;
+ }
+ };
+ final Path destFile = new Path(directoryPath, filenameValue) {
+ @Override
+ public FileSystem getFileSystem(Configuration conf) throws IOException {
+ return fileSystem;
+ }
+ };
final boolean destinationOrTempExists = fileSystem.exists(destFile) || fileSystem.exists(tempFile);
final boolean shouldOverwrite = context.getProperty(OVERWRITE).asBoolean();