strocon: don't overcommit when making node fill plan (#8171)

## Problem
The fill requirement was not taken into account when looking through the
shards of a given node to fill from.

## Summary of Changes
Ensure that we do not fill a node past the recommendation from
`Scheduler::compute_fill_requirement`.
This commit is contained in:
Vlad Lazar
2024-06-27 11:56:57 +01:00
committed by GitHub
parent 32b75e7c73
commit d557002675

View File

@@ -5564,9 +5564,12 @@ impl Service {
break;
}
let mut can_take = attached - expected_attached;
let can_take = attached - expected_attached;
let needed = fill_requirement - plan.len();
let mut take = std::cmp::min(can_take, needed);
let mut remove_node = false;
while can_take > 0 {
while take > 0 {
match tids_by_node.get_mut(&node_id) {
Some(tids) => match tids.pop() {
Some(tid) => {
@@ -5578,7 +5581,7 @@ impl Service {
if *promoted < max_promote_for_tenant {
plan.push(tid);
*promoted += 1;
can_take -= 1;
take -= 1;
}
}
None => {