You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ma...@apache.org on 2022/03/16 18:25:15 UTC
[flink] 03/06: [hotfix][docs] Uses @OverrideDefault instead of noDefaultValue for exponential-delay.attempts
This is an automated email from the ASF dual-hosted git repository.
mapohl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
commit 0f870d574767dad2a6fd428c7cf00509c3d68bd2
Author: Matthias Pohl <ma...@ververica.com>
AuthorDate: Wed Mar 16 13:19:51 2022 +0100
[hotfix][docs] Uses @OverrideDefault instead of noDefaultValue for exponential-delay.attempts
---
.../exponential_delay_cleanup_strategy_configuration.html | 4 ++--
.../java/org/apache/flink/configuration/CleanupOptions.java | 7 ++++---
.../dispatcher/cleanup/CleanupRetryStrategyFactory.java | 4 +---
.../dispatcher/cleanup/CleanupRetryStrategyFactoryTest.java | 13 +++++++++----
4 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/docs/layouts/shortcodes/generated/exponential_delay_cleanup_strategy_configuration.html b/docs/layouts/shortcodes/generated/exponential_delay_cleanup_strategy_configuration.html
index ea2933b..23f13e0 100644
--- a/docs/layouts/shortcodes/generated/exponential_delay_cleanup_strategy_configuration.html
+++ b/docs/layouts/shortcodes/generated/exponential_delay_cleanup_strategy_configuration.html
@@ -10,9 +10,9 @@
<tbody>
<tr>
<td><h5>cleanup-strategy.exponential-delay.attempts</h5></td>
- <td style="word-wrap: break-word;">(none)</td>
+ <td style="word-wrap: break-word;">infinite</td>
<td>Integer</td>
- <td>The number of times a failed cleanup is retried if <code class="highlighter-rouge">cleanup-strategy</code> has been set to <code class="highlighter-rouge">exponential-delay</code>. Reaching the configured limit means that the job artifacts (and the job's JobResultStore entry) might need to be cleaned up manually. Setting no value corresponds to unlimited retries.</td>
+ <td>The number of times a failed cleanup is retried if <code class="highlighter-rouge">cleanup-strategy</code> has been set to <code class="highlighter-rouge">exponential-delay</code>. Reaching the configured limit means that the job artifacts (and the job's JobResultStore entry) might need to be cleaned up manually.</td>
</tr>
<tr>
<td><h5>cleanup-strategy.exponential-delay.initial-backoff</h5></td>
diff --git a/flink-core/src/main/java/org/apache/flink/configuration/CleanupOptions.java b/flink-core/src/main/java/org/apache/flink/configuration/CleanupOptions.java
index 7c6ff64..1efc4c5 100644
--- a/flink-core/src/main/java/org/apache/flink/configuration/CleanupOptions.java
+++ b/flink-core/src/main/java/org/apache/flink/configuration/CleanupOptions.java
@@ -21,6 +21,7 @@ package org.apache.flink.configuration;
import org.apache.flink.annotation.PublicEvolving;
import org.apache.flink.annotation.docs.ConfigGroup;
import org.apache.flink.annotation.docs.ConfigGroups;
+import org.apache.flink.annotation.docs.Documentation;
import org.apache.flink.configuration.description.Description;
import org.apache.flink.configuration.description.TextElement;
@@ -190,10 +191,11 @@ public class CleanupOptions {
code(EXPONENTIAL_DELAY_LABEL))
.build());
+ @Documentation.OverrideDefault("infinite")
public static final ConfigOption<Integer> CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS =
ConfigOptions.key(createExponentialBackoffParameterPrefix("attempts"))
.intType()
- .noDefaultValue()
+ .defaultValue(Integer.MAX_VALUE)
.withDescription(
Description.builder()
.text(
@@ -201,8 +203,7 @@ public class CleanupOptions {
+ "if %s has been set to %s. Reaching the "
+ "configured limit means that the job artifacts "
+ "(and the job's JobResultStore entry) "
- + "might need to be cleaned up manually. "
- + "Setting no value corresponds to unlimited retries.",
+ + "might need to be cleaned up manually.",
code(CLEANUP_STRATEGY_PARAM),
code(EXPONENTIAL_DELAY_LABEL))
.build());
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/cleanup/CleanupRetryStrategyFactory.java b/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/cleanup/CleanupRetryStrategyFactory.java
index 79557b0..1ec88a1 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/cleanup/CleanupRetryStrategyFactory.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/cleanup/CleanupRetryStrategyFactory.java
@@ -78,9 +78,7 @@ public enum CleanupRetryStrategyFactory {
final Duration maxDelay =
configuration.get(CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_BACKOFF);
final int maxAttempts =
- configuration.getInteger(
- CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS,
- Integer.MAX_VALUE);
+ configuration.get(CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS);
return new ExponentialBackoffRetryStrategy(maxAttempts, minDelay, maxDelay);
}
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/cleanup/CleanupRetryStrategyFactoryTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/cleanup/CleanupRetryStrategyFactoryTest.java
index 9cf1db6..c1dc76b 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/cleanup/CleanupRetryStrategyFactoryTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/cleanup/CleanupRetryStrategyFactoryTest.java
@@ -65,7 +65,7 @@ class CleanupRetryStrategyFactoryTest {
new Configuration(),
CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_INITIAL_BACKOFF.defaultValue(),
CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_BACKOFF.defaultValue(),
- Integer.MAX_VALUE);
+ CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS.defaultValue());
}
private static Configuration createConfigurationWithRetryStrategy(String configValue) {
@@ -162,7 +162,7 @@ class CleanupRetryStrategyFactoryTest {
config,
CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_INITIAL_BACKOFF.defaultValue(),
CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_BACKOFF.defaultValue(),
- Integer.MAX_VALUE);
+ CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS.defaultValue());
}
@Test
@@ -180,7 +180,7 @@ class CleanupRetryStrategyFactoryTest {
config,
customMinDelay,
CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_BACKOFF.defaultValue(),
- Integer.MAX_VALUE);
+ CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS.defaultValue());
}
@Test
@@ -197,7 +197,7 @@ class CleanupRetryStrategyFactoryTest {
config,
CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_INITIAL_BACKOFF.defaultValue(),
customMaxDelay,
- Integer.MAX_VALUE);
+ CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS.defaultValue());
}
@Test
@@ -207,6 +207,11 @@ class CleanupRetryStrategyFactoryTest {
// 13 is the minimum we can use for this test; otherwise, assertMaxDelay would fail due to a
// Precondition in ExponentialBackoffRetryStrategy
final int customMaxAttempts = 13;
+ Preconditions.checkArgument(
+ customMaxAttempts
+ != CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS
+ .defaultValue(),
+ "The custom value should be different from the default value to make it possible that the overwritten value is selected.");
config.set(
CleanupOptions.CLEANUP_STRATEGY_EXPONENTIAL_DELAY_MAX_ATTEMPTS, customMaxAttempts);