Izeren commented on code in PR #26663: URL: https://github.com/apache/flink/pull/26663#discussion_r2139604282
########## 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 + // scores to allocations with the same key group range even when we have no state. + return numberOfKeyGroups; Review Comment: > What happens now when we return 0 from here Zero score for all allocations is ignored in the code part that does "priority" allocation. "Remaining slots" are assigned in the order they have been parsed which doesn't have to match old allocations order. I can change it to `numberOfKeyGroups > 0 ? 1 : 0`, that will be sufficient to preserve allocation order when there is "no state" without interfering with the state size allocation logic -- 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