bobpaulin commented on code in PR #11872:
URL: https://github.com/apache/nifi/pull/11872#discussion_r4606494097
##########
nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/flow/synchronization/StandardVersionedComponentSynchronizer.java:
##########
@@ -4112,18 +4112,27 @@ private void verifyCanRemoveMissingComponents(final
ProcessGroup processGroup, f
final Map<String, VersionedConnection>
proposedConnectionsByVersionedId = proposedGroup.getConnections().stream()
.collect(Collectors.toMap(VersionedComponent::getIdentifier,
Function.identity()));
- // match group's current connections to proposed connections to
determine if they've been removed
+ // A missing connection, or one whose source changed, is removed
and recreated. Either change drops
+ // queued data, so reject it before synchronization begins. A
destination change updates the connection in place.
for (final Connection connection : processGroup.getConnections()) {
final String versionedId =
connection.getVersionedComponentId().orElse(
VersionedComponentFlowMapper.generateVersionedComponentId(connection.getIdentifier()));
final VersionedConnection proposedConnection =
proposedConnectionsByVersionedId.get(versionedId);
+ final FlowFileQueue flowFileQueue =
connection.getFlowFileQueue();
+ if (flowFileQueue.isEmpty()) {
+ continue;
+ }
+
if (proposedConnection == null) {
- // connection doesn't exist in proposed connections, make
sure it doesn't have any data in it
- final FlowFileQueue flowFileQueue =
connection.getFlowFileQueue();
- if (!flowFileQueue.isEmpty()) {
- throw new IllegalStateException(processGroup + "
cannot be updated to the proposed flow because the proposed flow "
- + "does not contain a match for " + connection + "
and the connection currently has data in the queue.");
- }
+ throw new IllegalStateException(processGroup + " cannot be
updated to the proposed flow because the proposed flow "
+ + "does not contain a match for " + connection + " and
the connection currently has data in the queue.");
+ }
+
+ final String existingSourceId =
connection.getSource().getVersionedComponentId().orElse(null);
Review Comment:
[Claude Opus 5.5] Restored one combined test in
StandardVersionedComponentSynchronizerTest,
testVerifyCanSynchronizeRejectsSourceChangeWhileQueueHasData. It covers a
source change that's rejected while the queue has data and allowed once the
queue is empty. I also pulled out an isSourceChanged helper that both this
check and removeMissingConnections now use.
--
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]