Skip to content

Commit 62ef02d

Browse files
authored
Merge pull request #32489 from teskje/initialize-storage-workload-class
controller: initialize workload class for new storage clusters
2 parents 8128af4 + a8a4b67 commit 62ef02d

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

src/controller/src/clusters.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ where
352352
id: ClusterId,
353353
config: ClusterConfig,
354354
) -> Result<(), anyhow::Error> {
355-
self.storage.create_instance(id);
355+
self.storage
356+
.create_instance(id, config.workload_class.clone());
356357
self.compute
357358
.create_instance(id, config.arranged_logs, config.workload_class)?;
358359
Ok(())

src/storage-client/src/controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ pub trait StorageController: Debug {
373373
/// created with zero replicas.
374374
///
375375
/// Panics if a storage instance with the given ID already exists.
376-
fn create_instance(&mut self, id: StorageInstanceId);
376+
fn create_instance(&mut self, id: StorageInstanceId, workload_class: Option<String>);
377377

378378
/// Drops the storage instance with the given ID.
379379
///

src/storage-controller/src/instance.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ where
119119
{
120120
/// Creates a new [`Instance`].
121121
pub fn new(
122+
workload_class: Option<String>,
122123
envd_epoch: NonZeroI64,
123124
metrics: InstanceMetrics,
124125
dyncfg: Arc<ConfigSet>,
@@ -130,7 +131,7 @@ where
130131
let epoch = ClusterStartupEpoch::new(envd_epoch, 0);
131132

132133
let mut instance = Self {
133-
workload_class: None,
134+
workload_class,
134135
replicas: Default::default(),
135136
active_ingestions: Default::default(),
136137
ingestion_exports: Default::default(),

src/storage-controller/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,9 +508,10 @@ where
508508
self.storage_collections.check_exists(id)
509509
}
510510

511-
fn create_instance(&mut self, id: StorageInstanceId) {
511+
fn create_instance(&mut self, id: StorageInstanceId, workload_class: Option<String>) {
512512
let metrics = self.metrics.for_instance(id);
513513
let mut instance = Instance::new(
514+
workload_class,
514515
self.envd_epoch,
515516
metrics,
516517
Arc::clone(self.config().config_set()),

0 commit comments

Comments
 (0)