bobpaulin commented on code in PR #11872:
URL: https://github.com/apache/nifi/pull/11872#discussion_r4556352819
##########
nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/manager/ConnectorEntityMerger.java:
##########
@@ -202,6 +238,45 @@ private static void mergeState(final ConnectorDTO
clientDto, final Map<NodeIdent
clientDto.setState(mergedState);
}
+ private static void mergeFlowEvolutionStatus(final ConnectorDTO clientDto,
final Map<NodeIdentifier, ConnectorDTO> dtoMap) {
+ boolean anyPhaseTwo = false;
+ boolean anyEarlierPhase = false;
+ for (final ConnectorDTO nodeConnector : dtoMap.values()) {
+ final FlowEvolutionStatus status =
reportedFlowEvolutionStatus(nodeConnector);
+ if (status == FlowEvolutionStatus.PHASE_TWO_COMPLETE) {
+ anyPhaseTwo = true;
+ } else if (status == FlowEvolutionStatus.PHASE_ONE_PENDING ||
status == FlowEvolutionStatus.PHASE_ONE_COMPLETE) {
+ anyEarlierPhase = true;
+ }
+ }
+ // A node that has finished reports INACTIVE once it is RUNNING. While
a peer is still at phase two, count the
+ // finished node as phase two. Doing that for an earlier phase would
hide a node that has not started.
+ final boolean countRunningInactiveAsPhaseTwo = anyPhaseTwo &&
!anyEarlierPhase;
Review Comment:
Following up: I've adopted part of this. Applying the upgraded flow now uses
the existing update path: after the drain, the connector goes through
prepareForUpdate and completeUpdate, so PREPARING_FOR_UPDATE, UPDATING and
UPDATED coordinate the cluster as they do for a configuration update.
FlowEvolutionStatus now covers only the drain barrier (EVOLVE_DRAIN_PENDING,
EVOLVE_DRAIN_COMPLETE, FAILED), and the merge simply ignores INACTIVE nodes and
takes the earliest status, so the RUNNING/INACTIVE special case is gone. I kept
the drain barrier separate because every node has to finish draining before any
node replaces its flow, and a failed drain rolls back differently from a failed
apply.
--
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]