diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java index 6e480d0daa..62d8297244 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java @@ -127,7 +127,6 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable public static final TimeUnit DEFAULT_TIME_UNIT = TimeUnit.MILLISECONDS; public static final String DEFAULT_YIELD_PERIOD = "1 sec"; public static final String DEFAULT_PENALIZATION_PERIOD = "30 sec"; - private static final String DEFAULT_MAX_BACKOFF_PERIOD = "10 mins"; private final AtomicReference processGroup; private final AtomicReference processorRef; private final AtomicReference identifier; @@ -208,9 +207,9 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable executionNode = isExecutionNodeRestricted() ? ExecutionNode.PRIMARY : ExecutionNode.ALL; this.hashCode = new HashCodeBuilder(7, 67).append(identifier).toHashCode(); - retryCount = 10; + retryCount = DEFAULT_RETRY_COUNT; retriedRelationships = new HashSet<>(); - backoffMechanism = BackoffMechanism.PENALIZE_FLOWFILE; + backoffMechanism = DEFAULT_BACKOFF_MECHANISM; maxBackoffPeriod = DEFAULT_MAX_BACKOFF_PERIOD; try { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java index 61e528f8ee..73b6a7717c 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/FlowDifferenceFilters.java @@ -64,7 +64,8 @@ public class FlowDifferenceFilters { || isNewRelationshipAutoTerminatedAndDefaulted(difference, localGroup, flowManager) || isScheduledStateNew(difference) || isLocalScheduleStateChange(difference) - || isPropertyMissingFromGhostComponent(difference, flowManager); + || isPropertyMissingFromGhostComponent(difference, flowManager) + || isNewRetryConfigWithDefaultValue(difference, flowManager); } /** @@ -143,6 +144,37 @@ public class FlowDifferenceFilters { return false; } + private static boolean isNewRetryConfigWithDefaultValue(final FlowDifference fd, final FlowManager flowManager) { + final Object valueA = fd.getValueA(); + if (valueA != null) { + return false; + } + + final VersionedComponent componentB = fd.getComponentB(); + if (!(componentB instanceof InstantiatedVersionedProcessor)) { + return false; + } + + final DifferenceType type = fd.getDifferenceType(); + final InstantiatedVersionedProcessor instantiatedProcessor = (InstantiatedVersionedProcessor) componentB; + final ProcessorNode processorNode = flowManager.getProcessorNode(instantiatedProcessor.getInstanceIdentifier()); + if (processorNode == null) { + return false; + } + + switch (type) { + case RETRIED_RELATIONSHIPS_CHANGED: + return processorNode.getRetriedRelationships().isEmpty(); + case RETRY_COUNT_CHANGED: + return processorNode.getRetryCount() == ProcessorNode.DEFAULT_RETRY_COUNT; + case MAX_BACKOFF_PERIOD_CHANGED: + return ProcessorNode.DEFAULT_MAX_BACKOFF_PERIOD.equals(processorNode.getMaxBackoffPeriod()); + case BACKOFF_MECHANISM_CHANGED: + return ProcessorNode.DEFAULT_BACKOFF_MECHANISM == processorNode.getBackoffMechanism(); + default: + return false; + } + } public static boolean isNewPropertyWithDefaultValue(final FlowDifference fd, final FlowManager flowManager) { if (fd.getDifferenceType() != DifferenceType.PROPERTY_ADDED) { diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/ProcessorNode.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/ProcessorNode.java index 506c8987db..e3e31b91ca 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/ProcessorNode.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/ProcessorNode.java @@ -45,6 +45,9 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; public abstract class ProcessorNode extends AbstractComponentNode implements Connectable { + public static final int DEFAULT_RETRY_COUNT = 10; + public static final BackoffMechanism DEFAULT_BACKOFF_MECHANISM = BackoffMechanism.PENALIZE_FLOWFILE; + public static final String DEFAULT_MAX_BACKOFF_PERIOD = "10 mins"; protected final AtomicReference scheduledState;