feat(ecstore): implement decommission and rebalance (#2281)

Co-authored-by: weisd <im@weisd.in>
Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
安正超
2026-03-26 11:44:02 +08:00
committed by GitHub
parent 59c437d901
commit a236b0d01d
20 changed files with 7812 additions and 1304 deletions
+15 -2
View File
@@ -49,7 +49,7 @@ use crate::{
StorageAPI,
config::com::{CONFIG_PREFIX, read_config},
disk::{MIGRATING_META_BUCKET, RUSTFS_META_BUCKET},
global::{get_global_endpoints, is_first_cluster_node_local},
global::is_first_cluster_node_local,
store::ECStore,
store_api::{ObjectIO as _, ObjectOptions, PutObjReader},
};
@@ -1006,7 +1006,7 @@ impl TierConfigMgr {
#[tracing::instrument(level = "debug", name = "tier_save", skip(self))]
pub async fn save(&self) -> std::result::Result<(), std::io::Error> {
let Some(api) = new_object_layer_fn() else {
return Err(std::io::Error::other("errServerNotInitialized"));
return Err(tier_config_not_initialized_error("save tiering config"));
};
//let (pr, opts) = GLOBAL_TierConfigMgr.write().config_reader()?;
@@ -1231,6 +1231,10 @@ pub fn is_err_config_not_found(err: &StorageError) -> bool {
matches!(err, StorageError::ObjectNotFound(_, _) | StorageError::BucketNotFound(_)) || err == &StorageError::ConfigNotFound
}
fn tier_config_not_initialized_error(operation: &str) -> std::io::Error {
std::io::Error::other(format!("failed to {operation}: object layer not initialized"))
}
#[cfg(test)]
mod tests {
use super::*;
@@ -1335,4 +1339,13 @@ mod tests {
Some("bucket-a")
);
}
#[test]
fn test_tier_config_not_initialized_error_formats_operation_context() {
let err = tier_config_not_initialized_error("save tiering config");
let rendered = err.to_string();
assert!(rendered.contains("failed to save tiering config"), "{rendered}");
assert!(rendered.contains("object layer not initialized"), "{rendered}");
}
}