NIFI-15077 : Added conflict resolution strategies for file move operations in FetchFileTransfer#10405
NIFI-15077 : Added conflict resolution strategies for file move operations in FetchFileTransfer#10405ravinarayansingh wants to merge 4 commits intoapache:mainfrom
Conversation
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for proposing this improvement @ravinarayansingh. The concept makes sense, and the basic approach looks good. I noted some recommendations on a few implementation and logging details.
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Show resolved
Hide resolved
...fer/src/main/java/org/apache/nifi/processor/util/file/transfer/FileTransferConflictUtil.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
Thanks for review, @exceptionfactory. |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for updates @ravinarayansingh, there was one previous comment remaining on description formatting, and I recommended some adjustments to the logging messages, then this should be ready to go.
...fer/src/main/java/org/apache/nifi/processor/util/file/transfer/FileTransferConflictUtil.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the incremental adjustments @ravinarayansingh, it looks like just accepting the proposed changes resulted in compilation issues, and a few comments are still unaddressed. If you can work through the remaining items and update the pull request, that would be helpful.
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @ravinarayansingh. This looks better, but handling IGNORE, REJECT, and FAIL with the same case does not seem correct. The IGNORE and NONE options should not log a warning as previously mentioned, and the other two options require routing to a different location.
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
Thanks for the feedback, @exceptionfactory. For the other two options — REJECT and FAIL — should these also log a warning, or should they additionally route the FlowFile to a different relationship (for example, failure or reject)? |
Yes, for IGNORE and NONE, and INFO log looks good.
Those options should log a warning, and route to the appropriate relationship, based on the description for each value. |
|
Hi @exceptionfactory |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @ravinarayansingh.
It looks like the changes resulted in some unit test failures:
TestFTP.testFetchFtpUnicodeFileName:350 expected: <1> but was: <0>
TestFTP.testFetchFtp:257 » IndexOutOfBounds Index 0 out of bounds for length 0
I should have considered this in my previous reply, but the changes surface the fact that the FetchFTP and FetchSFTP Processors do not have failure and reject relationships. They have more specific types of failure relationships, (not found, permission denied, and comms failure), but those do not immediately align with the other failure conditions.
Introducing new relationships creates potential migration problems if not handled programmatically, such as auto-terminating or migrating. That could be done, but on balance, adding new relationships seems to introduce additional complexity for a conditional scenario, which is not ideal.
Taking another look at the options, I think the reject and fail completion strategies should be removed and not supported in this Processor. Instead, limiting support to ignore or rename would avoid introducing new relationships, and still provide more flexibility.
How does that sound?
Hi @exceptionfactory |
|
I’ve updated the code with the following changes to simplify the FetchFileTransfer completion strategy logic:
please have look |
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the redirected approach @ravinarayansingh. The general scope now looks good in terms of output relationships. The new methods, however, presents a number of implementation concerns and need some refactoring to avoid deep levels of nesting and numerous return statements.
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
...e-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/FetchFileTransfer.java
Outdated
Show resolved
Hide resolved
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @ravinarayansingh.
Unfortunately this change appears to be running into to some fundamental limitations of the current design of FetchFileTransfer. Pushing down transfer relationship handling to separate methods, introducing short-circuit returns, and passing around large numbers of method arguments highlight some of the challenges.
It is noteworthy that the Completion Strategy property description indicates that if the strategy fails, a warning will be logged. With that in mind, it seems like the change should much more localized, avoiding FlowFile transfer and other operations in short-circuit methods.
Thanks for the feedback @exceptionfactory I’ve refactored the implementation to make the handling more localized and aligned with the intended design of
This refactoring keeps the behavior consistent with the Completion Strategy description while minimizing side effects and improving maintainability. |
|
hi @exceptionfactory |
|
Thanks for the update @ravinarayansingh. It appears the recent rebase resulted in mixing up a number of things, including far more unexpected changes. To clean this up, and also ensure all commits are signed, please squash all changes into a single commit for now, and I can review the latest version. |
39912ae to
57164cb
Compare
|
@ravinarayansingh Although the commits are signed, it looks like the signing key is not registered with your GitHub account, because the status shows |
…tion message formatting Signed-off-by: ravinarayansingh <ravisingh740@gmail.com>
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for the updates @ravinarayansingh. On further consideration, however, expanding on my most recent comment, I don't think this can go forward. Routing completion failures to a different relationship changes the basic contract of these Processors because. Fundamentally, it is arguable that additional operations like moving or deleting a file should be handled in a separate Processor, which is part of the reason for the more recent DeleteSFTP Processor and similar components. Attempting to combine these independent operations changes basic behavior of this Processor, so I don't think this is the best way to meet the more general use case.
Summary
NIFI-15077
Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000Pull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation