You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2021/02/02 14:11:49 UTC

[flink] branch master updated: [FLINK-9683][history] HistoryServer uses configured default fs scheme

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

chesnay pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new ad0bcd7  [FLINK-9683][history] HistoryServer uses configured default fs scheme
ad0bcd7 is described below

commit ad0bcd735a3a1e8f54cb07058320db7e8be7b663
Author: JiangXin <j_...@163.com>
AuthorDate: Tue Feb 2 22:11:24 2021 +0800

    [FLINK-9683][history] HistoryServer uses configured default fs scheme
---
 .../runtime/webmonitor/history/HistoryServer.java  |  4 +--
 .../runtime/dispatcher/HistoryServerArchivist.java |  5 +---
 .../flink/runtime/webmonitor/WebMonitorUtils.java  | 29 ----------------------
 3 files changed, 2 insertions(+), 36 deletions(-)

diff --git a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java
index 3eeb72a..16100bd 100644
--- a/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java
+++ b/flink-runtime-web/src/main/java/org/apache/flink/runtime/webmonitor/history/HistoryServer.java
@@ -35,7 +35,6 @@ import org.apache.flink.runtime.rest.messages.DashboardConfiguration;
 import org.apache.flink.runtime.security.SecurityConfiguration;
 import org.apache.flink.runtime.security.SecurityUtils;
 import org.apache.flink.runtime.util.EnvironmentInformation;
-import org.apache.flink.runtime.webmonitor.WebMonitorUtils;
 import org.apache.flink.runtime.webmonitor.utils.WebFrontendBootstrap;
 import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.FileUtils;
@@ -202,8 +201,7 @@ public class HistoryServer {
         List<RefreshLocation> refreshDirs = new ArrayList<>();
         for (String refreshDirectory : refreshDirectories.split(",")) {
             try {
-                Path refreshPath =
-                        WebMonitorUtils.validateAndNormalizeUri(new Path(refreshDirectory).toUri());
+                Path refreshPath = new Path(refreshDirectory);
                 FileSystem refreshFS = refreshPath.getFileSystem();
                 refreshDirs.add(new RefreshLocation(refreshPath, refreshFS));
             } catch (Exception e) {
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/HistoryServerArchivist.java b/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/HistoryServerArchivist.java
index eea4d10..2a571d2 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/HistoryServerArchivist.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/HistoryServerArchivist.java
@@ -23,7 +23,6 @@ import org.apache.flink.configuration.JobManagerOptions;
 import org.apache.flink.core.fs.Path;
 import org.apache.flink.runtime.executiongraph.AccessExecutionGraph;
 import org.apache.flink.runtime.messages.Acknowledge;
-import org.apache.flink.runtime.webmonitor.WebMonitorUtils;
 import org.apache.flink.runtime.webmonitor.history.JsonArchivist;
 
 import java.util.concurrent.CompletableFuture;
@@ -45,9 +44,7 @@ public interface HistoryServerArchivist {
         final String configuredArchivePath = configuration.getString(JobManagerOptions.ARCHIVE_DIR);
 
         if (configuredArchivePath != null) {
-            final Path archivePath =
-                    WebMonitorUtils.validateAndNormalizeUri(
-                            new Path(configuredArchivePath).toUri());
+            final Path archivePath = new Path(configuredArchivePath);
 
             return new JsonResponseHistoryServerArchivist(jsonArchivist, archivePath, ioExecutor);
         } else {
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java b/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
index da139a5..068f32e 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorUtils.java
@@ -21,7 +21,6 @@ package org.apache.flink.runtime.webmonitor;
 import org.apache.flink.api.common.time.Time;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.configuration.WebOptions;
-import org.apache.flink.core.fs.Path;
 import org.apache.flink.runtime.dispatcher.DispatcherGateway;
 import org.apache.flink.runtime.rest.handler.legacy.files.StaticFileServerHandler;
 import org.apache.flink.runtime.webmonitor.retriever.GatewayRetriever;
@@ -40,7 +39,6 @@ import java.io.File;
 import java.io.IOException;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
-import java.net.URI;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -222,33 +220,6 @@ public final class WebMonitorUtils {
         }
     }
 
-    /**
-     * Checks and normalizes the given URI. This method first checks the validity of the URI (scheme
-     * and path are not null) and then normalizes the URI to a path.
-     *
-     * @param archiveDirUri The URI to check and normalize.
-     * @return A normalized URI as a Path.
-     * @throws IllegalArgumentException Thrown, if the URI misses scheme or path.
-     */
-    public static Path validateAndNormalizeUri(URI archiveDirUri) {
-        final String scheme = archiveDirUri.getScheme();
-        final String path = archiveDirUri.getPath();
-
-        // some validity checks
-        if (scheme == null) {
-            throw new IllegalArgumentException(
-                    "The scheme (hdfs://, file://, etc) is null. "
-                            + "Please specify the file system scheme explicitly in the URI.");
-        }
-        if (path == null) {
-            throw new IllegalArgumentException(
-                    "The path to store the job archive data in is null. "
-                            + "Please specify a directory path for the archiving the job data.");
-        }
-
-        return new Path(archiveDirUri);
-    }
-
     /** Private constructor to prevent instantiation. */
     private WebMonitorUtils() {
         throw new RuntimeException();