Skip to content

Commit 01eb76c

Browse files
authored
fix: delete node endpoint (#731)
delete ingester if offline
1 parent 5c2be32 commit 01eb76c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

server/src/handlers/http/cluster/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,14 @@
1818

1919
pub mod utils;
2020

21-
use crate::handlers::http::cluster::utils::{
22-
check_liveness, ingester_meta_filename, to_url_string,
23-
};
21+
use crate::handlers::http::cluster::utils::{check_liveness, to_url_string};
2422
use crate::handlers::http::ingest::PostError;
2523
use crate::handlers::http::logstream::error::StreamError;
2624
use crate::handlers::{STATIC_SCHEMA_FLAG, TIME_PARTITION_KEY};
2725
use crate::option::CONFIG;
2826

2927
use crate::metrics::prom_utils::Metrics;
28+
use crate::storage::object_storage::ingester_metadata_path;
3029
use crate::storage::ObjectStorageError;
3130
use crate::storage::PARSEABLE_ROOT_DIRECTORY;
3231
use actix_web::http::header;
@@ -380,7 +379,12 @@ pub async fn remove_ingester(req: HttpRequest) -> Result<impl Responder, PostErr
380379
return Err(PostError::Invalid(anyhow::anyhow!("Node Online")));
381380
}
382381

383-
let ingester_meta_filename = ingester_meta_filename(&domain_name);
382+
let url = Url::parse(&domain_name).unwrap();
383+
let ingester_meta_filename = ingester_metadata_path(
384+
url.host_str().unwrap().to_owned(),
385+
url.port().unwrap().to_string(),
386+
)
387+
.to_string();
384388
let object_store = CONFIG.storage().get_object_store();
385389
let msg = match object_store
386390
.try_delete_ingester_meta(ingester_meta_filename)

server/src/handlers/http/cluster/utils.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,8 @@ pub async fn send_stats_request(
243243
}
244244

245245
/// domain_name needs to be http://ip:port
246+
/// dead code for now
247+
#[allow(dead_code)]
246248
pub fn ingester_meta_filename(domain_name: &str) -> String {
247249
if domain_name.starts_with("http://") | domain_name.starts_with("https://") {
248250
let url = Url::parse(domain_name).unwrap();

0 commit comments

Comments
 (0)