mirror of
https://github.com/apache/nifi.git
synced 2025-02-10 12:05:22 +00:00
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 <jgresock@gmail.com> This closes #5809.
This commit is contained in:
parent
db28c91cdb
commit
9d3788ff05
@ -127,7 +127,6 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
|
|||||||
public static final TimeUnit DEFAULT_TIME_UNIT = TimeUnit.MILLISECONDS;
|
public static final TimeUnit DEFAULT_TIME_UNIT = TimeUnit.MILLISECONDS;
|
||||||
public static final String DEFAULT_YIELD_PERIOD = "1 sec";
|
public static final String DEFAULT_YIELD_PERIOD = "1 sec";
|
||||||
public static final String DEFAULT_PENALIZATION_PERIOD = "30 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<ProcessGroup> processGroup;
|
||||||
private final AtomicReference<ProcessorDetails> processorRef;
|
private final AtomicReference<ProcessorDetails> processorRef;
|
||||||
private final AtomicReference<String> identifier;
|
private final AtomicReference<String> identifier;
|
||||||
@ -208,9 +207,9 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable
|
|||||||
executionNode = isExecutionNodeRestricted() ? ExecutionNode.PRIMARY : ExecutionNode.ALL;
|
executionNode = isExecutionNodeRestricted() ? ExecutionNode.PRIMARY : ExecutionNode.ALL;
|
||||||
this.hashCode = new HashCodeBuilder(7, 67).append(identifier).toHashCode();
|
this.hashCode = new HashCodeBuilder(7, 67).append(identifier).toHashCode();
|
||||||
|
|
||||||
retryCount = 10;
|
retryCount = DEFAULT_RETRY_COUNT;
|
||||||
retriedRelationships = new HashSet<>();
|
retriedRelationships = new HashSet<>();
|
||||||
backoffMechanism = BackoffMechanism.PENALIZE_FLOWFILE;
|
backoffMechanism = DEFAULT_BACKOFF_MECHANISM;
|
||||||
maxBackoffPeriod = DEFAULT_MAX_BACKOFF_PERIOD;
|
maxBackoffPeriod = DEFAULT_MAX_BACKOFF_PERIOD;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -64,7 +64,8 @@ public class FlowDifferenceFilters {
|
|||||||
|| isNewRelationshipAutoTerminatedAndDefaulted(difference, localGroup, flowManager)
|
|| isNewRelationshipAutoTerminatedAndDefaulted(difference, localGroup, flowManager)
|
||||||
|| isScheduledStateNew(difference)
|
|| isScheduledStateNew(difference)
|
||||||
|| isLocalScheduleStateChange(difference)
|
|| isLocalScheduleStateChange(difference)
|
||||||
|| isPropertyMissingFromGhostComponent(difference, flowManager);
|
|| isPropertyMissingFromGhostComponent(difference, flowManager)
|
||||||
|
|| isNewRetryConfigWithDefaultValue(difference, flowManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,6 +144,37 @@ public class FlowDifferenceFilters {
|
|||||||
return false;
|
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) {
|
public static boolean isNewPropertyWithDefaultValue(final FlowDifference fd, final FlowManager flowManager) {
|
||||||
if (fd.getDifferenceType() != DifferenceType.PROPERTY_ADDED) {
|
if (fd.getDifferenceType() != DifferenceType.PROPERTY_ADDED) {
|
||||||
|
@ -45,6 +45,9 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public abstract class ProcessorNode extends AbstractComponentNode implements Connectable {
|
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;
|
protected final AtomicReference<ScheduledState> scheduledState;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user