[
https://issues.apache.org/jira/browse/NIFI-13393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jim Steinebrey updated NIFI-13393:
----------------------------------
Description:
This PR is a proposal to see if the PMC agrees with this API change.
I have not written any new unit tests for this PR yet until I get buy-in on it.
I added two new create methods to the API of ProcessSession to allow the option
of
passing in ff attributes to be added to the flow file being created. This is not
a breaking change because the original create methods are still there.
ProcessSession
FlowFile create(FlowFile parent, final Map<String, String> attributes);
FlowFile create(final Map<String, String> attributes);
Changing a core API is a very significant change but I hope people will see it
as worthwhile to allow us to to avoid creating an extra FlowFile object in many
places that FlowFiles are created. Not all places set attributes right after \
FF creation, but very many of them do and could benefit.
There are 150+ places where these new methods can be used and I only changed
the
GenerateTableFetch processor to call them so you how the new methods are used.
I expect using these new create methods has the potential to
avoid noticeable transient memory allocation like the earlier API addition of
SessionContext.isAutoTerminated did.
Also if this PR is approved, myself and others can change processors to call
these
new methods in a future PRs (not as part of this PR).
> Avoid making extra transient flow file during FF creation
> ---------------------------------------------------------
>
> Key: NIFI-13393
> URL: https://issues.apache.org/jira/browse/NIFI-13393
> Project: Apache NiFi
> Issue Type: Improvement
> Components: Core Framework
> Affects Versions: 2.0.0-M3
> Reporter: Jim Steinebrey
> Assignee: Jim Steinebrey
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> This PR is a proposal to see if the PMC agrees with this API change.
> I have not written any new unit tests for this PR yet until I get buy-in on
> it.
> I added two new create methods to the API of ProcessSession to allow the
> option of
> passing in ff attributes to be added to the flow file being created. This is
> not
> a breaking change because the original create methods are still there.
> ProcessSession
> FlowFile create(FlowFile parent, final Map<String, String> attributes);
> FlowFile create(final Map<String, String> attributes);
> Changing a core API is a very significant change but I hope people will see
> it
> as worthwhile to allow us to to avoid creating an extra FlowFile object in
> many
> places that FlowFiles are created. Not all places set attributes right after \
> FF creation, but very many of them do and could benefit.
> There are 150+ places where these new methods can be used and I only changed
> the
> GenerateTableFetch processor to call them so you how the new methods are used.
> I expect using these new create methods has the potential to
> avoid noticeable transient memory allocation like the earlier API addition of
> SessionContext.isAutoTerminated did.
> Also if this PR is approved, myself and others can change processors to call
> these
> new methods in a future PRs (not as part of this PR).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)