Xinyu Wang created NIFI-15746:
---------------------------------

             Summary: Inherited parameter contexts unconditionally overwritten 
during versioned flow deployment with KEEP_EXISTING strategy
                 Key: NIFI-15746
                 URL: https://issues.apache.org/jira/browse/NIFI-15746
             Project: Apache NiFi
          Issue Type: Bug
          Components: Flow Versioning
    Affects Versions: 2.5.0
            Reporter: Xinyu Wang


When deploying a versioned flow from NiFi Registry using 
parameterContextHandlingStrategy=KEEP_EXISTING, if a parameter context with the 
same name already exists on the target NiFi instance, its parameter values are 
correctly preserved, but its inherited parameter context list is 
unconditionally replaced with the one from the versioned flow snapshot.

  This is problematic in multi-environment deployment scenarios (e.g., DEV → 
PROD) where the same-named parameter context is intentionally configured with 
different inheritance chains on each environment. The KEEP_EXISTING strategy 
should preserve the existing parameter context as-is — including its 
inheritance — but currently only preserves parameter values while silently 
overwriting the inheritance chain.

  The root cause is in 
StandardVersionedComponentSynchronizer.addMissingConfiguration(), which calls  
currentParameterContext.setInheritedParameterContexts(...) without checking 
whether the current parameter context already has inherited context configured.

  Steps to Reproduce:

  1. Set up two NiFi instances (Instance A and Instance B), both connected to 
the same NiFi Registry.
  2. On Instance B (target), create the following parameter context hierarchy:
    - target-system-params — a top-level parameter context with 
environment-specific parameters
    - shared-service-params — inheriting from target-system-params
  3. On Instance A (source), create the following parameter context hierarchy:
    - source-system-params — a top-level parameter context
    - shared-service-params — inheriting from source-system-params
  4. On Instance A, create a Process Group MyWorkflow containing a nested 
Process Group MyService:
    - MyWorkflow uses parameter context workflow-params
    - MyService uses parameter context shared-service-params
  5. Save MyWorkflow to NiFi Registry as Version 1.
  6. Verify the state on Instance B before deployment:
    - Confirm shared-service-params inherits from target-system-params.
  7. On Instance B, deploy Version 1 from Registry:
  POST 
/process-groups/\{id}/process-groups?parameterContextHandlingStrategy=KEEP_EXISTING
  8. Check shared-service-params on Instance B after deployment.

  Expected Result:

  shared-service-params on Instance B retains its existing inheritance from 
target-system-params. The KEEP_EXISTING strategy should preserve the existing 
parameter context entirely — both its parameters and its inheritance chain.

  Actual Result:

  shared-service-params on Instance B now inherits from source-system-params 
(resolved by name on Instance B). The inheritance chain configured for the 
target environment has been silently overwritten by the source environment's 
definition.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to