This is an automated email from the ASF dual-hosted git repository.
jgresock 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 9d3788f NIFI-9730: Consider a change in value for retry-related
fields from 'null' to the default value as an environmental change so that it's
not flagged as a Local Modification, which would prevent users from updating
the version of the Process Group that they are using
9d3788f is described below
commit 9d3788ff05a9774bb79ef34ac648266981f3864c
Author: Mark Payne <[email protected]>
AuthorDate: Fri Feb 25 14:14:28 2022 -0500
NIFI-9730: Consider a change in value for retry-related fields from 'null'
to the default value as an environmental change so that it's not flagged as a
Local Modification, which would prevent users from updating the version of the
Process Group that they are using
Signed-off-by: Joe Gresock <[email protected]>
This closes #5809.
---
.../nifi/controller/StandardProcessorNode.java | 5 ++--
.../apache/nifi/util/FlowDifferenceFilters.java | 34 +++++++++++++++++++++-
.../org/apache/nifi/controller/ProcessorNode.java | 3 ++
3 files changed, 38 insertions(+), 4 deletions(-)
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 6e480d0..62d8297 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> processGroup;
private final AtomicReference<ProcessorDetails> processorRef;
private final AtomicReference<String> 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 61e528f..73b6a77 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 506c898..e3e31b9 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> scheduledState;