-
Notifications
You must be signed in to change notification settings - Fork 3k
NIFI-16232 - Allow versioned flow updates to drain removed connections #11570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pvillard31
wants to merge
10
commits into
apache:main
Choose a base branch
from
pvillard31:NIFI-16232
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e152b68
NIFI-16232 - Allow versioned flow updates to drain removed connections
pvillard31 7461278
queue size fix
pvillard31 0c865e9
fix clustering
pvillard31 3ea4c87
fix IT
pvillard31 1c3ae6c
review
pvillard31 562b8ae
fix test
pvillard31 d9c3764
fix test
pvillard31 e8fb054
rebase
pvillard31 86dde12
review
pvillard31 24c9f14
fix
pvillard31 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...i-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/FlowUpdateImpact.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.nifi.web; | ||
|
|
||
| import org.apache.nifi.web.api.entity.AffectedComponentEntity; | ||
|
|
||
| import java.util.Collections; | ||
| import java.util.LinkedHashSet; | ||
| import java.util.Objects; | ||
| import java.util.Set; | ||
|
|
||
| public final class FlowUpdateImpact { | ||
| private final Set<AffectedComponentEntity> affectedComponents; | ||
| private final Set<RemovedConnectionDescriptor> removedConnections; | ||
| private final Set<String> removedProcessGroupIds; | ||
| private final Set<String> removedEndpointIds; | ||
|
|
||
| public FlowUpdateImpact(final Set<AffectedComponentEntity> affectedComponents, | ||
| final Set<RemovedConnectionDescriptor> removedConnections, | ||
| final Set<String> removedProcessGroupIds, | ||
| final Set<String> removedEndpointIds) { | ||
| this.affectedComponents = unmodifiableCopy(affectedComponents); | ||
| this.removedConnections = unmodifiableCopy(removedConnections); | ||
| this.removedProcessGroupIds = unmodifiableCopy(removedProcessGroupIds); | ||
| this.removedEndpointIds = unmodifiableCopy(removedEndpointIds); | ||
| } | ||
|
|
||
| public Set<AffectedComponentEntity> getAffectedComponents() { | ||
| return affectedComponents; | ||
| } | ||
|
|
||
| public Set<RemovedConnectionDescriptor> getRemovedConnections() { | ||
| return removedConnections; | ||
| } | ||
|
|
||
| public Set<String> getRemovedProcessGroupIds() { | ||
| return removedProcessGroupIds; | ||
| } | ||
|
|
||
| public Set<String> getRemovedEndpointIds() { | ||
| return removedEndpointIds; | ||
| } | ||
|
|
||
| private static <T> Set<T> unmodifiableCopy(final Set<T> values) { | ||
| if (values == null || values.isEmpty()) { | ||
| return Collections.emptySet(); | ||
| } | ||
|
|
||
| return Collections.unmodifiableSet(new LinkedHashSet<>(values)); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(final Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (!(obj instanceof final FlowUpdateImpact other)) { | ||
| return false; | ||
| } | ||
|
|
||
| return Objects.equals(affectedComponents, other.affectedComponents) | ||
| && Objects.equals(removedConnections, other.removedConnections) | ||
| && Objects.equals(removedProcessGroupIds, other.removedProcessGroupIds) | ||
| && Objects.equals(removedEndpointIds, other.removedEndpointIds); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(affectedComponents, removedConnections, removedProcessGroupIds, removedEndpointIds); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/RemovalReason.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.nifi.web; | ||
|
|
||
| public enum RemovalReason { | ||
| COMPONENT_REMOVED, | ||
| SOURCE_CHANGED | ||
| } |
136 changes: 136 additions & 0 deletions
136
.../nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/RemovedConnectionDescriptor.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.nifi.web; | ||
|
|
||
| import org.apache.nifi.connectable.ConnectableType; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| public final class RemovedConnectionDescriptor { | ||
| private final String connectionInstanceId; | ||
| private final String connectionVersionedId; | ||
| private final String containingProcessGroupId; | ||
| private final String sourceInstanceId; | ||
| private final String sourceVersionedId; | ||
| private final String sourceProcessGroupId; | ||
| private final ConnectableType sourceType; | ||
| private final String destinationInstanceId; | ||
| private final String destinationVersionedId; | ||
| private final String destinationProcessGroupId; | ||
| private final ConnectableType destinationType; | ||
| private final RemovalReason removalReason; | ||
|
|
||
| public RemovedConnectionDescriptor(final String connectionInstanceId, final String connectionVersionedId, | ||
| final String containingProcessGroupId, | ||
| final String sourceInstanceId, final String sourceVersionedId, final String sourceProcessGroupId, | ||
| final ConnectableType sourceType, | ||
| final String destinationInstanceId, final String destinationVersionedId, | ||
| final String destinationProcessGroupId, final ConnectableType destinationType, | ||
| final RemovalReason removalReason) { | ||
| this.connectionInstanceId = connectionInstanceId; | ||
| this.connectionVersionedId = connectionVersionedId; | ||
| this.containingProcessGroupId = containingProcessGroupId; | ||
| this.sourceInstanceId = sourceInstanceId; | ||
| this.sourceVersionedId = sourceVersionedId; | ||
| this.sourceProcessGroupId = sourceProcessGroupId; | ||
| this.sourceType = sourceType; | ||
| this.destinationInstanceId = destinationInstanceId; | ||
| this.destinationVersionedId = destinationVersionedId; | ||
| this.destinationProcessGroupId = destinationProcessGroupId; | ||
| this.destinationType = destinationType; | ||
| this.removalReason = removalReason; | ||
| } | ||
|
|
||
| public String getConnectionInstanceId() { | ||
| return connectionInstanceId; | ||
| } | ||
|
|
||
| public String getConnectionVersionedId() { | ||
| return connectionVersionedId; | ||
| } | ||
|
|
||
| public String getContainingProcessGroupId() { | ||
| return containingProcessGroupId; | ||
| } | ||
|
|
||
| public String getSourceInstanceId() { | ||
| return sourceInstanceId; | ||
| } | ||
|
|
||
| public String getSourceVersionedId() { | ||
| return sourceVersionedId; | ||
| } | ||
|
|
||
| public String getSourceProcessGroupId() { | ||
| return sourceProcessGroupId; | ||
| } | ||
|
|
||
| public ConnectableType getSourceType() { | ||
| return sourceType; | ||
| } | ||
|
|
||
| public String getDestinationInstanceId() { | ||
| return destinationInstanceId; | ||
| } | ||
|
|
||
| public String getDestinationVersionedId() { | ||
| return destinationVersionedId; | ||
| } | ||
|
|
||
| public String getDestinationProcessGroupId() { | ||
| return destinationProcessGroupId; | ||
| } | ||
|
|
||
| public ConnectableType getDestinationType() { | ||
| return destinationType; | ||
| } | ||
|
|
||
| public RemovalReason getRemovalReason() { | ||
| return removalReason; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(final Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (!(obj instanceof final RemovedConnectionDescriptor other)) { | ||
| return false; | ||
| } | ||
|
|
||
| return Objects.equals(connectionInstanceId, other.connectionInstanceId) | ||
| && Objects.equals(connectionVersionedId, other.connectionVersionedId) | ||
| && Objects.equals(containingProcessGroupId, other.containingProcessGroupId) | ||
| && Objects.equals(sourceInstanceId, other.sourceInstanceId) | ||
| && Objects.equals(sourceVersionedId, other.sourceVersionedId) | ||
| && Objects.equals(sourceProcessGroupId, other.sourceProcessGroupId) | ||
| && sourceType == other.sourceType | ||
| && Objects.equals(destinationInstanceId, other.destinationInstanceId) | ||
| && Objects.equals(destinationVersionedId, other.destinationVersionedId) | ||
| && Objects.equals(destinationProcessGroupId, other.destinationProcessGroupId) | ||
| && destinationType == other.destinationType | ||
| && removalReason == other.removalReason; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(connectionInstanceId, connectionVersionedId, containingProcessGroupId, | ||
| sourceInstanceId, sourceVersionedId, sourceProcessGroupId, sourceType, | ||
| destinationInstanceId, destinationVersionedId, destinationProcessGroupId, destinationType, | ||
| removalReason); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[GPT-5.6 Sol] Please add JavaDoc for this new service-facade method, including what runtime view the returned context provides and whether callers can expect it to reflect later component-state changes. The restoration code depends on that behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added Javadoc stating that the returned context is a live flow view, not a snapshot of later queue or component state.