NIFI-9436 - In AbstractPutHDFSRecord make sure the record writers use the FileSystem object the processor already has.

Signed-off-by: Matthew Burgess <mattyb149@apache.org>

This closes #5565
This commit is contained in:
Tamas Palfy 2021-12-02 18:56:40 +01:00 committed by Matthew Burgess
parent 2b415de912
commit ff864266f5
No known key found for this signature in database
GPG Key ID: 05D3DEB8126DAD24

View File

@ -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();