NIFI-5871 ignore UUID attribute when copying flow file attributes#3203
NIFI-5871 ignore UUID attribute when copying flow file attributes#3203patricker merged 7 commits intoapache:masterfrom
Conversation
There was a problem hiding this comment.
You can probably just copy the existing code from StandardProcessSession, then it will be consistent:
final Map<String, String> updatedAttributes;
if (attributes.containsKey(CoreAttributes.UUID.key())) {
updatedAttributes = new HashMap<>(attributes);
updatedAttributes.remove(CoreAttributes.UUID.key());
} else {
updatedAttributes = attributes;
}
|
|
||
| newFlowFile.putAttributes(attrs); | ||
| Map<String, String> attrCopy = new HashMap<>(); | ||
| attrCopy.putAll(attrs); |
There was a problem hiding this comment.
Only change I'd make here is putting that into the constructor. Other than that LGTM.
|
@patricker I've incorporated your feedback |
|
At least one processor's unit tests are expecting the same UUID to be present. |
MikeThomsen
left a comment
There was a problem hiding this comment.
Running the build locally and got build errors that need to be address:
[ERROR] Tests run: 15, Failures: 4, Errors: 0, Skipped: 0, Time elapsed: 0.483 s <<< FAILURE! - in org.apache.nifi.processors.standard.TestWait
[ERROR] testReplaceAttributes(org.apache.nifi.processors.standard.TestWait) Time elapsed: 0.077 s <<< FAILURE!
org.junit.ComparisonFailure: expected:<[3d5b9e68-5960-4557-aadd-89f299b7f7c0]> but was:<[5db4833b-4406-405c-bbfe-3e271a2aeec5]>
at org.apache.nifi.processors.standard.TestWait.testReplaceAttributes(TestWait.java:238)
[ERROR] testWaitForTotalCount(org.apache.nifi.processors.standard.TestWait) Time elapsed: 0.006 s <<< FAILURE!
org.junit.ComparisonFailure: expected:<[2bcf93d4-2bca-4377-b647-baa4d26e4e28]> but was:<[d467324b-1bf6-4a62-821d-3d1df7dfa3ba]>
at org.apache.nifi.processors.standard.TestWait.testWaitForTotalCount(TestWait.java:363)
[ERROR] testWaitForSpecificCount(org.apache.nifi.processors.standard.TestWait) Time elapsed: 0.006 s <<< FAILURE!
org.junit.ComparisonFailure: expected:<8[8f03f6e-b58d-432b-95fd-3438e399f018]> but was:<8[22e1e1e-25f0-4db9-8a36-15a8d24b1532]>
at org.apache.nifi.processors.standard.TestWait.testWaitForSpecificCount(TestWait.java:450)
[ERROR] testKeepOriginalAttributes(org.apache.nifi.processors.standard.TestWait) Time elapsed: 0.001 s <<< FAILURE!
org.junit.ComparisonFailure: expected:<[7836fb9a-a276-404d-9c13-d51984bc2f6b]> but was:<[bc5fbf7e-3945-4d79-9d21-e84b44adea57]>
at org.apache.nifi.processors.standard.TestWait.testKeepOriginalAttributes(TestWait.java:282)
|
Now this is strange - is there a remote chance that this behavior (copying UUID) is expected and it's not a bug? Or is this just an unit test with incorrect assumptions? |
|
@SavtechSolutions Yes, this is a bug in the tests I think. |
|
@patricker Yes, I'm inclined to agree - the enqueue() call with attributes uses the same putAllAttributes call under the hood, so there's no way it should be able to retain the UUID attribute. I'll get to fix the tests, thanks. |
|
AFAIK, there is no reason why uuid should be inherited by a flowfile even in a parent-child scenario since the child is a new flowfile branched off. |
|
@MikeThomsen I think the test is showing that this isn't a parent/child scenario, but showing that it's the same FlowFile from start to finish. If there were a way to inject content into |
Thank you for submitting a contribution to Apache NiFi.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically master)?
Is your initial contribution a single, squashed commit?
For code changes:
For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.