-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NIFI-12923 Added append avro mode to PutHDFS #8544
Conversation
a8ac014
to
f9ba16f
Compare
&& AVRO_APPEND_MODE.equals(appendMode) | ||
&& destinationExists) { | ||
getLogger().info("Appending avro record to existing avro file"); | ||
try (final var reader = new DataFileStream<>(in, new GenericDatumReader<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't backport to 1.x because var
wasn't introduced until Java 10 and we still have to support Java 8 on 1.x for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One additional note, use of var
should be avoided in general, even when supported in the main branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noted, thank you for the feedback. Fixed in 04a1ed7.
@@ -160,6 +170,14 @@ public class PutHDFS extends AbstractHadoopProcessor { | |||
.allowableValues(WRITE_AND_RENAME_AV, SIMPLE_WRITE_AV) | |||
.build(); | |||
|
|||
public static final PropertyDescriptor APPEND_MODE = new PropertyDescriptor.Builder() | |||
.name("Append mode") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.name("Append mode") | |
.name("Append Mode") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
...oop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
Outdated
Show resolved
Hide resolved
In order for the append to work I had to set |
To be honest, during the whole dev testing I left the 'Writing Strategy' property on default value which is 'Write and rename', and it worked completely fine for me. I double checked it now and it still does. As I see it, my ticket does not affect the connection between writing strategy and conflict resolution strategy so it should work just as before. I also checked 'Writing strategy'='Simple write', and that also works for me without any problems. If you experience file deletion I assume your flow might need a tweak. I do not know the processors you use exactly, but I had file deletion problems when I left the 'GetHDFS' or the 'GetFile' processors 'Keep source file' on default which is 'false'. In order to make my flow reexecutable I changed that value to 'true'. For testing I used the following flow:
|
0d92f2d
to
909810b
Compare
909810b
to
f23bc5a
Compare
I had to rebase to |
Now I'm running into this in my test environment, trying to change the default filesystem now. |
+1 LGTM, verified the Avro append capability works as expected. Thanks for the improvement! Merging to main and support/nifi-1.x |
NIFI-12923 remove var keyword NIFI-12923 change property name NIFI-12923 Added property dependency for append_mode Signed-off-by: Matt Burgess <mattyb149@apache.org> This closes apache#8544
NIFI-12923 remove var keyword NIFI-12923 change property name NIFI-12923 Added property dependency for append_mode Signed-off-by: Matt Burgess <mattyb149@apache.org> This closes apache#8544
Summary
NIFI-12923
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000
NIFI-00000
Pull Request Formatting
main
branchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
mvn clean install -P contrib-check
Licensing
LICENSE
andNOTICE
filesDocumentation