mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-05 20:42:54 +00:00
storcon: Exclude another secondaries while optimizing secondary (#12251)
## Problem If the node intent includes more than one secondary, we can generate a replace optimization using a candidate node that is already a secondary location. ## Summary of changes - Exclude all other secondary nodes from the scoring process to ensure optimal candidate selection.
This commit is contained in:
committed by
GitHub
parent
01ccb34118
commit
1a5f7ce6ad
@@ -1184,11 +1184,19 @@ impl TenantShard {
|
||||
for secondary in self.intent.get_secondary() {
|
||||
// Make sure we don't try to migrate a secondary to our attached location: this case happens
|
||||
// easily in environments without multiple AZs.
|
||||
let exclude = match self.intent.attached {
|
||||
let mut exclude = match self.intent.attached {
|
||||
Some(attached) => vec![attached],
|
||||
None => vec![],
|
||||
};
|
||||
|
||||
// Exclude all other secondaries from the scheduling process to avoid replacing
|
||||
// one existing secondary with another existing secondary.
|
||||
for another_secondary in self.intent.secondary.iter() {
|
||||
if another_secondary != secondary {
|
||||
exclude.push(*another_secondary);
|
||||
}
|
||||
}
|
||||
|
||||
let replacement = match &self.policy {
|
||||
PlacementPolicy::Attached(_) => {
|
||||
// Secondaries for an attached shard should be scheduled using `SecondaryShardTag`
|
||||
|
||||
Reference in New Issue
Block a user