You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "rkhachatryan (via GitHub)" <gi...@apache.org> on 2023/07/18 19:38:05 UTC

[GitHub] [flink] rkhachatryan commented on a diff in pull request #22669: [FLINK-29913] fix shared state be discarded by mistake when maxConcurrentCheckpoint>1

rkhachatryan commented on code in PR #22669:
URL: https://github.com/apache/flink/pull/22669#discussion_r1267223874


##########
flink-runtime/src/test/java/org/apache/flink/runtime/state/DiscardRecordedStateObject.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.state;
+
+import org.apache.flink.util.TernaryBoolean;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** A test mock of {@link StateObject} which need record itself whether been discarded. */
+public interface DiscardRecordedStateObject extends StateObject {

Review Comment:
   Do I understand correctly, that this class was added to avoid using mocks for state handles?
   
   Although that's a good change IMO, I think it would be nice to extract it into a separate commit - because the change touches tests of a very sensitive part (SharedStateRegsitry).



##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/SharedStateRegistryImpl.java:
##########
@@ -167,7 +152,6 @@ public StreamStateHandle registerReference(
             }
         } // end of synchronized (registeredStates)
 
-        scheduleAsyncDelete(scheduledStateDeletion);

Review Comment:
   Can you please expand the commit message to clarify why this is not necessary anymore?
   
   And probably rename the commit from 
   `[hotfix][state-changelog] not trigger new materialization until previous one confirmed or failed or cancelled`
   to 
   `[hotfix][state-changelog] Don't trigger new materialization unless the previous one is confirmed/failed/cancelled`



##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/IncrementalRemoteKeyedStateHandle.java:
##########
@@ -359,11 +357,12 @@ IncrementalRemoteKeyedStateHandle copy() {
                 stateHandleId);
     }
 
-    /** Create a unique key to register one of our shared state handles. */
+    /** Create a unique key based on physical id to register one of our shared state handles. */
     @VisibleForTesting
-    public SharedStateRegistryKey createSharedStateRegistryKeyFromFileName(StateHandleID shId) {
+    public SharedStateRegistryKey createSharedStateRegistryKey(StreamStateHandle handle) {
+        String keyString = handle.getStreamStateHandleID().getKeyString();
         return new SharedStateRegistryKey(
-                String.valueOf(backendIdentifier) + '-' + keyGroupRange, shId);
+                UUID.nameUUIDFromBytes(keyString.getBytes(StandardCharsets.UTF_8)).toString());

Review Comment:
   Maybe also clarify that in code?



##########
flink-runtime/src/main/java/org/apache/flink/runtime/state/IncrementalRemoteKeyedStateHandle.java:
##########
@@ -359,11 +357,12 @@ IncrementalRemoteKeyedStateHandle copy() {
                 stateHandleId);
     }
 
-    /** Create a unique key to register one of our shared state handles. */
+    /** Create a unique key based on physical id to register one of our shared state handles. */
     @VisibleForTesting
-    public SharedStateRegistryKey createSharedStateRegistryKeyFromFileName(StateHandleID shId) {
+    public SharedStateRegistryKey createSharedStateRegistryKey(StreamStateHandle handle) {
+        String keyString = handle.getStreamStateHandleID().getKeyString();

Review Comment:
   WDYT about renaming the corresponding commit from 
   `[FLINK-29913][checkpointing] make IncrementalRemoteKeyedStateHandle register shared state use PhysicalStateHandleID as register key`
   to something like
   `[FLINK-29913][checkpointing] Use PhysicalStateHandleID as a key for shared state of IncrementalRemoteKeyedStateHandle`
   and describe the problem this change solves in the commit message?



-- 
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: issues-unsubscribe@flink.apache.org

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