You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "xiangforever2014 (via GitHub)" <gi...@apache.org> on 2025/07/22 09:16:11 UTC

Re: [PR] [FLINK-23475][runtime][checkpoint] Supports repartition partly finished broacast states [flink]

xiangforever2014 commented on code in PR #16714:
URL: https://github.com/apache/flink/pull/16714#discussion_r2221854064


##########
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/RoundRobinOperatorStateRepartitioner.java:
##########
@@ -459,4 +478,26 @@ private static final class GroupByStateNameResults {
             return byMode.get(mode);
         }
     }
+
+    private static final class StateEntry {
+        final List<Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo>> entries;
+        final BitSet reportedSubtaskIndices;
+
+        public StateEntry(int estimatedEntrySize, int parallelism) {
+            this.entries = new ArrayList<>(estimatedEntrySize);
+            this.reportedSubtaskIndices = new BitSet(parallelism);
+        }
+
+        void addEntry(
+                int subtaskIndex,
+                Tuple2<StreamStateHandle, OperatorStateHandle.StateMetaInfo> entry) {
+            this.entries.add(entry);
+            reportedSubtaskIndices.set(subtaskIndex);
+        }
+
+        boolean isPartiallyReported() {
+            return reportedSubtaskIndices.cardinality() > 0
+                    && reportedSubtaskIndices.cardinality() < reportedSubtaskIndices.size();

Review Comment:
   why here we should compare reportedSubtaskIndices.cardinality() with reportedSubtaskIndices.size()? does it should be the `parallelism` in the constructor?



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