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


##########
nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorRepository.java:
##########
@@ -586,10 +618,155 @@ private void syncFromProviderForRead(final ConnectorNode 
connector) {
     }
 
     @Override
-    public Future<Void> startConnector(final ConnectorNode connector) {
+    public Future<Void> startConnector(final ConnectorNode connector, final 
ConnectorUpdateContext persistenceContext) {
+        Objects.requireNonNull(persistenceContext, "Flow persistence context 
is required");
+
+        final String connectorId = connector.getIdentifier();
+        final CompletableFuture<Void> runningEvolution = 
evolveThenStartFuturesByConnectorId.get(connectorId);
+        if (runningEvolution != null) {
+            return runningEvolution;
+        }
+        if (!connector.isPendingFlowEvolution()) {
+            return connector.start(lifecycleExecutor);
+        }
+
+        final CompletableFuture<Void> evolutionFuture = new 
CompletableFuture<>();
+        final CompletableFuture<Void> existingEvolution = 
evolveThenStartFuturesByConnectorId.putIfAbsent(connectorId, evolutionFuture);
+        if (existingEvolution != null) {
+            return existingEvolution;
+        }
+
+        try {
+            connector.prepareFlowEvolution();

Review Comment:
   [Claude Opus 5.5] Fixed. verifyCanStart now rejects START when an upgrade is 
pending and the Connector is STOPPING, PURGING, or running a user-requested 
drain, so the replicated request fails verification on every node. A START that 
joins an evolution that's already draining is still allowed. A failure in 
prepareFlowEvolution is now logged as an error. Test: 
testVerifyCanStartRequiresStoppedConnectorWhenUpgradePending.



-- 
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