Skip to content

Commit

Permalink
server bug fix
Browse files Browse the repository at this point in the history
1. delete hottier should be restricted for internal streams
2. POST /logstream/{logstream} should be restricted for query mode
  • Loading branch information
nikhilsinhaparseable committed Sep 17, 2024
1 parent db8b726 commit c9c32b0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/src/handlers/http/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ pub async fn post_event(req: HttpRequest, body: Bytes) -> Result<HttpResponse, P
if !STREAM_INFO.stream_exists(&stream_name) {
return Err(PostError::StreamNotFound(stream_name));
}

if CONFIG.parseable.mode == Mode::Query {
return Err(PostError::Invalid(anyhow::anyhow!(
"Ingestion is not allowed in Query mode"
)));
}
flatten_and_push_logs(req, body, stream_name).await?;
Ok(HttpResponse::Ok().finish())
}
Expand Down
7 changes: 7 additions & 0 deletions server/src/handlers/http/logstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,13 @@ pub async fn delete_stream_hot_tier(req: HttpRequest) -> Result<impl Responder,
return Err(StreamError::HotTierNotEnabled(stream_name));
}

if STREAM_INFO.stream_type(&stream_name).unwrap() == Some(StreamType::Internal.to_string()) {
return Err(StreamError::Custom {
msg: "Hot tier can not be deleted for internal stream".to_string(),
status: StatusCode::BAD_REQUEST,
});
}

if let Some(hot_tier_manager) = HotTierManager::global() {
hot_tier_manager.delete_hot_tier(&stream_name).await?;
}
Expand Down

0 comments on commit c9c32b0

Please sign in to comment.