Skip to content

NIFI-15696 - Add Rebase operation for versioned process groups#10994

Open
pvillard31 wants to merge 1 commit intoapache:mainfrom
pvillard31:NIFI-15696
Open

NIFI-15696 - Add Rebase operation for versioned process groups#10994
pvillard31 wants to merge 1 commit intoapache:mainfrom
pvillard31:NIFI-15696

Conversation

@pvillard31
Copy link
Contributor

Summary

NIFI-15696 - Add Rebase operation for versioned process groups

When a versioned process group is at version N with local modifications (state LOCALLY_MODIFIED_AND_STALE), upgrading to a newer version requires reverting all local changes first, then changing version, then manually re-applying every customization. This is error-prone, causes unnecessary downtime, and discourages users from upgrading.

This change adds a "Rebase" operation that upgrades a versioned process group to a newer registry version while automatically preserving compatible local changes — analogous to git rebase.

How it works:

The rebase operation has two phases:

  • Analysis (read-only): Computes a three-way diff between the local flow, the base registry version (N), and the target registry version. Each local change is classified as Compatible (will be preserved), Conflicting (same field changed both locally and upstream to different values), or Unsupported (change type not yet supported by a rebase handler). Rebase is only allowed when all local changes are compatible.
  • Execution: Deep-clones the target version snapshot, overlays compatible local changes onto it to produce a merged snapshot, then synchronizes the process group to the merged snapshot using the existing FlowUpdateResource async infrastructure. The VCI is set to the clean target version so that subsequent state checks correctly report LOCALLY_MODIFIED.

Supported change types (for this first iteration, this will evolve over time):

  • POSITION_CHANGED, SIZE_CHANGED, BENDPOINTS_CHANGED — cosmetic, always compatible (local wins)
  • PROPERTY_CHANGED, PROPERTY_ADDED — compatible unless upstream changed the same property on the same component to a different value (convergent changes where both sides set the same value are accepted)
  • COMMENTS_CHANGED — compatible unless upstream also changed comments on the same component
    Unsupported change types (examples: COMPONENT_ADDED, COMPONENT_REMOVED) block the rebase with a clear message. The handler architecture is extensible — adding support for a new change type requires only implementing a single RebaseHandler class.

We follow a similar approach as what already exists for the new API endpoints:

  • GET /versions/rebase-analysis/process-groups/{id}?targetVersion={version}
    returns the three-way analysis
  • POST /versions/rebase-requests/process-groups/{id}
    initiates async rebase execution
  • GET/DELETE /versions/rebase-requests/{id}
    polling and cleanup (reuses FlowUpdateResource)

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

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant