You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/07/25 15:42:14 UTC

[flink] branch release-1.6 updated (0ec6a35 -> 9129ceb)

This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a change to branch release-1.6
in repository https://gitbox.apache.org/repos/asf/flink.git.


    from 0ec6a35  [FLINK-9949][tests] Kill Flink processes in DB/teardown!
     new 918e3e8  [hotfix][tests] Fix checkstyle violations in BootstrapToolsTest.
     new 9129ceb  [FLINK-9939][runtime] Add null check before setting tmp dirs in config.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../runtime/clusterframework/BootstrapTools.java   |  9 ++--
 .../clusterframework/BootstrapToolsTest.java       | 56 +++++++++++++---------
 2 files changed, 39 insertions(+), 26 deletions(-)


[flink] 02/02: [FLINK-9939][runtime] Add null check before setting tmp dirs in config.

Posted by tr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-1.6
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 9129cebe6e125dd96a23a24ac22fd8d137757a47
Author: gyao <ga...@data-artisans.com>
AuthorDate: Wed Jul 25 13:57:34 2018 +0200

    [FLINK-9939][runtime] Add null check before setting tmp dirs in config.
    
    This closes #6418.
---
 .../apache/flink/runtime/clusterframework/BootstrapTools.java    | 9 ++++++---
 .../flink/runtime/clusterframework/BootstrapToolsTest.java       | 6 ++++++
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java b/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java
index b43946c..4e43480 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/clusterframework/BootstrapTools.java
@@ -46,6 +46,8 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.annotation.Nullable;
+
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -480,12 +482,13 @@ public class BootstrapTools {
 	 * @param configuration flink config to patch
 	 * @param defaultDirs in case no tmp directories is set, next directories will be applied
 	 */
-	public static void updateTmpDirectoriesInConfiguration(Configuration configuration, String defaultDirs){
+	public static void updateTmpDirectoriesInConfiguration(
+			Configuration configuration,
+			@Nullable String defaultDirs) {
 		if (configuration.contains(CoreOptions.TMP_DIRS)) {
 			LOG.info("Overriding Fink's temporary file directories with those " +
 				"specified in the Flink config: {}", configuration.getValue(CoreOptions.TMP_DIRS));
-		}
-		else {
+		} else if (defaultDirs != null) {
 			LOG.info("Setting directories for temporary files to: {}", defaultDirs);
 			configuration.setString(CoreOptions.TMP_DIRS, defaultDirs);
 			configuration.setBoolean(USE_LOCAL_DEFAULT_TMP_DIRS, true);
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/BootstrapToolsTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/BootstrapToolsTest.java
index 3519450..d1f32cf 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/BootstrapToolsTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/BootstrapToolsTest.java
@@ -299,4 +299,10 @@ public class BootstrapToolsTest {
 		assertEquals(config.getString(CoreOptions.TMP_DIRS), "");
 	}
 
+	@Test
+	public void testShouldNotUpdateTmpDirectoriesInConfigurationIfNoValueConfigured() {
+		Configuration config = new Configuration();
+		BootstrapTools.updateTmpDirectoriesInConfiguration(config, null);
+		assertEquals(config.getString(CoreOptions.TMP_DIRS), CoreOptions.TMP_DIRS.defaultValue());
+	}
 }


[flink] 01/02: [hotfix][tests] Fix checkstyle violations in BootstrapToolsTest.

Posted by tr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

trohrmann pushed a commit to branch release-1.6
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 918e3e8a891c6084be868fe2029e7d20a3a33f0e
Author: gyao <ga...@data-artisans.com>
AuthorDate: Wed Jul 25 12:23:20 2018 +0200

    [hotfix][tests] Fix checkstyle violations in BootstrapToolsTest.
---
 .../clusterframework/BootstrapToolsTest.java       | 50 ++++++++++++----------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/BootstrapToolsTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/BootstrapToolsTest.java
index 7e31c8e..3519450 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/BootstrapToolsTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/clusterframework/BootstrapToolsTest.java
@@ -21,6 +21,7 @@ package org.apache.flink.runtime.clusterframework;
 import org.apache.flink.configuration.ConfigConstants;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.CoreOptions;
+
 import org.junit.Test;
 
 import java.util.HashMap;
@@ -29,27 +30,30 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 
+/**
+ * Tests for {@link BootstrapToolsTest}.
+ */
 public class BootstrapToolsTest {
 
 	@Test
 	public void testSubstituteConfigKey() {
-		String deprecatedKey1 ="deprecated-key";
-		String deprecatedKey2 ="another-out_of-date_key";
-		String deprecatedKey3 ="yet-one-more";
+		String deprecatedKey1 = "deprecated-key";
+		String deprecatedKey2 = "another-out_of-date_key";
+		String deprecatedKey3 = "yet-one-more";
 
-		String designatedKey1 ="newkey1";
-		String designatedKey2 ="newKey2";
-		String designatedKey3 ="newKey3";
+		String designatedKey1 = "newkey1";
+		String designatedKey2 = "newKey2";
+		String designatedKey3 = "newKey3";
 
 		String value1 = "value1";
-		String value2_designated = "designated-value2";
-		String value2_deprecated = "deprecated-value2";
+		String value2Designated = "designated-value2";
+		String value2Deprecated = "deprecated-value2";
 
 		// config contains only deprecated key 1, and for key 2 both deprecated and designated
 		Configuration cfg = new Configuration();
 		cfg.setString(deprecatedKey1, value1);
-		cfg.setString(deprecatedKey2, value2_deprecated);
-		cfg.setString(designatedKey2, value2_designated);
+		cfg.setString(deprecatedKey2, value2Deprecated);
+		cfg.setString(designatedKey2, value2Designated);
 
 		BootstrapTools.substituteDeprecatedConfigKey(cfg, deprecatedKey1, designatedKey1);
 		BootstrapTools.substituteDeprecatedConfigKey(cfg, deprecatedKey2, designatedKey2);
@@ -59,7 +63,7 @@ public class BootstrapToolsTest {
 		assertEquals(value1, cfg.getString(designatedKey1, null));
 
 		// value 2 should not have been set, since it had a value already
-		assertEquals(value2_designated, cfg.getString(designatedKey2, null));
+		assertEquals(value2Designated, cfg.getString(designatedKey2, null));
 
 		// nothing should be in there for key 3
 		assertNull(cfg.getString(designatedKey3, null));
@@ -68,13 +72,13 @@ public class BootstrapToolsTest {
 
 	@Test
 	public void testSubstituteConfigKeyPrefix() {
-		String deprecatedPrefix1 ="deprecated-prefix";
-		String deprecatedPrefix2 ="-prefix-2";
-		String deprecatedPrefix3 ="prefix-3";
+		String deprecatedPrefix1 = "deprecated-prefix";
+		String deprecatedPrefix2 = "-prefix-2";
+		String deprecatedPrefix3 = "prefix-3";
 
-		String designatedPrefix1 ="p1";
-		String designatedPrefix2 ="ppp";
-		String designatedPrefix3 ="zzz";
+		String designatedPrefix1 = "p1";
+		String designatedPrefix2 = "ppp";
+		String designatedPrefix3 = "zzz";
 
 		String depr1 = deprecatedPrefix1 + "var";
 		String depr2 = deprecatedPrefix2 + "env";
@@ -86,15 +90,15 @@ public class BootstrapToolsTest {
 
 		String val1 = "1";
 		String val2 = "2";
-		String val3_depr = "3-";
-		String val3_desig = "3+";
+		String val3Depr = "3-";
+		String val3Desig = "3+";
 
 		// config contains only deprecated key 1, and for key 2 both deprecated and designated
 		Configuration cfg = new Configuration();
 		cfg.setString(depr1, val1);
 		cfg.setString(depr2, val2);
-		cfg.setString(depr3, val3_depr);
-		cfg.setString(desig3, val3_desig);
+		cfg.setString(depr3, val3Depr);
+		cfg.setString(desig3, val3Desig);
 
 		BootstrapTools.substituteDeprecatedConfigPrefix(cfg, deprecatedPrefix1, designatedPrefix1);
 		BootstrapTools.substituteDeprecatedConfigPrefix(cfg, deprecatedPrefix2, designatedPrefix2);
@@ -102,7 +106,7 @@ public class BootstrapToolsTest {
 
 		assertEquals(val1, cfg.getString(desig1, null));
 		assertEquals(val2, cfg.getString(desig2, null));
-		assertEquals(val3_desig, cfg.getString(desig3, null));
+		assertEquals(val3Desig, cfg.getString(desig3, null));
 
 		// check that nothing with prefix 3 is contained
 		for (String key : cfg.keySet()) {
@@ -278,7 +282,7 @@ public class BootstrapToolsTest {
 	}
 
 	@Test
-	public void testUpdateTmpDirectoriesInConfiguration(){
+	public void testUpdateTmpDirectoriesInConfiguration() {
 		Configuration config = new Configuration();
 
 		// test that default value is taken