Myasuka commented on a change in pull request #8693:
URL: https://github.com/apache/flink/pull/8693#discussion_r427237171



##########
File path: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/SubtaskCheckpointCoordinatorImpl.java
##########
@@ -126,6 +162,15 @@ public ChannelStateWriter getChannelStateWriter() {
                return channelStateWriter;
        }
 
+       @VisibleForTesting
+       int getAbortedCheckpointSize() {
+               return abortedCheckpointIds.size();
+       }
+
+       private boolean checkpointAlreadyAborted(long checkpointId) {
+               return abortedCheckpointIds.remove(checkpointId);

Review comment:
       Thanks for your remind.
   I'll use a set based on `LinkedHashMap` to implement a set which would 
remove oldest checkpoint id automatically.
   ~~~java
   private Set<Long> createAbortedCheckpointSetWithLimitSize(int 
maxRecordAbortedCheckpoints) {
        return Collections.newSetFromMap(new LinkedHashMap<Long, Boolean>() {
                private static final long serialVersionUID = 1L;
   
                @Override
                protected boolean removeEldestEntry(Map.Entry<Long, Boolean> 
eldest) {
                        return size() > maxRecordAbortedCheckpoints;
                }
        });
   }
   ~~~




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to