NIFI-4436: Fixed bug that caused a Process Group to be 'dirty' if a processor that was referencing a non-existent controller service is updated to reference an externally available controller service

Signed-off-by: Matt Gilman <matt.c.gilman@gmail.com>
This commit is contained in:
Mark Payne 2018-01-03 15:29:39 -05:00 committed by Bryan Bende
parent b3e1584ef4
commit f702f808a7
No known key found for this signature in database
GPG Key ID: A0DDA9ED50711C39
3 changed files with 23 additions and 3 deletions

View File

@ -240,7 +240,7 @@ public class StandardFlowSynchronizer implements FlowSynchronizer {
existingFlowEmpty = taskElements.isEmpty()
&& unrootedControllerServiceElements.isEmpty()
&& isEmpty(rootGroupDto)
&& registriesPresent;
&& !registriesPresent;
logger.debug("Existing Flow Empty = {}", existingFlowEmpty);
}
}

View File

@ -3316,7 +3316,17 @@ public final class StandardProcessGroup implements ProcessGroup {
ancestorServiceIds = Collections.emptySet();
} else {
ancestorServiceIds = parentGroup.getControllerServices(true).stream()
.map(ControllerServiceNode::getIdentifier)
.map(cs -> {
// We want to map the Controller Service to its Versioned Component ID, if it has one.
// If it does not have one, we want to generate it in the same way that our Flow Mapper does
// because this allows us to find the Controller Service when doing a Flow Diff.
final Optional<String> versionedId = cs.getVersionedComponentId();
if (versionedId.isPresent()) {
return versionedId.get();
}
return UUID.nameUUIDFromBytes(cs.getIdentifier().getBytes(StandardCharsets.UTF_8)).toString();
})
.collect(Collectors.toSet());
}

View File

@ -3824,7 +3824,17 @@ public class StandardNiFiServiceFacade implements NiFiServiceFacade {
ancestorServiceIds = Collections.emptySet();
} else {
ancestorServiceIds = parentGroup.getControllerServices(true).stream()
.map(ControllerServiceNode::getIdentifier)
.map(cs -> {
// We want to map the Controller Service to its Versioned Component ID, if it has one.
// If it does not have one, we want to generate it in the same way that our Flow Mapper does
// because this allows us to find the Controller Service when doing a Flow Diff.
final Optional<String> versionedId = cs.getVersionedComponentId();
if (versionedId.isPresent()) {
return versionedId.get();
}
return UUID.nameUUIDFromBytes(cs.getIdentifier().getBytes(StandardCharsets.UTF_8)).toString();
})
.collect(Collectors.toSet());
}