Skip to content

Commit

Permalink
storcon: exclude non-Active tenants from shard autosplitting (#9743)
Browse files Browse the repository at this point in the history
## Problem

We didn't have a neat way to prevent auto-splitting of tenants. This
could be useful during incidents or for testing.

Closes #9332

## Summary of changes

- Filter splitting candidates by scheduling policy
  • Loading branch information
jcsp authored Nov 14, 2024
1 parent 93939f1 commit 38563de
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions storage_controller/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6356,6 +6356,19 @@ impl Service {

// Pick the biggest tenant to split first
top_n.sort_by_key(|i| i.resident_size);

// Filter out tenants in a prohibiting scheduling mode
{
let locked = self.inner.read().unwrap();
top_n.retain(|i| {
if let Some(shard) = locked.tenants.get(&i.id) {
matches!(shard.get_scheduling_policy(), ShardSchedulingPolicy::Active)
} else {
false
}
});
}

let Some(split_candidate) = top_n.into_iter().next() else {
tracing::debug!("No split-elegible shards found");
return;
Expand Down

1 comment on commit 38563de

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5509 tests run: 5254 passed, 2 failed, 253 skipped (full report)


Failures on Postgres 16

# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_sharded_ingest[release-pg16-github-actions-selfhosted-1] or test_compaction_l0_memory[release-pg16-github-actions-selfhosted]"

Code coverage* (full report)

  • functions: 31.8% (7890 of 24841 functions)
  • lines: 49.4% (62442 of 126383 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
38563de at 2024-11-14T21:28:57.350Z :recycle:

Please sign in to comment.