mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-06 21:12:55 +00:00
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:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user