Izeren commented on code in PR #26663:
URL: https://github.com/apache/flink/pull/26663#discussion_r2156233484


##########
flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/allocator/StateLocalitySlotAssigner.java:
##########
@@ -196,14 +196,16 @@ public Collection<AllocationScore> calculateScore(
     private static long estimateSize(
             KeyGroupRange newRange, VertexAllocationInformation allocation) {
         KeyGroupRange oldRange = allocation.getKeyGroupRange();
+        int numberOfKeyGroups = 
oldRange.getIntersection(newRange).getNumberOfKeyGroups();
         if (allocation.stateSizeInBytes * oldRange.getNumberOfKeyGroups() == 
0) {
-            return 0L;
+            // As we want to maintain same allocation for local recovery, we 
should give positive
+            // score to allocations with the same key group range even when we 
have no state.
+            return numberOfKeyGroups > 0 ? 1 : 0;

Review Comment:
   > Ideally, this should be a separate commit because it fixes a separate 
problem.
   
   I made did these fixes together, because they are both required to fix 
`LocalRecoveryITCase`



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

Reply via email to