Skip to content

Commit b860b81

Browse files
enhancement: hot tier enabled for standalone mode
1 parent 715a546 commit b860b81

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

server/src/handlers/http/logstream.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -953,12 +953,6 @@ pub async fn put_stream_hot_tier(
953953
req: HttpRequest,
954954
body: web::Json<serde_json::Value>,
955955
) -> Result<impl Responder, StreamError> {
956-
if CONFIG.parseable.mode != Mode::Query {
957-
return Err(StreamError::Custom {
958-
msg: "Hot tier can only be enabled in query mode".to_string(),
959-
status: StatusCode::BAD_REQUEST,
960-
});
961-
}
962956
let stream_name: String = req.match_info().get("logstream").unwrap().parse().unwrap();
963957
if !metadata::STREAM_INFO.stream_exists(&stream_name) {
964958
return Err(StreamError::StreamNotFound(stream_name));
@@ -1008,13 +1002,6 @@ pub async fn put_stream_hot_tier(
10081002
}
10091003

10101004
pub async fn get_stream_hot_tier(req: HttpRequest) -> Result<impl Responder, StreamError> {
1011-
if CONFIG.parseable.mode != Mode::Query {
1012-
return Err(StreamError::Custom {
1013-
msg: "Hot tier can only be enabled in query mode".to_string(),
1014-
status: StatusCode::BAD_REQUEST,
1015-
});
1016-
}
1017-
10181005
let stream_name: String = req.match_info().get("logstream").unwrap().parse().unwrap();
10191006

10201007
if !metadata::STREAM_INFO.stream_exists(&stream_name) {
@@ -1040,13 +1027,6 @@ pub async fn get_stream_hot_tier(req: HttpRequest) -> Result<impl Responder, Str
10401027
}
10411028

10421029
pub async fn delete_stream_hot_tier(req: HttpRequest) -> Result<impl Responder, StreamError> {
1043-
if CONFIG.parseable.mode != Mode::Query {
1044-
return Err(StreamError::Custom {
1045-
msg: "Hot tier can only be enabled in query mode".to_string(),
1046-
status: StatusCode::BAD_REQUEST,
1047-
});
1048-
}
1049-
10501030
let stream_name: String = req.match_info().get("logstream").unwrap().parse().unwrap();
10511031

10521032
if !metadata::STREAM_INFO.stream_exists(&stream_name) {

server/src/handlers/http/modal/server.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use crate::handlers::http::users::dashboards;
2929
use crate::handlers::http::users::filters;
3030
use crate::handlers::http::API_BASE_PATH;
3131
use crate::handlers::http::API_VERSION;
32+
use crate::hottier::HotTierManager;
3233
use crate::localcache::LocalCacheManager;
3334
use crate::metrics;
3435
use crate::migration;
@@ -573,6 +574,10 @@ impl Server {
573574

574575
storage::retention::load_retention_from_global();
575576

577+
if let Some(hot_tier_manager) = HotTierManager::global() {
578+
hot_tier_manager.download_from_s3()?;
579+
};
580+
576581
let (localsync_handler, mut localsync_outbox, localsync_inbox) =
577582
sync::run_local_sync().await;
578583
let (mut remote_sync_handler, mut remote_sync_outbox, mut remote_sync_inbox) =

server/src/hottier.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,12 @@ impl HotTierManager {
7373
pub fn global() -> Option<&'static HotTierManager> {
7474
static INSTANCE: OnceCell<HotTierManager> = OnceCell::new();
7575

76-
let hot_tier_path = CONFIG.parseable.hot_tier_storage_path.as_ref()?;
77-
76+
let hot_tier_path = &CONFIG.parseable.hot_tier_storage_path;
77+
if hot_tier_path.is_none() {
78+
return None;
79+
}
7880
Some(INSTANCE.get_or_init(|| {
79-
let hot_tier_path = hot_tier_path.clone();
81+
let hot_tier_path = hot_tier_path.as_ref().unwrap().clone();
8082
std::fs::create_dir_all(&hot_tier_path).unwrap();
8183
HotTierManager {
8284
filesystem: LocalFileSystem::new(),

0 commit comments

Comments
 (0)