Skip to content

MINIFICPP-1347 Do not override MergeContent output attributes#888

Closed
lordgamez wants to merge 3 commits intoapache:mainfrom
lordgamez:MINIFICPP-1321_mime_type
Closed

MINIFICPP-1347 Do not override MergeContent output attributes#888
lordgamez wants to merge 3 commits intoapache:mainfrom
lordgamez:MINIFICPP-1321_mime_type

Conversation

@lordgamez
Copy link
Contributor

@lordgamez lordgamez commented Aug 31, 2020

This commit handles the case when flowfiles processed by MergeContent
could have common attributes, with the same value (like mime type)
which after the attribute merge would override the individually set
output attribute.

Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.

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 MINIFICPP-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 main)?

  • Is your initial contribution a single, squashed commit?

For code changes:

  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0?
  • If applicable, have you updated the LICENSE file?
  • If applicable, have you updated the NOTICE file?

For documentation related changes:

  • Have you ensured that format looks appropriate for the output in which it is rendered?

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.

This commit handles the case when flowfiles processed by MergeContent
could have common attributes, with the same value (like mime type)
which after the attribute merge would override the individually set
output attribute.
@lordgamez lordgamez changed the title MINIFICPP-1321 Do not override MergeContent output attributes MINIFICPP-1347 Do not override MergeContent output attributes Sep 1, 2020
Copy link
Contributor

@arpadboda arpadboda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix itself looks good, but config issues should be handled in onschedule.
You can set up a member function ptr there to simply call it when flowfiles are actually processed.

KeepAllUniqueAttributesMerger(bin->getFlowFile()).mergeAttributes(session, merge_flow);
else {
logger_->log_error("Attribute strategy not supported %s", attributeStrategy_);
throw minifi::Exception(ExceptionType::PROCESSOR_EXCEPTION, "Invalid attribute strategy: " + attributeStrategy_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this error should be handled in onSchedule.
This function (processbin) is called runtime, config issues shouldn't be handled here.

@lordgamez lordgamez requested a review from arpadboda September 7, 2020 15:31
Copy link
Contributor

@arpadboda arpadboda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@arpadboda arpadboda closed this in 365523f Sep 7, 2020
arpadboda pushed a commit that referenced this pull request Sep 14, 2020
This commit handles the case when flowfiles processed by MergeContent
could have common attributes, with the same value (like mime type)
which after the attribute merge would override the individually set
output attribute.

Signed-off-by: Arpad Boda <aboda@apache.org>

This closes #888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants