dmvk commented on a change in pull request #18901:
URL: https://github.com/apache/flink/pull/18901#discussion_r814638920



##########
File path: 
flink-kubernetes/src/main/java/org/apache/flink/kubernetes/highavailability/KubernetesStateHandleStore.java
##########
@@ -132,31 +197,27 @@ public KubernetesStateHandleStore(
 
         final RetrievableStateHandle<T> storeHandle = storage.store(state);
 
-        final byte[] serializedStoreHandle = serializeOrDiscard(storeHandle);
+        final byte[] serializedStoreHandle =
+                serializeOrDiscard(new 
StateHandleWithDeleteMarker<>(storeHandle));
 
         // initialize flag to serve the failure case
         boolean discardState = true;
         try {
             // a successful operation will result in the state not being 
discarded
             discardState =
-                    !kubeClient
-                            .checkAndUpdateConfigMap(
-                                    configMapName,
-                                    c -> {
-                                        if (isValidOperation(c)) {
-                                            if (!c.getData().containsKey(key)) 
{
-                                                c.getData()
-                                                        .put(
-                                                                key,
-                                                                
encodeStateHandle(
-                                                                        
serializedStoreHandle));
-                                                return Optional.of(c);
-                                            } else {
-                                                throw new CompletionException(
-                                                        
getKeyAlreadyExistException(key));
-                                            }
+                    !updateConfigMap(
+                                    configMap -> {
+                                        if 
(!configMap.getData().containsKey(key)) {
+                                            configMap
+                                                    .getData()
+                                                    .put(
+                                                            key,
+                                                            encodeStateHandle(
+                                                                    
serializedStoreHandle));
+                                            return Optional.of(configMap);
                                         }
-                                        return Optional.empty();
+                                        throw new CompletionException(

Review comment:
       also as far as I understand, this scenario should never happen, so I'd 
rather explicitly guard from this




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to