Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/1954#discussion_r69694326
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/restart/FailureRateRestartStrategy.java
---
@@ -35,19 +34,21 @@
* with a fixed time delay in between.
*/
public class FailureRateRestartStrategy implements RestartStrategy {
- private final int maxFailuresPerUnit;
- private final TimeUnit failureRateUnit;
- private final long delayBetweenRestartAttempts;
- private List<Long> restartTimestamps = new ArrayList<>();
+ private final Duration failuresInterval;
+ private final Duration delayInterval;
+ private EvictingQueue<Long> restartTimestampsQueue;
private boolean disabled = false;
- public FailureRateRestartStrategy(int maxFailuresPerUnit, TimeUnit
failureRateUnit, long delayBetweenRestartAttempts) {
- Preconditions.checkArgument(maxFailuresPerUnit > 0, "Maximum
number of restart attempts per time unit must be greater than 0.");
- Preconditions.checkArgument(delayBetweenRestartAttempts >= 0,
"Delay between restart attempts must be positive");
+ public FailureRateRestartStrategy(int maxFailuresPerInterval, Duration
failuresInterval, Duration delayInterval) {
+ Preconditions.checkArgument(maxFailuresPerInterval > 0,
"Maximum number of restart attempts per time unit must be greater than 0.");
+ Preconditions.checkNotNull(failuresInterval, "Failures interval
cannot be null.");
+ Preconditions.checkNotNull(failuresInterval.length() > 0,
"Failures interval must be greater than 0 ms.");
--- End diff --
`checkArgument`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---