Skip to content

NIFI-15514: Ensure that Parameter Contexts are assigned to all Proces…#10815

Merged
bbende merged 3 commits intoapache:NIFI-15258from
markap14:NIFI-15514
Feb 3, 2026
Merged

NIFI-15514: Ensure that Parameter Contexts are assigned to all Proces…#10815
bbende merged 3 commits intoapache:NIFI-15258from
markap14:NIFI-15514

Conversation

@markap14
Copy link
Contributor

…s Groups in a Connector and not just the top-level group. Ensure that all components are started when Connector starts instead of just Processors and Controller Services

Summary

NIFI-00000

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 contains commits signed with a registered key indicating Verified status

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 ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

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

@markap14 markap14 added the NIP-11 NIP-11 adds support for Connectors label Jan 27, 2026
@markap14 markap14 marked this pull request as draft January 29, 2026 21:53
markap14 and others added 3 commits January 31, 2026 09:55
…s Groups in a Connector and not just the top-level group. Ensure that all components are started when Connector starts instead of just Processors and Controller Services

- When Working Context is recreated, ensure that we appropriately apply Parameter Context to newly created Process Group(s)
- Ensure that when we cleanup unused assets for Connectors that we consider any assets that are referenced in either the Working or Active context instead of just the Active context
- Ensure that when we stop Process Group we call all tasks in background threads instead of calling .thenRun which could potentially run in the foreground thread
… are properly configured and notified of any configuration changes when parameters change

- Removed the updateParameterContexts from ProcessGroup.updateFlow, which was added in a previous commit as we went a different direction for the fix
@markap14 markap14 marked this pull request as ready for review February 2, 2026 14:36
versionedExternalFlow.setParameterContexts(Map.of());

destinationGroup.updateFlow(versionedExternalFlow, componentIdSeed, false, true, true);
final String contextName = sourceGroup.getParameterContext().getName();
Copy link
Contributor

Choose a reason for hiding this comment

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

Any concern about an NPE here?

Previously line 111 had a check for if (sourceContext != null) { before referencing any field

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the context of a Connector, the group should always have an implicit Parameter Context so we should be safe here.

}
}
collectReferencedAssetIds(connector.getActiveFlowContext(), referencedAssetIds);
collectReferencedAssetIds(connector.getWorkingFlowContext(), referencedAssetIds);
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is called from discardWorkingConfiguration and applyUpdate , wouldn't the working context always have the same references as the active context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I think you're right. I'm trying to remember the exact reason for this. I know I did it when tracking down a bug in which Assets were being removed when they shouldn't be, and that's resolved here. Given where it's called from it may be that this was not the actual root cause. However, I do believe this is a safer approach, in case it's ever called in the future in a way where that assertion (that active and working have the same reference) does not hold.

Copy link
Contributor

@bbende bbende left a comment

Choose a reason for hiding this comment

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

+1 Looks good, ran all system tests

@bbende bbende merged commit 7dc9cf2 into apache:NIFI-15258 Feb 3, 2026
1 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NIP-11 NIP-11 adds support for Connectors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants