Skip to content

Commit

Permalink
fix: delete node endpoint (#731)
Browse files Browse the repository at this point in the history
delete ingester if offline
  • Loading branch information
Eshanatnight authored Apr 2, 2024
1 parent 5c2be32 commit 01eb76c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/src/handlers/http/cluster/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@

pub mod utils;

use crate::handlers::http::cluster::utils::{
check_liveness, ingester_meta_filename, to_url_string,
};
use crate::handlers::http::cluster::utils::{check_liveness, to_url_string};
use crate::handlers::http::ingest::PostError;
use crate::handlers::http::logstream::error::StreamError;
use crate::handlers::{STATIC_SCHEMA_FLAG, TIME_PARTITION_KEY};
use crate::option::CONFIG;

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

let ingester_meta_filename = ingester_meta_filename(&domain_name);
let url = Url::parse(&domain_name).unwrap();
let ingester_meta_filename = ingester_metadata_path(
url.host_str().unwrap().to_owned(),
url.port().unwrap().to_string(),
)
.to_string();
let object_store = CONFIG.storage().get_object_store();
let msg = match object_store
.try_delete_ingester_meta(ingester_meta_filename)
Expand Down
2 changes: 2 additions & 0 deletions server/src/handlers/http/cluster/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ pub async fn send_stats_request(
}

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

0 comments on commit 01eb76c

Please sign in to comment.