diff --git a/crates/ecstore/src/api/mod.rs b/crates/ecstore/src/api/mod.rs index efc2242b0..9d368cc4a 100644 --- a/crates/ecstore/src/api/mod.rs +++ b/crates/ecstore/src/api/mod.rs @@ -112,9 +112,9 @@ pub mod event { pub mod global { pub use crate::runtime::global::{ - GLOBAL_LOCAL_DISK_MAP, GLOBAL_TierConfigMgr, get_global_bucket_monitor, get_global_deployment_id, - get_global_endpoints_opt, get_global_lock_client, get_global_lock_clients, get_global_region, get_global_tier_config_mgr, - global_rustfs_port, is_dist_erasure, is_erasure, is_erasure_sd, is_first_cluster_node_local, new_object_layer_fn, + GLOBAL_LOCAL_DISK_MAP, get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt, + get_global_lock_client, get_global_lock_clients, get_global_region, get_global_tier_config_mgr, global_rustfs_port, + is_dist_erasure, is_erasure, is_erasure_sd, is_first_cluster_node_local, new_object_layer_fn, resolve_object_store_handle, set_global_endpoints, set_global_region, set_global_rustfs_port, set_object_store_resolver, shutdown_background_services, update_erasure_type, }; diff --git a/crates/ecstore/src/services/tier/tier.rs b/crates/ecstore/src/services/tier/tier.rs index 1df0b5ffd..65c589f34 100644 --- a/crates/ecstore/src/services/tier/tier.rs +++ b/crates/ecstore/src/services/tier/tier.rs @@ -1030,7 +1030,6 @@ impl TierConfigMgr { let Some(api) = runtime_sources::object_store_handle() else { return Err(tier_config_not_initialized_error("save tiering config")); }; - //let (pr, opts) = GLOBAL_TierConfigMgr.write().config_reader()?; self.save_tiering_config(api).await } diff --git a/docs/architecture/global-state-inventory.md b/docs/architecture/global-state-inventory.md index eb87fcb81..79717b0ea 100644 --- a/docs/architecture/global-state-inventory.md +++ b/docs/architecture/global-state-inventory.md @@ -44,7 +44,7 @@ migration PR removes or replaces each item. | `GLOBAL_LOCAL_DISK_MAP`, `GLOBAL_LOCAL_DISK_ID_MAP`, `GLOBAL_LOCAL_DISK_SET_DRIVES` | `crates/ecstore/src/runtime/global.rs` and `crates/ecstore/src/runtime/sources.rs` | Runtime migration target | Needs an ECStore local-disk registry handle before code movement; preserve disk lookup, remote/local classification, and test reset hooks. | | `GLOBAL_ExpiryState`, `GLOBAL_TransitionState`, `GLOBAL_LifecycleSys` | `crates/ecstore/src/bucket/lifecycle/*` and `crates/ecstore/src/runtime/sources.rs` | Runtime migration target | First code-bearing candidate is `GLOBAL_ExpiryState`, because AppContext already has an `ExpiryStateInterface`, resolver, and tests. | | `GLOBAL_REPLICATION_POOL`, `GLOBAL_REPLICATION_STATS`, `GLOBAL_BUCKET_MONITOR` | `crates/ecstore/src/bucket/replication/*`, `crates/ecstore/src/runtime/global.rs` | Runtime migration target | Keep behind AppContext replication and bucket-monitor resolvers until queue admission, stats, and admin reporting coverage are explicit. | -| `GLOBAL_TierConfigMgr`, `GLOBAL_STORAGE_CLASS`, `GLOBAL_CONFIG_SYS`, `GLOBAL_SERVER_CONFIG` | `crates/ecstore/src/config`, `crates/config`, `rustfs/src/app/context/runtime_sources.rs` | Runtime migration target | Move through config/runtime-source owners only; do not combine with storage-class behavior or persistence changes. | +| `GLOBAL_TierConfigMgr`, `GLOBAL_STORAGE_CLASS`, `GLOBAL_CONFIG_SYS`, `GLOBAL_SERVER_CONFIG` | `crates/ecstore/src/config`, `crates/config`, `rustfs/src/app/context/runtime_sources.rs` | Runtime migration target | Tier config manager reads and reloads now use the ECStore runtime-source helper; move remaining config state through config/runtime-source owners only, without combining storage-class behavior or persistence changes. | | `GLOBAL_EventNotifier`, `GLOBAL_NotificationSys` | `crates/ecstore/src/services/*` | Runtime migration target | Preserve notification and audit side effects; move only through notify/runtime-source boundaries. | | `GLOBAL_BOOT_TIME`, `globalDeploymentIDPtr`, `GLOBAL_REGION`, `GLOBAL_RUSTFS_PORT`, `GLOBAL_LocalNodeName` | `crates/ecstore/src/runtime/global.rs`, `crates/ecstore/src/runtime/sources.rs` | Runtime migration target | Boot time reads now go through the ECStore runtime-source API; the remaining scalar handles may migrate in small PRs after call sites use AppContext or owner-local runtime-source readers. | | `GLOBAL_LOCAL_LOCK_CLIENT`, `GLOBAL_LOCK_CLIENTS`, `GLOBAL_LOCK_MANAGER` | `crates/ecstore/src/runtime/global.rs`, `crates/lock` | Runtime migration target / process-global split | Preserve lock quorum and lock client selection; keep process-level lock manager separate from ECStore endpoint-specific clients. | diff --git a/rustfs/src/storage/storage_api.rs b/rustfs/src/storage/storage_api.rs index 9e2aa9a5f..39e375891 100644 --- a/rustfs/src/storage/storage_api.rs +++ b/rustfs/src/storage/storage_api.rs @@ -378,15 +378,14 @@ pub(crate) mod ecstore_global { #[cfg(test)] pub(crate) use rustfs_ecstore::api::global::new_object_layer_fn; pub(crate) use rustfs_ecstore::api::global::{ - GLOBAL_TierConfigMgr, get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt, - get_global_lock_client, get_global_lock_clients, get_global_region, get_global_tier_config_mgr, global_rustfs_port, - is_dist_erasure, set_global_endpoints, set_global_region, set_global_rustfs_port, set_object_store_resolver, - shutdown_background_services, update_erasure_type, + get_global_bucket_monitor, get_global_deployment_id, get_global_endpoints_opt, get_global_lock_client, + get_global_lock_clients, get_global_region, global_rustfs_port, is_dist_erasure, set_global_endpoints, set_global_region, + set_global_rustfs_port, set_object_store_resolver, shutdown_background_services, update_erasure_type, }; } pub(crate) mod ecstore_runtime { - pub(crate) use rustfs_ecstore::api::runtime::boot_time; + pub(crate) use rustfs_ecstore::api::runtime::{boot_time, global_tier_config_mgr}; } #[allow(unused_imports)] @@ -1114,7 +1113,7 @@ pub(crate) fn global_rustfs_port() -> u16 { } pub(crate) fn get_global_tier_config_mgr() -> Arc> { - ecstore_global::get_global_tier_config_mgr() + ecstore_runtime::global_tier_config_mgr() } pub(crate) fn set_object_store_resolver(resolver: Arc) -> bool { @@ -1201,7 +1200,7 @@ pub(crate) fn topology_snapshot_from_endpoint_pools_with_capabilities( } pub(crate) async fn reload_transition_tier_config(api: Arc) -> std::io::Result<()> { - ecstore_global::GLOBAL_TierConfigMgr.write().await.reload(api).await + ecstore_runtime::global_tier_config_mgr().write().await.reload(api).await } pub(crate) async fn all_local_disk_path() -> Vec { diff --git a/scripts/check_architecture_migration_rules.sh b/scripts/check_architecture_migration_rules.sh index 9289fa121..7586976bc 100755 --- a/scripts/check_architecture_migration_rules.sh +++ b/scripts/check_architecture_migration_rules.sh @@ -188,6 +188,7 @@ GLOBAL_LOCAL_NODE_NAME_BYPASS_HITS_FILE="${TMP_DIR}/global_local_node_name_bypas GLOBAL_RUSTFS_ADDR_BYPASS_HITS_FILE="${TMP_DIR}/global_rustfs_addr_bypass_hits.txt" GLOBAL_OUTBOUND_TLS_BYPASS_HITS_FILE="${TMP_DIR}/global_outbound_tls_bypass_hits.txt" GLOBAL_RPC_SECRET_BYPASS_HITS_FILE="${TMP_DIR}/global_rpc_secret_bypass_hits.txt" +GLOBAL_TIER_CONFIG_MGR_BYPASS_HITS_FILE="${TMP_DIR}/global_tier_config_mgr_bypass_hits.txt" LEGACY_ECSTORE_CONFIG_MODEL_HITS_FILE="${TMP_DIR}/legacy_ecstore_config_model_hits.txt" ECSTORE_ROOT_STORE_SET_DISK_MODULE_HITS_FILE="${TMP_DIR}/ecstore_root_store_set_disk_module_hits.txt" ECSTORE_ROOT_STORE_SUPPORT_MODULE_HITS_FILE="${TMP_DIR}/ecstore_root_store_support_module_hits.txt" @@ -2368,6 +2369,18 @@ if [[ -s "$GLOBAL_RPC_SECRET_BYPASS_HITS_FILE" ]]; then report_failure "GLOBAL_RUSTFS_RPC_SECRET access must stay behind rustfs_credentials helpers: $(paste -sd '; ' "$GLOBAL_RPC_SECRET_BYPASS_HITS_FILE")" fi +( + cd "$ROOT_DIR" + rg -n --with-filename '\bGLOBAL_TierConfigMgr\b' \ + crates rustfs fuzz \ + --glob '*.rs' | + rg -v '^crates/ecstore/src/runtime/(global|sources)\.rs:' || true +) >"$GLOBAL_TIER_CONFIG_MGR_BYPASS_HITS_FILE" + +if [[ -s "$GLOBAL_TIER_CONFIG_MGR_BYPASS_HITS_FILE" ]]; then + report_failure "GLOBAL_TierConfigMgr access must stay behind ECStore runtime-source helpers: $(paste -sd '; ' "$GLOBAL_TIER_CONFIG_MGR_BYPASS_HITS_FILE")" +fi + ( cd "$ROOT_DIR" {