mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-24 13:16:28 +00:00
refactor: prune root runtime compat aliases (#3687)
This commit is contained in:
@@ -146,6 +146,9 @@ RustFS root `storage_compat.rs` must expose bucket metadata and quota contracts
|
|||||||
as explicit aliases only. Broad `metadata`, `metadata_sys`, and `quota` module
|
as explicit aliases only. Broad `metadata`, `metadata_sys`, and `quota` module
|
||||||
passthroughs are reserved to narrower app/admin/storage compatibility
|
passthroughs are reserved to narrower app/admin/storage compatibility
|
||||||
boundaries that still need module-local owner cleanup.
|
boundaries that still need module-local owner cleanup.
|
||||||
|
Root runtime storage config initialization and disk endpoint contracts must also
|
||||||
|
stay explicit aliases. The root compatibility boundary must not restore `com`,
|
||||||
|
bare `init`, or grouped `endpoint::Endpoint` passthroughs.
|
||||||
|
|
||||||
ECStore ClusterControlPlane read models must stay owned by the crate-private
|
ECStore ClusterControlPlane read models must stay owned by the crate-private
|
||||||
`cluster` module. Public access goes through `rustfs_ecstore::api::cluster` so
|
`cluster` module. Public access goes through `rustfs_ecstore::api::cluster` so
|
||||||
|
|||||||
@@ -5,16 +5,17 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
|||||||
## Current Context
|
## Current Context
|
||||||
|
|
||||||
- Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660)
|
- Issue: [`rustfs/backlog#660`](https://github.com/rustfs/backlog/issues/660)
|
||||||
- Branch: `overtrue/arch-root-runtime-compat-boundaries`
|
- Branch: `overtrue/arch-root-runtime-compat-aliases`
|
||||||
- Baseline: completed `C-011/C-012/C-013/API-055/API-059`.
|
- Baseline: completed `C-011/C-012/C-013/API-055/API-059/API-079`.
|
||||||
- Stacked on: main after workload admission provider composition.
|
- Stacked on: API-079 root runtime bucket compatibility pruning.
|
||||||
- PR type for this branch: `pure-move`
|
- PR type for this branch: `pure-move`
|
||||||
- Runtime behavior changes: none.
|
- Runtime behavior changes: none.
|
||||||
- Rust code changes: prune broad root bucket metadata/quota compatibility module
|
- Rust code changes: prune root config read/write, config initialization, and
|
||||||
passthroughs into explicit aliases for the current RustFS root consumers.
|
disk endpoint compatibility passthroughs into explicit aliases for startup
|
||||||
- CI/script changes: guard against restoring broad root bucket compatibility
|
and runtime consumers.
|
||||||
|
- CI/script changes: guard against restoring broad root config and disk endpoint
|
||||||
module passthroughs.
|
module passthroughs.
|
||||||
- Docs changes: record the API-079 root runtime bucket compatibility boundary.
|
- Docs changes: record the API-080 root runtime compatibility alias boundary.
|
||||||
|
|
||||||
## Phase 0 Tasks
|
## Phase 0 Tasks
|
||||||
|
|
||||||
@@ -124,6 +125,23 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
|||||||
bucket metadata ownership, and all app/admin/storage compatibility paths.
|
bucket metadata ownership, and all app/admin/storage compatibility paths.
|
||||||
- Verification: RustFS compile coverage, formatting, diff hygiene, risk
|
- Verification: RustFS compile coverage, formatting, diff hygiene, risk
|
||||||
scan, architecture guard, pre-commit quality gate, and three-expert review.
|
scan, architecture guard, pre-commit quality gate, and three-expert review.
|
||||||
|
- [x] `API-080` Prune root runtime config and disk compatibility aliases.
|
||||||
|
- Completed slice: replace root config `com` passthroughs with explicit
|
||||||
|
config read/write aliases for module switches, expose ECStore config
|
||||||
|
initialization as `init_ecstore_config`, split disk endpoint access into an
|
||||||
|
explicit `Endpoint` alias, and guard these root aliases against broad
|
||||||
|
module restores.
|
||||||
|
- Acceptance: startup storage initializes ECStore config through a direct
|
||||||
|
compatibility alias, module switch persistence uses direct config IO
|
||||||
|
aliases, root runtime disk endpoint consumers keep the same endpoint type,
|
||||||
|
and app/admin/storage local compatibility modules remain unchanged for
|
||||||
|
their own cleanup slices.
|
||||||
|
- Must preserve: startup storage initialization order, global config
|
||||||
|
migration/retry behavior, module switch persistence semantics, endpoint
|
||||||
|
parsing/layout behavior, local disk and lock-client initialization,
|
||||||
|
readiness marking, and all app/admin/storage compatibility paths.
|
||||||
|
- Verification: RustFS compile coverage, formatting, diff hygiene, risk
|
||||||
|
scan, architecture guard, pre-commit quality gate, and three-expert review.
|
||||||
- [x] `G-012` Inventory placement and repair invariants.
|
- [x] `G-012` Inventory placement and repair invariants.
|
||||||
- Acceptance:
|
- Acceptance:
|
||||||
[`placement-repair-invariants.md`](placement-repair-invariants.md) records
|
[`placement-repair-invariants.md`](placement-repair-invariants.md) records
|
||||||
@@ -3157,14 +3175,23 @@ Status values: `[ ]` not started, `[~]` in progress, `[x]` complete, `[!]` block
|
|||||||
|
|
||||||
| Expert | Status | Notes |
|
| Expert | Status | Notes |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| Quality/architecture | passed | API-079 narrows the root RustFS bucket compatibility boundary to explicit aliases without adding new ECStore ownership cycles. |
|
| Quality/architecture | passed | API-080 narrows root runtime config and disk endpoint compatibility to explicit aliases without adding new ECStore ownership cycles. |
|
||||||
| Migration preservation | passed | Bucket notification loading, table-catalog metadata checks, quota error mapping, and app/admin/storage compatibility paths remain preserved. |
|
| Migration preservation | passed | Startup config initialization, module switch persistence, endpoint handling, local disk/lock setup, readiness, and app/admin/storage compatibility paths remain preserved. |
|
||||||
| Testing/verification | passed | RustFS compile coverage, migration guard, formatting, diff hygiene, added-line risk scan, full pre-commit, and three-expert review passed. |
|
| Testing/verification | passed | RustFS compile coverage, migration guard, formatting, diff hygiene, added-line risk scan, full pre-commit, and three-expert review passed. |
|
||||||
|
|
||||||
## Verification Notes
|
## Verification Notes
|
||||||
|
|
||||||
Passed before push:
|
Passed before push:
|
||||||
|
|
||||||
|
- Issue #660 API-080 current slice:
|
||||||
|
- `cargo check -p rustfs --lib`: passed.
|
||||||
|
- `cargo fmt --all --check`: passed.
|
||||||
|
- `git diff --check`: passed.
|
||||||
|
- `bash -n scripts/check_architecture_migration_rules.sh`: passed.
|
||||||
|
- `./scripts/check_architecture_migration_rules.sh`: passed.
|
||||||
|
- Rust added-line risk scan on changed Rust files and guard script: passed.
|
||||||
|
- `make pre-commit`: passed.
|
||||||
|
|
||||||
- Issue #660 C-013 current slice:
|
- Issue #660 C-013 current slice:
|
||||||
- `cargo test -p rustfs-concurrency workload::tests:: -- --nocapture`:
|
- `cargo test -p rustfs-concurrency workload::tests:: -- --nocapture`:
|
||||||
passed.
|
passed.
|
||||||
|
|||||||
@@ -13,9 +13,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
use crate::storage_compat::{
|
use crate::storage_compat::{
|
||||||
EcstoreError as StorageError,
|
EcstoreError as StorageError, read_ecstore_config, resolve_object_store_handle, save_ecstore_config,
|
||||||
com::{read_config, save_config},
|
|
||||||
resolve_object_store_handle,
|
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
@@ -166,7 +164,7 @@ pub(crate) async fn refresh_persisted_module_switches_from_store() -> Result<Per
|
|||||||
return Err("storage layer not initialized".to_string());
|
return Err("storage layer not initialized".to_string());
|
||||||
};
|
};
|
||||||
|
|
||||||
let (config, configured) = match read_config(store, MODULE_SWITCH_CONFIG_PATH).await {
|
let (config, configured) = match read_ecstore_config(store, MODULE_SWITCH_CONFIG_PATH).await {
|
||||||
Ok(data) => (
|
Ok(data) => (
|
||||||
serde_json::from_slice::<PersistedModuleSwitches>(&data)
|
serde_json::from_slice::<PersistedModuleSwitches>(&data)
|
||||||
.map_err(|e| format!("failed to deserialize module switch config: {e}"))?,
|
.map_err(|e| format!("failed to deserialize module switch config: {e}"))?,
|
||||||
@@ -188,7 +186,7 @@ pub(crate) async fn save_persisted_module_switches_to_store(config: PersistedMod
|
|||||||
};
|
};
|
||||||
|
|
||||||
let data = serde_json::to_vec(&config).map_err(|e| format!("failed to serialize module switch config: {e}"))?;
|
let data = serde_json::to_vec(&config).map_err(|e| format!("failed to serialize module switch config: {e}"))?;
|
||||||
save_config(store, MODULE_SWITCH_CONFIG_PATH, data)
|
save_ecstore_config(store, MODULE_SWITCH_CONFIG_PATH, data)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| format!("failed to save module switch config: {e}"))?;
|
.map_err(|e| format!("failed to save module switch config: {e}"))?;
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,8 @@
|
|||||||
|
|
||||||
use crate::startup_fs_guard::enforce_unsupported_fs_policy;
|
use crate::startup_fs_guard::enforce_unsupported_fs_policy;
|
||||||
use crate::storage_compat::{
|
use crate::storage_compat::{
|
||||||
ECStore, EndpointServerPools, init as init_ecstore_config, init_background_replication, init_global_config_sys,
|
ECStore, EndpointServerPools, init_background_replication, init_ecstore_config, init_global_config_sys, init_local_disks,
|
||||||
init_local_disks, init_lock_clients, prewarm_local_disk_id_map, set_global_endpoints, try_migrate_server_config,
|
init_lock_clients, prewarm_local_disk_id_map, set_global_endpoints, try_migrate_server_config, update_erasure_type,
|
||||||
update_erasure_type,
|
|
||||||
};
|
};
|
||||||
use rustfs_common::{GlobalReadiness, SystemStage};
|
use rustfs_common::{GlobalReadiness, SystemStage};
|
||||||
use std::{
|
use std::{
|
||||||
|
|||||||
@@ -25,8 +25,10 @@ pub(crate) use rustfs_ecstore::api::bucket::replication::{
|
|||||||
GLOBAL_REPLICATION_STATS, get_global_replication_pool, init_background_replication,
|
GLOBAL_REPLICATION_STATS, get_global_replication_pool, init_background_replication,
|
||||||
};
|
};
|
||||||
pub(crate) use rustfs_ecstore::api::cluster::topology_snapshot_from_endpoint_pools_with_capabilities;
|
pub(crate) use rustfs_ecstore::api::cluster::topology_snapshot_from_endpoint_pools_with_capabilities;
|
||||||
pub(crate) use rustfs_ecstore::api::config::{com, init, init_global_config_sys, try_migrate_server_config};
|
pub(crate) use rustfs_ecstore::api::config::com::{read_config as read_ecstore_config, save_config as save_ecstore_config};
|
||||||
pub(crate) use rustfs_ecstore::api::disk::{DiskAPI, RUSTFS_META_BUCKET, endpoint::Endpoint};
|
pub(crate) use rustfs_ecstore::api::config::{init as init_ecstore_config, init_global_config_sys, try_migrate_server_config};
|
||||||
|
pub(crate) use rustfs_ecstore::api::disk::endpoint::Endpoint;
|
||||||
|
pub(crate) use rustfs_ecstore::api::disk::{DiskAPI, RUSTFS_META_BUCKET};
|
||||||
pub(crate) use rustfs_ecstore::api::error::{Error as EcstoreError, Result as EcstoreResult, StorageError};
|
pub(crate) use rustfs_ecstore::api::error::{Error as EcstoreError, Result as EcstoreResult, StorageError};
|
||||||
pub(crate) use rustfs_ecstore::api::event::{EventArgs as EcstoreEventArgs, register_event_dispatch_hook};
|
pub(crate) use rustfs_ecstore::api::event::{EventArgs as EcstoreEventArgs, register_event_dispatch_hook};
|
||||||
pub(crate) use rustfs_ecstore::api::global::{
|
pub(crate) use rustfs_ecstore::api::global::{
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ RUSTFS_NESTED_STORAGE_COMPAT_HITS_FILE="${TMP_DIR}/rustfs_nested_storage_compat_
|
|||||||
RUSTFS_RUNTIME_SCALAR_STORAGE_COMPAT_HITS_FILE="${TMP_DIR}/rustfs_runtime_scalar_storage_compat_hits.txt"
|
RUSTFS_RUNTIME_SCALAR_STORAGE_COMPAT_HITS_FILE="${TMP_DIR}/rustfs_runtime_scalar_storage_compat_hits.txt"
|
||||||
RUSTFS_RUNTIME_SECONDARY_STORAGE_COMPAT_HITS_FILE="${TMP_DIR}/rustfs_runtime_secondary_storage_compat_hits.txt"
|
RUSTFS_RUNTIME_SECONDARY_STORAGE_COMPAT_HITS_FILE="${TMP_DIR}/rustfs_runtime_secondary_storage_compat_hits.txt"
|
||||||
RUSTFS_ROOT_BUCKET_STORAGE_COMPAT_MODULE_HITS_FILE="${TMP_DIR}/rustfs_root_bucket_storage_compat_module_hits.txt"
|
RUSTFS_ROOT_BUCKET_STORAGE_COMPAT_MODULE_HITS_FILE="${TMP_DIR}/rustfs_root_bucket_storage_compat_module_hits.txt"
|
||||||
|
RUSTFS_ROOT_RUNTIME_STORAGE_COMPAT_MODULE_HITS_FILE="${TMP_DIR}/rustfs_root_runtime_storage_compat_module_hits.txt"
|
||||||
PRODUCTION_UNUSED_COMPAT_ALLOW_HITS_FILE="${TMP_DIR}/production_unused_compat_allow_hits.txt"
|
PRODUCTION_UNUSED_COMPAT_ALLOW_HITS_FILE="${TMP_DIR}/production_unused_compat_allow_hits.txt"
|
||||||
BROAD_STORE_API_COMPAT_REEXPORT_HITS_FILE="${TMP_DIR}/broad_store_api_compat_reexport_hits.txt"
|
BROAD_STORE_API_COMPAT_REEXPORT_HITS_FILE="${TMP_DIR}/broad_store_api_compat_reexport_hits.txt"
|
||||||
NESTED_STORE_API_COMPAT_MODULE_HITS_FILE="${TMP_DIR}/nested_store_api_compat_module_hits.txt"
|
NESTED_STORE_API_COMPAT_MODULE_HITS_FILE="${TMP_DIR}/nested_store_api_compat_module_hits.txt"
|
||||||
@@ -776,6 +777,16 @@ if [[ -s "$RUSTFS_ROOT_BUCKET_STORAGE_COMPAT_MODULE_HITS_FILE" ]]; then
|
|||||||
report_failure "RustFS root storage compatibility must expose bucket metadata/quota contracts as explicit aliases: $(paste -sd '; ' "$RUSTFS_ROOT_BUCKET_STORAGE_COMPAT_MODULE_HITS_FILE")"
|
report_failure "RustFS root storage compatibility must expose bucket metadata/quota contracts as explicit aliases: $(paste -sd '; ' "$RUSTFS_ROOT_BUCKET_STORAGE_COMPAT_MODULE_HITS_FILE")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
(
|
||||||
|
cd "$ROOT_DIR"
|
||||||
|
rg -n --no-heading 'pub\(crate\)\s+use rustfs_ecstore::api::config::\{[^}]*\bcom\b[^}]*\}\s*;|pub\(crate\)\s+use rustfs_ecstore::api::config::\{[^}]*\binit\s*(?:,|})[^}]*\}\s*;|pub\(crate\)\s+use rustfs_ecstore::api::disk::\{[^}]*\bendpoint::Endpoint\b[^}]*\}\s*;' \
|
||||||
|
rustfs/src/storage_compat.rs || true
|
||||||
|
) >"$RUSTFS_ROOT_RUNTIME_STORAGE_COMPAT_MODULE_HITS_FILE"
|
||||||
|
|
||||||
|
if [[ -s "$RUSTFS_ROOT_RUNTIME_STORAGE_COMPAT_MODULE_HITS_FILE" ]]; then
|
||||||
|
report_failure "RustFS root storage compatibility must expose config init and disk endpoint contracts as explicit aliases: $(paste -sd '; ' "$RUSTFS_ROOT_RUNTIME_STORAGE_COMPAT_MODULE_HITS_FILE")"
|
||||||
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "$ROOT_DIR"
|
cd "$ROOT_DIR"
|
||||||
rg -n --no-heading '#!\[allow\(unused_imports\)\]' \
|
rg -n --no-heading '#!\[allow\(unused_imports\)\]' \
|
||||||
|
|||||||
Reference in New Issue
Block a user