Matt Gilman created NIFI-16489:
----------------------------------

             Summary: Reconcile connector canvas state after cluster connection 
changes
                 Key: NIFI-16489
                 URL: https://issues.apache.org/jira/browse/NIFI-16489
             Project: Apache NiFi
          Issue Type: Task
          Components: Core UI
            Reporter: Matt Gilman


h2. Background

After NiFi cluster connection state changes, a newly loaded flow snapshot can 
contain lower revisions or a different authoritative component set than the 
connector canvas currently holds.

The legacy flow designer propagates connectedStateChanged through its load path 
so revision reconciliation can accept the replacement snapshot. The connector 
canvas does not yet provide an equivalent complete contract.

Optimistic added and removed caches introduce an additional risk. If they 
continue filtering a cluster-reconnect snapshot, locally retained entities or 
deletion tombstones can mask authoritative server state indefinitely.

h2. Goals

* Propagate cluster connection-state changes through connector flow loading.
* Treat the first snapshot after a cluster connection-state change as 
authoritative.
* Replace lower-revision local entities when required.
* Prevent optimistic caches from masking the authoritative snapshot.
* Preserve normal durable reconciliation for ordinary polling.
* Keep cluster-state handling scoped to the current connector and process group.

h2. Scope

h3. Cluster State Propagation

* Observe the shared cluster connection-state change signal.
* Capture its value when loading connector flow.
* Reset or consume the signal using the established one-shot behavior.
* Include connectedStateChanged in the typed load-success contract.
* Prevent a state change from one canvas session from leaking into another 
connector or process group.

h3. Authoritative Snapshot Reconciliation

When connectedStateChanged is true:

* Accept server entities even when their revisions are lower than local 
revisions.
* Use the server component set as authoritative.
* Do not retain locally added entities that are absent from the snapshot.
* Do not suppress server entities using stale removal tombstones.
* Clear added and removed reconciliation caches after applying the snapshot.
* Reconcile connections and their endpoints from the same authoritative 
snapshot.

When connectedStateChanged is false:

* Preserve normal optimistic reconciliation.
* Retain creation and deletion tracking until ordinary snapshots acknowledge 
the corresponding mutations.
* Continue protecting the canvas from stale polling responses.

h3. Tests

Add coverage for:

* Propagation of connectedStateChanged through effects and actions.
* Acceptance of a lower-revision authoritative entity.
* Removal of a locally cached added entity absent from the authoritative 
snapshot.
* Restoration of an entity masked by a stale removal tombstone.
* Authoritative replacement of connections and endpoints.
* Clearing both reconciliation caches.
* One-shot consumption of the cluster-state signal.
* Cross-connector and cross-process-group isolation.
* Unchanged optimistic behavior during ordinary polling.
* Initial-load and refresh-failure behavior.

h2. Dependencies

* NIFI-16447

h2. Out of Scope

* Changes to NiFi cluster lifecycle semantics.
* Backend flow synchronization changes.
* General component creation or deletion.
* Migration of the legacy flow-designer canvas.

h2. Acceptance Criteria

* Connector flow loading carries the cluster connection-state change signal.
* The first post-change snapshot can replace entities with lower revisions.
* The authoritative snapshot is not filtered by optimistic add/remove caches.
* Added and removed caches are cleared after authoritative reconciliation.
* Ordinary polling retains its stale-response protections.
* Cluster-state changes cannot affect an unrelated connector or process group.
* Unit tests cover lower revisions, added entities, removed entities, 
connections, cache clearing, and ordinary polling.
* Frontend lint, strict type-check, unit tests, and production build pass.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to