This is an automated email from the ASF dual-hosted git repository.
kevdoran pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new e085bd0853a NIFI-16374: Rename migrated source Process Groups as
decommissioned (#11703)
e085bd0853a is described below
commit e085bd0853a0d94bf4848eea2ecd4cc1cc24e872
Author: Matt Gilman <[email protected]>
AuthorDate: Mon Sep 21 16:43:56 2026 -0400
NIFI-16374: Rename migrated source Process Groups as decommissioned (#11703)
---
.../src/main/asciidoc/administration-guide.adoc | 4 +-
.../StandardConnectorMigrationManager.java | 8 ++-
.../TestStandardConnectorMigrationManager.java | 69 ++++++++++++----------
.../AbstractConnectorVersionedFlowMigrationIT.java | 2 +-
4 files changed, 48 insertions(+), 35 deletions(-)
diff --git a/nifi-docs/src/main/asciidoc/administration-guide.adoc
b/nifi-docs/src/main/asciidoc/administration-guide.adoc
index 71be334e234..6f0401ed98b 100644
--- a/nifi-docs/src/main/asciidoc/administration-guide.adoc
+++ b/nifi-docs/src/main/asciidoc/administration-guide.adoc
@@ -3978,8 +3978,10 @@ After migration, configure the Connector with any
missing secret values before s
=== Cleanup after a successful migration
-After a successful local migration, NiFi disables the source Process Group and
renames it with the `(Migrated) ` prefix.
+After a successful local migration, NiFi disables the source Process Group and
renames it with the `(Decommissioned) ` prefix.
This makes it clear that the source flow has already been used as the basis
for a Connector migration.
+Process Groups finalized by earlier NiFi versions can retain the legacy
`(Migrated) ` prefix.
+NiFi recognizes both prefixes as indicating a finalized migration and does not
rename an already-prefixed Process Group.
Uploaded payloads and migration request state are kept only in memory for the
lifetime of the request.
When the request succeeds, fails, or is cancelled, NiFi removes the uploaded
payload associated with that request.
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorMigrationManager.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorMigrationManager.java
index 2859684d615..493345a598a 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorMigrationManager.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/components/connector/StandardConnectorMigrationManager.java
@@ -63,7 +63,9 @@ import java.util.function.BooleanSupplier;
public class StandardConnectorMigrationManager implements
ConnectorMigrationManager {
private static final Logger logger =
LoggerFactory.getLogger(StandardConnectorMigrationManager.class);
- private static final String MIGRATED_SOURCE_PREFIX = "(Migrated) ";
+ private static final String DECOMMISSIONED_SOURCE_PREFIX =
"(Decommissioned) ";
+ // Earlier versions used this prefix; recognize it to keep migration
finalization idempotent.
+ private static final String LEGACY_MIGRATED_SOURCE_PREFIX = "(Migrated) ";
private final FlowController flowController;
private final ConnectorFlowSnapshotProvider snapshotProvider;
@@ -649,11 +651,11 @@ public class StandardConnectorMigrationManager implements
ConnectorMigrationMana
disableSourcePorts(processGroup);
final String currentName = processGroup.getName();
- if (currentName != null &&
currentName.startsWith(MIGRATED_SOURCE_PREFIX)) {
+ if (currentName != null &&
(currentName.startsWith(DECOMMISSIONED_SOURCE_PREFIX) ||
currentName.startsWith(LEGACY_MIGRATED_SOURCE_PREFIX))) {
return;
}
- processGroup.setName(MIGRATED_SOURCE_PREFIX + currentName);
+ processGroup.setName(DECOMMISSIONED_SOURCE_PREFIX + currentName);
}
private void disableSourceProcessors(final ProcessGroup processGroup) {
diff --git
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/connector/TestStandardConnectorMigrationManager.java
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/connector/TestStandardConnectorMigrationManager.java
index db0c9443b6a..f6968942e5a 100644
---
a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/connector/TestStandardConnectorMigrationManager.java
+++
b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/components/connector/TestStandardConnectorMigrationManager.java
@@ -104,7 +104,7 @@ public class TestStandardConnectorMigrationManager {
migrationManager.migrateFromVersionedFlow(CONNECTOR_ID,
SOURCE_GROUP_ID, sourceFlow);
verify(connectorNode).commitMigratedConfiguration(any(ConnectorConfiguration.class));
- verify(sourceProcessGroup).setName("(Migrated) " + SOURCE_GROUP_NAME);
+ verify(sourceProcessGroup).setName("(Decommissioned) " +
SOURCE_GROUP_NAME);
}
@Test
@@ -137,36 +137,13 @@ public class TestStandardConnectorMigrationManager {
}
@Test
- public void testRenameIsIdempotentWhenSourceAlreadyHasMigratedPrefix()
throws Exception {
- final FlowController flowController = createFlowController(1);
- final ProcessGroup sourceProcessGroup =
wireSourceProcessGroup(flowController, SOURCE_GROUP_ID, "(Migrated) " +
SOURCE_GROUP_NAME);
-
- final ProcessGroup sourceParent = mock(ProcessGroup.class);
- final ProcessorNode runningProcessor = mock(ProcessorNode.class);
-
when(runningProcessor.getDesiredState()).thenReturn(ScheduledState.RUNNING);
- when(runningProcessor.getProcessGroup()).thenReturn(sourceParent);
-
when(sourceProcessGroup.findAllProcessors()).thenReturn(List.of(runningProcessor));
-
- final ControllerServiceNode enabledService =
mock(ControllerServiceNode.class);
-
when(enabledService.getState()).thenReturn(ControllerServiceState.ENABLED);
-
when(sourceProcessGroup.findAllControllerServices()).thenReturn(Set.of(enabledService));
-
- final ControllerServiceProvider controllerServiceProvider =
mock(ControllerServiceProvider.class);
-
when(flowController.getControllerServiceProvider()).thenReturn(controllerServiceProvider);
-
- wireFreshConnector(flowController, CONNECTOR_ID);
-
- final StandardConnectorMigrationManager migrationManager =
newMigrationManager(flowController);
- final VersionedExternalFlow sourceFlow =
createSourceFlowWithLocalStateCount(1);
-
- migrationManager.migrateFromVersionedFlow(CONNECTOR_ID,
SOURCE_GROUP_ID, sourceFlow);
-
- // The source already had the (Migrated) prefix from a previous
attempt, so it must not be re-prefixed.
- verify(sourceProcessGroup, never()).setName(anyString());
+ public void
testRenameIsIdempotentWhenSourceAlreadyHasDecommissionedPrefix() throws
Exception {
+ assertRenameIsIdempotent("(Decommissioned) " + SOURCE_GROUP_NAME);
+ }
- // Disable must still run unconditionally even when the rename was
skipped.
- verify(sourceParent).disableProcessor(runningProcessor);
-
verify(controllerServiceProvider).disableControllerServicesAsync(List.of(enabledService));
+ @Test
+ public void
testRenameIsIdempotentWhenSourceAlreadyHasLegacyMigratedPrefix() throws
Exception {
+ assertRenameIsIdempotent("(Migrated) " + SOURCE_GROUP_NAME);
}
@Test
@@ -941,6 +918,38 @@ public class TestStandardConnectorMigrationManager {
return connectorNode;
}
+ private void assertRenameIsIdempotent(final String alreadyPrefixedName)
throws Exception {
+ final FlowController flowController = createFlowController(1);
+ final ProcessGroup sourceProcessGroup =
wireSourceProcessGroup(flowController, SOURCE_GROUP_ID, alreadyPrefixedName);
+
+ final ProcessGroup sourceParent = mock(ProcessGroup.class);
+ final ProcessorNode runningProcessor = mock(ProcessorNode.class);
+
when(runningProcessor.getDesiredState()).thenReturn(ScheduledState.RUNNING);
+ when(runningProcessor.getProcessGroup()).thenReturn(sourceParent);
+
when(sourceProcessGroup.findAllProcessors()).thenReturn(List.of(runningProcessor));
+
+ final ControllerServiceNode enabledService =
mock(ControllerServiceNode.class);
+
when(enabledService.getState()).thenReturn(ControllerServiceState.ENABLED);
+
when(sourceProcessGroup.findAllControllerServices()).thenReturn(Set.of(enabledService));
+
+ final ControllerServiceProvider controllerServiceProvider =
mock(ControllerServiceProvider.class);
+
when(flowController.getControllerServiceProvider()).thenReturn(controllerServiceProvider);
+
+ wireFreshConnector(flowController, CONNECTOR_ID);
+
+ final StandardConnectorMigrationManager migrationManager =
newMigrationManager(flowController);
+ final VersionedExternalFlow sourceFlow =
createSourceFlowWithLocalStateCount(1);
+
+ migrationManager.migrateFromVersionedFlow(CONNECTOR_ID,
SOURCE_GROUP_ID, sourceFlow);
+
+ // The source already has a decommissioned or legacy migrated prefix,
so it must not be re-prefixed.
+ verify(sourceProcessGroup, never()).setName(anyString());
+
+ // Disable must still run unconditionally even when the rename was
skipped.
+ verify(sourceParent).disableProcessor(runningProcessor);
+
verify(controllerServiceProvider).disableControllerServicesAsync(List.of(enabledService));
+ }
+
/**
* Mirrors {@link StandardConnectorNode#isMigrationSupported} on the mock
{@link ConnectorNode}: returns false
* unless the underlying {@link Connector} implements {@link
MigratableConnector}, and swallows any exception
diff --git
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/AbstractConnectorVersionedFlowMigrationIT.java
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/AbstractConnectorVersionedFlowMigrationIT.java
index 8dd0b4ebc44..0024020e8e8 100644
---
a/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/AbstractConnectorVersionedFlowMigrationIT.java
+++
b/nifi-system-tests/nifi-system-test-suite/src/test/java/org/apache/nifi/tests/system/connectors/AbstractConnectorVersionedFlowMigrationIT.java
@@ -253,7 +253,7 @@ public abstract class
AbstractConnectorVersionedFlowMigrationIT extends NiFiSyst
protected void assertSourceRenamedAndDisabled(final SourceFixture
sourceFixture, final String originalName) throws NiFiClientException,
IOException {
final ProcessGroupEntity migratedSourceGroup =
getNifiClient().getProcessGroupClient().getProcessGroup(sourceFixture.processGroup().getId());
- assertEquals("(Migrated) " + originalName,
migratedSourceGroup.getComponent().getName());
+ assertEquals("(Decommissioned) " + originalName,
migratedSourceGroup.getComponent().getName());
final ProcessGroupFlowEntity migratedSourceFlow =
getNifiClient().getFlowClient().getProcessGroup(sourceFixture.processGroup().getId());
for (final ProcessorEntity sourceProcessor :
migratedSourceFlow.getProcessGroupFlow().getFlow().getProcessors()) {