Skip to content

NIFI-10096 Correct nested inherited Parameter Context loading#6114

Closed
exceptionfactory wants to merge 1 commit intoapache:mainfrom
exceptionfactory:NIFI-10096
Closed

NIFI-10096 Correct nested inherited Parameter Context loading#6114
exceptionfactory wants to merge 1 commit intoapache:mainfrom
exceptionfactory:NIFI-10096

Conversation

@exceptionfactory
Copy link
Copy Markdown
Contributor

Summary

NIFI-10096 Corrects loading of inherited Parameter Contexts to avoiding warnings and missing inherited Parameter Context references.

Based on the order of persisted Parameter Contexts, NiFi can load a child context before a parent context, resulting in warnings and missing Parameter Context inheritance references. Building and referencing a map of available Parameter Context names to available Parameter Contexts allows the VersionedFlowSynchronizer to locate inherited Parameter Contexts regardless of persisted order.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using mvn clean install -P contrib-check
    • JDK 8
    • JDK 11
    • JDK 17

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

@joewitt
Copy link
Copy Markdown
Contributor

joewitt commented Jun 9, 2022

@exceptionfactory so gist is we need to load all param contexts found then lookup referenced ones so that we dont attempt to reference something before it has been loaded?

@exceptionfactory
Copy link
Copy Markdown
Contributor Author

@joewitt Yes, prior to this PR, the findReferencedParameterContextIds method relied on the ParameterContextManager as the only source of inherited parameter contexts.

Since NiFi can load Child Context B before Parent Context A, the method would log a warning.

The changes implemented construct a map of available context names from the Versioned Flow so that the references are available regardless of when they are added to the ParameterContextManager. Processing further on ensures that all referenced Parameter Contexts are loaded, so these changes preserve the intent of the FlowManager.withParameterContextResolution method.

Copy link
Copy Markdown
Contributor

@gresockj gresockj left a comment

Choose a reason for hiding this comment

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

Thanks for the fix, @exceptionfactory! The code looks sensible to me, and I tested several scenarios, including the one described in the JIRA issue, as well as exporting and loading a process group with deleted parameter contexts. Everything appears to work as designed.

Will merge this.

@asfgit asfgit closed this in c51f70b Jun 10, 2022
asfgit pushed a commit that referenced this pull request Jun 13, 2022
Signed-off-by: Joe Gresock <jgresock@gmail.com>
This closes #6114.
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