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 2024/09/12 21:09:35 UTC

(flink) 02/02: [FLINK-36147][runtime] Removes deprecated location field (was deprecated in 1.19)

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 6a5fa9962a90b663209a9eb2e910290b55eb97e1
Author: Matthias Pohl <gi...@mapohl.com>
AuthorDate: Fri Aug 23 22:32:26 2024 +0200

    [FLINK-36147][runtime] Removes deprecated location field (was deprecated in 1.19)
---
 .../src/test/resources/rest_api_v1.snapshot        |  6 ----
 .../rest/handler/job/JobExceptionsHandler.java     |  3 --
 .../messages/JobExceptionsInfoWithHistory.java     | 39 ++--------------------
 .../rest/handler/job/JobExceptionsHandlerTest.java | 14 ++++----
 .../JobExceptionsInfoWithHistoryNoRootTest.java    |  2 --
 5 files changed, 9 insertions(+), 55 deletions(-)

diff --git a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot
index 995662900eb..9e9fe94da6a 100644
--- a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot
+++ b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot
@@ -1989,9 +1989,6 @@
                   "taskName" : {
                     "type" : "string"
                   },
-                  "location" : {
-                    "type" : "string"
-                  },
                   "endpoint" : {
                     "type" : "string"
                   },
@@ -2022,9 +2019,6 @@
                         "taskName" : {
                           "type" : "string"
                         },
-                        "location" : {
-                          "type" : "string"
-                        },
                         "endpoint" : {
                           "type" : "string"
                         },
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandler.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandler.java
index c8580fa753b..ac00137c630 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandler.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandler.java
@@ -195,7 +195,6 @@ public class JobExceptionsHandler
                 historyEntry.getFailureLabels(),
                 historyEntry.getFailingTaskName(),
                 toString(historyEntry.getTaskManagerLocation()),
-                toString(historyEntry.getTaskManagerLocation()),
                 toTaskManagerId(historyEntry.getTaskManagerLocation()),
                 concurrentExceptions);
     }
@@ -211,7 +210,6 @@ public class JobExceptionsHandler
                     exceptionHistoryEntry.getFailureLabels(),
                     null,
                     null,
-                    null,
                     null);
         }
 
@@ -224,7 +222,6 @@ public class JobExceptionsHandler
                 exceptionHistoryEntry.getFailureLabels(),
                 exceptionHistoryEntry.getFailingTaskName(),
                 toString(exceptionHistoryEntry.getTaskManagerLocation()),
-                toString(exceptionHistoryEntry.getTaskManagerLocation()),
                 toTaskManagerId(exceptionHistoryEntry.getTaskManagerLocation()));
     }
 
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobExceptionsInfoWithHistory.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobExceptionsInfoWithHistory.java
index 1ca124cf01d..f1253592e1a 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobExceptionsInfoWithHistory.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobExceptionsInfoWithHistory.java
@@ -154,7 +154,6 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
         public static final String FIELD_NAME_EXCEPTION_STACKTRACE = "stacktrace";
         public static final String FIELD_NAME_EXCEPTION_TIMESTAMP = "timestamp";
         public static final String FIELD_NAME_TASK_NAME = "taskName";
-        @Deprecated public static final String FIELD_NAME_LOCATION = "location";
         public static final String FIELD_NAME_ENDPOINT = "endpoint";
         public static final String FIELD_NAME_TASK_MANAGER_ID = "taskManagerId";
         public static final String FIELD_NAME_FAILURE_LABELS = "failureLabels";
@@ -173,13 +172,6 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
         @Nullable
         private final String taskName;
 
-        /** @deprecated Use {@link ExceptionInfo#endpoint} instead. */
-        @Deprecated
-        @JsonInclude(NON_NULL)
-        @JsonProperty(FIELD_NAME_LOCATION)
-        @Nullable
-        private final String location;
-
         @JsonInclude(NON_NULL)
         @JsonProperty(FIELD_NAME_ENDPOINT)
         @Nullable
@@ -194,15 +186,7 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
         private final Map<String, String> failureLabels;
 
         public ExceptionInfo(String exceptionName, String stacktrace, long timestamp) {
-            this(
-                    exceptionName,
-                    stacktrace,
-                    timestamp,
-                    Collections.emptyMap(),
-                    null,
-                    null,
-                    null,
-                    null);
+            this(exceptionName, stacktrace, timestamp, Collections.emptyMap(), null, null, null);
         }
 
         @JsonCreator
@@ -212,7 +196,6 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
                 @JsonProperty(FIELD_NAME_EXCEPTION_TIMESTAMP) long timestamp,
                 @JsonProperty(FIELD_NAME_FAILURE_LABELS) Map<String, String> failureLabels,
                 @JsonProperty(FIELD_NAME_TASK_NAME) @Nullable String taskName,
-                @JsonProperty(FIELD_NAME_LOCATION) @Nullable String location,
                 @JsonProperty(FIELD_NAME_ENDPOINT) @Nullable String endpoint,
                 @JsonProperty(FIELD_NAME_TASK_MANAGER_ID) @Nullable String taskManagerId) {
             this.exceptionName = checkNotNull(exceptionName);
@@ -220,7 +203,6 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
             this.timestamp = timestamp;
             this.failureLabels = checkNotNull(failureLabels);
             this.taskName = taskName;
-            this.location = location;
             this.endpoint = endpoint;
             this.taskManagerId = taskManagerId;
         }
@@ -246,13 +228,6 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
             return taskName;
         }
 
-        @Deprecated
-        @JsonIgnore
-        @Nullable
-        public String getLocation() {
-            return location;
-        }
-
         @JsonIgnore
         @Nullable
         public String getEndpoint() {
@@ -286,20 +261,13 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
                     && Objects.equals(timestamp, that.timestamp)
                     && Objects.equals(failureLabels, that.failureLabels)
                     && Objects.equals(taskName, that.taskName)
-                    && Objects.equals(location, that.location)
                     && Objects.equals(endpoint, that.endpoint);
         }
 
         @Override
         public int hashCode() {
             return Objects.hash(
-                    exceptionName,
-                    stacktrace,
-                    timestamp,
-                    failureLabels,
-                    taskName,
-                    location,
-                    endpoint);
+                    exceptionName, stacktrace, timestamp, failureLabels, taskName, endpoint);
         }
 
         @Override
@@ -340,7 +308,6 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
                     null,
                     null,
                     null,
-                    null,
                     concurrentExceptions);
         }
 
@@ -351,7 +318,6 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
                 @JsonProperty(FIELD_NAME_EXCEPTION_TIMESTAMP) long timestamp,
                 @JsonProperty(FIELD_NAME_FAILURE_LABELS) Map<String, String> failureLabels,
                 @JsonProperty(FIELD_NAME_TASK_NAME) @Nullable String taskName,
-                @JsonProperty(FIELD_NAME_LOCATION) @Nullable String location,
                 @JsonProperty(FIELD_NAME_ENDPOINT) @Nullable String endpoint,
                 @JsonProperty(FIELD_NAME_TASK_MANAGER_ID) @Nullable String taskManagerId,
                 @JsonProperty(FIELD_NAME_CONCURRENT_EXCEPTIONS)
@@ -362,7 +328,6 @@ public class JobExceptionsInfoWithHistory implements ResponseBody {
                     timestamp,
                     failureLabels,
                     taskName,
-                    location,
                     endpoint,
                     taskManagerId);
             this.concurrentExceptions = concurrentExceptions;
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandlerTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandlerTest.java
index 55c6d2e84ee..cd2f47ade1a 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandlerTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/handler/job/JobExceptionsHandlerTest.java
@@ -708,7 +708,7 @@ class JobExceptionsHandlerTest {
         private final long expectedTimestamp;
         private final Map<String, String> expectedFailureLabels;
         private final String expectedTaskName;
-        private final String expectedLocation;
+        private final String expectedEndpoint;
         private final String expectedTaskManagerId;
 
         private ExceptionInfoMatcher(
@@ -716,14 +716,14 @@ class JobExceptionsHandlerTest {
                 long expectedTimestamp,
                 CompletableFuture<Map<String, String>> expectedFailureLabels,
                 String expectedTaskName,
-                String expectedLocation,
+                String expectedEndpoint,
                 String expectedTaskManagerId)
                 throws ExecutionException, InterruptedException {
             this.expectedException = deserializeSerializedThrowable(expectedException);
             this.expectedTimestamp = expectedTimestamp;
             this.expectedFailureLabels = expectedFailureLabels.get();
             this.expectedTaskName = expectedTaskName;
-            this.expectedLocation = expectedLocation;
+            this.expectedEndpoint = expectedEndpoint;
             this.expectedTaskManagerId = expectedTaskManagerId;
         }
 
@@ -740,8 +740,8 @@ class JobExceptionsHandlerTest {
                     .appendText(String.valueOf(expectedFailureLabels))
                     .appendText(", taskName=")
                     .appendText(expectedTaskName)
-                    .appendText(", location=")
-                    .appendText(expectedLocation)
+                    .appendText(", endpoint=")
+                    .appendText(expectedEndpoint)
                     .appendText(", taskManagerId=")
                     .appendText(expectedTaskManagerId);
         }
@@ -783,8 +783,8 @@ class JobExceptionsHandlerTest {
                     && matches(
                             info,
                             description,
-                            ExceptionInfo::getLocation,
-                            expectedLocation,
+                            ExceptionInfo::getEndpoint,
+                            expectedEndpoint,
                             "location")
                     && matches(
                             info,
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/JobExceptionsInfoWithHistoryNoRootTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/JobExceptionsInfoWithHistoryNoRootTest.java
index ac83d0be123..5d18bb21f9a 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/JobExceptionsInfoWithHistoryNoRootTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/messages/JobExceptionsInfoWithHistoryNoRootTest.java
@@ -55,7 +55,6 @@ class JobExceptionsInfoWithHistoryNoRootTest
                                                         Collections.emptyMap(),
                                                         "task name #2",
                                                         "location #2",
-                                                        "location #2",
                                                         "taskManagerId #2"))),
                                 new JobExceptionsInfoWithHistory.RootExceptionInfo(
                                         "local task failure #1",
@@ -64,7 +63,6 @@ class JobExceptionsInfoWithHistoryNoRootTest
                                         Collections.emptyMap(),
                                         "task name",
                                         "location",
-                                        "location",
                                         "taskManagerId",
                                         Collections.emptyList())),
                         false));