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 2022/10/11 11:00:46 UTC

[flink] 02/02: [FLINK-29503][rest] Add backpressureLevel field

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

commit a743812edd7e19cf5b43d9efd1222471def90d18
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Wed Oct 5 11:17:33 2022 +0200

    [FLINK-29503][rest] Add backpressureLevel field
    
    Enum fields have naming restrictions in some languages.
---
 docs/layouts/shortcodes/generated/rest_v1_dispatcher.html |  8 ++++++++
 docs/static/generated/rest_v1_dispatcher.yml              |  4 ++--
 flink-runtime-web/src/test/resources/rest_api_v1.snapshot | 14 +++++++++++---
 .../runtime/rest/messages/JobVertexBackPressureInfo.java  | 15 +++++++++++++--
 4 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html b/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html
index f80dc8e3f36..050d3750d8e 100644
--- a/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html
+++ b/docs/layouts/shortcodes/generated/rest_v1_dispatcher.html
@@ -4344,6 +4344,10 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa
       "type" : "string",
       "enum" : [ "ok", "low", "high" ]
     },
+    "backpressureLevel" : {
+      "type" : "string",
+      "enum" : [ "ok", "low", "high" ]
+    },
     "end-timestamp" : {
       "type" : "integer"
     },
@@ -4364,6 +4368,10 @@ Using 'curl' you can upload a jar via 'curl -X POST -H "Expect:" -F "jarfile=@pa
             "type" : "string",
             "enum" : [ "ok", "low", "high" ]
           },
+          "backpressureLevel" : {
+            "type" : "string",
+            "enum" : [ "ok", "low", "high" ]
+          },
           "busyRatio" : {
             "type" : "number"
           },
diff --git a/docs/static/generated/rest_v1_dispatcher.yml b/docs/static/generated/rest_v1_dispatcher.yml
index bdcbb9b7074..60b22473cb3 100644
--- a/docs/static/generated/rest_v1_dispatcher.yml
+++ b/docs/static/generated/rest_v1_dispatcher.yml
@@ -2337,7 +2337,7 @@ components:
     JobVertexBackPressureInfo:
       type: object
       properties:
-        backpressure-level:
+        backpressureLevel:
           $ref: '#/components/schemas/VertexBackPressureLevel'
         end-timestamp:
           type: integer
@@ -2663,7 +2663,7 @@ components:
         attempt-number:
           type: integer
           format: int32
-        backpressure-level:
+        backpressureLevel:
           $ref: '#/components/schemas/VertexBackPressureLevel'
         busyRatio:
           type: number
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 ef9be2485d2..b13156998af 100644
--- a/flink-runtime-web/src/test/resources/rest_api_v1.snapshot
+++ b/flink-runtime-web/src/test/resources/rest_api_v1.snapshot
@@ -2516,7 +2516,7 @@
           "type" : "string",
           "enum" : [ "deprecated", "ok" ]
         },
-        "backpressure-level" : {
+        "backpressureLevel" : {
           "type" : "string",
           "enum" : [ "ok", "low", "high" ]
         },
@@ -2535,7 +2535,7 @@
               "attempt-number" : {
                 "type" : "integer"
               },
-              "backpressure-level" : {
+              "backpressureLevel" : {
                 "type" : "string",
                 "enum" : [ "ok", "low", "high" ]
               },
@@ -2554,9 +2554,17 @@
                   "type" : "object",
                   "$ref" : "urn:jsonschema:org:apache:flink:runtime:rest:messages:JobVertexBackPressureInfo:SubtaskBackPressureInfo"
                 }
+              },
+              "backpressure-level" : {
+                "type" : "string",
+                "enum" : [ "ok", "low", "high" ]
               }
             }
           }
+        },
+        "backpressure-level" : {
+          "type" : "string",
+          "enum" : [ "ok", "low", "high" ]
         }
       }
     }
@@ -3845,4 +3853,4 @@
       }
     }
   } ]
-}
+}
\ No newline at end of file
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobVertexBackPressureInfo.java b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobVertexBackPressureInfo.java
index acb9aa27c64..09de51331a1 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobVertexBackPressureInfo.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/rest/messages/JobVertexBackPressureInfo.java
@@ -20,12 +20,15 @@ package org.apache.flink.runtime.rest.messages;
 
 import org.apache.flink.runtime.rest.handler.job.JobVertexBackPressureHandler;
 
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonAlias;
 import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
 import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonInclude;
 import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonInclude.Include;
 import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
 import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonValue;
 
+import io.swagger.v3.oas.annotations.Hidden;
+
 import javax.annotation.Nullable;
 
 import java.util.Collections;
@@ -39,7 +42,8 @@ import static org.apache.flink.util.Preconditions.checkNotNull;
 public class JobVertexBackPressureInfo implements ResponseBody {
 
     public static final String FIELD_NAME_STATUS = "status";
-    public static final String FIELD_NAME_BACKPRESSURE_LEVEL = "backpressure-level";
+    public static final String DEPRECATED_FIELD_NAME_BACKPRESSURE_LEVEL = "backpressure-level";
+    public static final String FIELD_NAME_BACKPRESSURE_LEVEL = "backpressureLevel";
     public static final String FIELD_NAME_END_TIMESTAMP = "end-timestamp";
     public static final String FIELD_NAME_SUBTASKS = "subtasks";
 
@@ -51,6 +55,7 @@ public class JobVertexBackPressureInfo implements ResponseBody {
     private final VertexBackPressureStatus status;
 
     @JsonProperty(FIELD_NAME_BACKPRESSURE_LEVEL)
+    @JsonAlias(DEPRECATED_FIELD_NAME_BACKPRESSURE_LEVEL)
     private final VertexBackPressureLevel backpressureLevel;
 
     @JsonProperty(FIELD_NAME_END_TIMESTAMP)
@@ -100,6 +105,8 @@ public class JobVertexBackPressureInfo implements ResponseBody {
     }
 
     @Nullable
+    @Hidden
+    @JsonProperty(DEPRECATED_FIELD_NAME_BACKPRESSURE_LEVEL)
     public VertexBackPressureLevel getBackpressureLevel() {
         return backpressureLevel;
     }
@@ -123,7 +130,8 @@ public class JobVertexBackPressureInfo implements ResponseBody {
 
         public static final String FIELD_NAME_SUBTASK = "subtask";
         public static final String FIELD_NAME_ATTEMPT_NUMBER = "attempt-number";
-        public static final String FIELD_NAME_BACKPRESSURE_LEVEL = "backpressure-level";
+        public static final String DEPRECATED_FIELD_NAME_BACKPRESSURE_LEVEL = "backpressure-level";
+        public static final String FIELD_NAME_BACKPRESSURE_LEVEL = "backpressureLevel";
         public static final String FIELD_NAME_BACK_PRESSURED_RATIO = "ratio";
         public static final String FIELD_NAME_IDLE_RATIO = "idleRatio";
         public static final String FIELD_NAME_BUSY_RATIO = "busyRatio";
@@ -139,6 +147,7 @@ public class JobVertexBackPressureInfo implements ResponseBody {
         private final Integer attemptNumber;
 
         @JsonProperty(FIELD_NAME_BACKPRESSURE_LEVEL)
+        @JsonAlias(DEPRECATED_FIELD_NAME_BACKPRESSURE_LEVEL)
         private final VertexBackPressureLevel backpressureLevel;
 
         @JsonProperty(FIELD_NAME_BACK_PRESSURED_RATIO)
@@ -210,6 +219,8 @@ public class JobVertexBackPressureInfo implements ResponseBody {
             return subtask;
         }
 
+        @Hidden
+        @JsonProperty(DEPRECATED_FIELD_NAME_BACKPRESSURE_LEVEL)
         public VertexBackPressureLevel getBackpressureLevel() {
             return backpressureLevel;
         }