flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] XComp commented on a change in pull request #15832: [FLINK-22494][ha] Introduce PossibleInconsistentStateException
Date Tue, 11 May 2021 08:50:57 GMT

XComp commented on a change in pull request #15832:
URL: https://github.com/apache/flink/pull/15832#discussion_r629976027



##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/highavailability/KubernetesStateHandleStore.java
##########
@@ -470,6 +508,26 @@ public String toString() {
         return this.getClass().getSimpleName() + "{configMapName='" + configMapName + "'}";
     }
 
+    private byte[] serializeStateHandle(RetrievableStateHandle<T> retrievableStateHandle)
+            throws Exception {
+        try {
+            // Serialize the state handle. This writes the state to the backend.
+            return InstantiationUtil.serializeObject(retrievableStateHandle);
+        } catch (Exception e) {
+            discardState(retrievableStateHandle);
+            ExceptionUtils.rethrow(e);
+        }
+
+        // will never happen but is added to please the compiler
+        return new byte[0];
+    }
+
+    private static void discardState(@Nullable StateObject stateObject) throws Exception
{

Review comment:
       I was guided by one null check [here](https://github.com/apache/flink/pull/15832/files#diff-ddcc7a8f5b1139881124c01fa4f0c44a1e49c29b611a9cd71103790ffd66d7c3L159).
But I double-checked now: The `null` check is not necessary. I removed it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message