Skip to content

Commit 6802f7c

Browse files
skip internal stream hottier for suspended tenant (#1606)
1 parent 8d82760 commit 6802f7c

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/hottier.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use crate::{
2727
handlers::http::cluster::PMETA_STREAM_NAME,
2828
parseable::PARSEABLE,
2929
storage::{ObjectStorageError, field_stats::DATASET_STATS_STREAM_NAME},
30+
tenants::TENANT_METADATA,
3031
utils::{extract_datetime, human_size::bytes_to_human_size},
3132
validator::error::HotTierValidationError,
3233
};
@@ -787,6 +788,13 @@ impl HotTierManager {
787788
};
788789

789790
for tenant_id in tenants {
791+
// Skip suspended tenants — their hot tier directories are cleaned up on suspension
792+
if let Some(tid) = tenant_id.as_ref()
793+
&& TENANT_METADATA.is_workspace_suspended(tid)
794+
{
795+
continue;
796+
}
797+
790798
if !self.check_stream_hot_tier_exists(PMETA_STREAM_NAME, &tenant_id) {
791799
let mut stream_hot_tier = StreamHotTier {
792800
version: Some(CURRENT_HOT_TIER_VERSION.to_string()),
@@ -810,6 +818,13 @@ impl HotTierManager {
810818
vec![None]
811819
};
812820
for tenant_id in tenants {
821+
// Skip suspended tenants — their hot tier directories are cleaned up on suspension
822+
if let Some(tid) = tenant_id.as_ref()
823+
&& TENANT_METADATA.is_workspace_suspended(tid)
824+
{
825+
continue;
826+
}
827+
813828
// Check if pstats hot tier already exists
814829
if !self.check_stream_hot_tier_exists(DATASET_STATS_STREAM_NAME, &tenant_id) {
815830
// Check if pstats stream exists in storage by attempting to load it

src/tenants/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ impl TenantMetadata {
133133
}
134134
}
135135

136+
pub fn is_workspace_suspended(&self, tenant_id: &str) -> bool {
137+
self.tenants
138+
.get(tenant_id)
139+
.map(|t| t.suspended_services.contains(&Service::Workspace))
140+
.unwrap_or(false)
141+
}
142+
136143
pub fn get_tenants(&self) -> Vec<(String, StorageMetadata)> {
137144
self.tenants
138145
.iter()

0 commit comments

Comments
 (0)