Skip to content

Commit 3c16bd6

Browse files
authored
storcon: skip non-active projects in chaos injection (#9606)
## Problem We may sometimes use scheduling modes like `Pause` to pin a tenant in its current location for operational reasons. It is undesirable for the chaos task to make any changes to such projects. ## Summary of changes - Add a check for scheduling mode - Add a log line when we do choose to do a chaos action for a tenant: this will help us understand which operations originate from the chaos task.
1 parent 123816e commit 3c16bd6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

storage_controller/src/service/chaos_injector.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{sync::Arc, time::Duration};
22

3+
use pageserver_api::controller_api::ShardSchedulingPolicy;
34
use rand::seq::SliceRandom;
45
use rand::thread_rng;
56
use tokio_util::sync::CancellationToken;
@@ -47,6 +48,16 @@ impl ChaosInjector {
4748
.get_mut(victim)
4849
.expect("Held lock between choosing ID and this get");
4950

51+
if !matches!(shard.get_scheduling_policy(), ShardSchedulingPolicy::Active) {
52+
// Skip non-active scheduling policies, so that a shard with a policy like Pause can
53+
// be pinned without being disrupted by us.
54+
tracing::info!(
55+
"Skipping shard {victim}: scheduling policy is {:?}",
56+
shard.get_scheduling_policy()
57+
);
58+
continue;
59+
}
60+
5061
// Pick a secondary to promote
5162
let Some(new_location) = shard
5263
.intent
@@ -63,6 +74,8 @@ impl ChaosInjector {
6374
continue;
6475
};
6576

77+
tracing::info!("Injecting chaos: migrate {victim} {old_location}->{new_location}");
78+
6679
shard.intent.demote_attached(scheduler, old_location);
6780
shard.intent.promote_attached(scheduler, new_location);
6881
self.service.maybe_reconcile_shard(shard, nodes);

0 commit comments

Comments
 (0)