diff --git a/server/src/handlers/http/logstream.rs b/server/src/handlers/http/logstream.rs index f7974220c..433ec3651 100644 --- a/server/src/handlers/http/logstream.rs +++ b/server/src/handlers/http/logstream.rs @@ -338,6 +338,16 @@ pub async fn put_retention( pub async fn get_cache_enabled(req: HttpRequest) -> Result { let stream_name: String = req.match_info().get("logstream").unwrap().parse().unwrap(); + + match CONFIG.parseable.mode { + Mode::Ingest | Mode::All => { + if CONFIG.parseable.local_cache_path.is_none() { + return Err(StreamError::CacheNotEnabled(stream_name)); + } + } + _ => {} + } + let cache_enabled = STREAM_INFO.cache_enabled(&stream_name)?; Ok((web::Json(cache_enabled), StatusCode::OK)) } diff --git a/server/src/storage/staging.rs b/server/src/storage/staging.rs index 512a9c4c0..fa689f0b8 100644 --- a/server/src/storage/staging.rs +++ b/server/src/storage/staging.rs @@ -247,10 +247,16 @@ pub fn convert_disk_files_to_parquet( writer.close()?; for file in files { - if fs::remove_file(file).is_err() { + let file_size = file.metadata().unwrap().len(); + let file_type = file.extension().unwrap().to_str().unwrap(); + + if fs::remove_file(file.clone()).is_err() { log::error!("Failed to delete file. Unstable state"); process::abort() } + metrics::STORAGE_SIZE + .with_label_values(&["staging", stream, file_type]) + .sub(file_size as i64); } }