bobpaulin commented on code in PR #11872:
URL: https://github.com/apache/nifi/pull/11872#discussion_r4556440212


##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorNode.java:
##########
@@ -1619,6 +1783,623 @@ public boolean isExtensionMissing() {
         return extensionMissing;
     }
 
+    @Override
+    public boolean isPendingFlowEvolution() {
+        synchronized (flowEvolutionLock) {
+            if (extensionMissing) {
+                return false;
+            }
+
+            final ConnectorFlowSnapshot snapshot = authoritativeFlowSnapshot;
+            final Bundle snapshotBundle = snapshot == null ? null : 
snapshot.bundle();
+            return (snapshotBundle != null && !sameBundle(snapshotBundle, 
bundleCoordinate)) || isFlowEvolutionPhaseOneComplete();
+        }
+    }
+
+    @Override
+    public FlowEvolutionStatus getFlowEvolutionStatus() {
+        return hasFlowEvolutionFailed() ? FlowEvolutionStatus.FAILED : 
flowEvolutionStatus.get();
+    }
+
+    boolean isFlowEvolutionPhaseOneComplete() {
+        synchronized (flowEvolutionLock) {
+            return hasCompletedFlowEvolutionHookProgress()
+                    && (hasFlowEvolutionFailed() || 
isFlowEvolutionInProgress());
+        }
+    }
+
+    private boolean hasCompletedFlowEvolutionHookProgress() {
+        final FlowEvolutionStatus status = flowEvolutionStatus.get();
+        return status == FlowEvolutionStatus.PHASE_ONE_COMPLETE || status == 
FlowEvolutionStatus.PHASE_TWO_COMPLETE;
+    }
+
+    boolean hasFlowEvolutionFailed() {
+        return flowEvolutionFailure.get() != null;
+    }
+
+    private void verifyFlowEvolutionActive() throws FlowUpdateException {
+        if (hasFlowEvolutionFailed() || getCurrentState() != 
ConnectorState.DRAINING) {
+            throw new FlowUpdateException("Flow evolution was cancelled for " 
+ this);
+        }
+    }
+
+    private VersionedProcessGroup getAuthoritativeManagedProcessGroup() {
+        final ConnectorFlowSnapshot snapshot = authoritativeFlowSnapshot;
+        return snapshot == null ? null : snapshot.flow();
+    }
+
+    @Override
+    public ConnectorFlowSnapshot getAuthoritativeFlowSnapshot() {
+        return authoritativeFlowSnapshot;
+    }
+
+    @Override
+    public boolean restorePendingFlowEvolution(final VersionedConnector 
persisted, final List<VersionedConfigurationStep> activeConfiguration,

Review Comment:
   [Claude Opus 5.5] Mostly done. `syncConnector` now picks the case in one 
place: a pending upgrade (`restorePendingFlowEvolution`), Troubleshooting, a 
missing extension, or nothing. A normal restart keeps the flow 
`inheritConfiguration` built and no longer builds it a second time, which is 
where both critical issues came from. Both restore methods used to fall back 
quietly to capturing a snapshot; that's now an explicit 
`ensureAuthoritativeFlowSnapshot()` call. `restoreTroubleshootingManagedFlow` 
still branches on missing extension versus same bundle, because those two cases 
install different things.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to