1996fanrui commented on code in PR #22983: URL: https://github.com/apache/flink/pull/22983#discussion_r1260742080
########## flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/channel/ChannelStateWriteRequestExecutorImpl.java: ########## @@ -348,24 +360,29 @@ public void registerSubtask(JobVertexID jobVertexID, int subtaskIndex) { subtaskID.getJobVertexID(), subtaskID.getSubtaskIndex())); lock.notifyAll(); unreadyQueues.put(subtaskID, new ArrayDeque<>()); - if (subtasks.size() == maxSubtasksPerChannelStateFile) { - completeRegister = completeRegister(); + if (subtasks.size() == maxSubtasksPerChannelStateFile && completeRegister()) { + onRegistered.accept(this); } } - if (completeRegister) { - onRegistered.accept(this); + } + + // Only for test to lock the registerLock + @VisibleForTesting + void registerSubtaskWithoutRegisterLock(JobVertexID jobVertexID, int subtaskIndex) { Review Comment: `registerSubtask` method must hold the `registerLock`. This method just for test, these tests don't need to call the `synchronized (registerLock)` repeatedly. Do you mean the method name and the code comment isn't clear? -- 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-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org