mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-04 12:27:43 +00:00
3430a7ead6
A dirty-subset refresh scans only the dirty disks, so its raw `CapacityUpdate` carries just that subset's `total_used`/`file_count`. `update_capacity` recomputed the correct cluster-wide total into a local variable and wrote it to the cache, but never wrote it back to the `CapacityUpdate` that `refresh_or_join`/`spawn_refresh_if_needed` return and publish to joiners. The admin blocking path (`resolve_admin_used_capacity` -> `refresh_or_join_admin_disks(allow_dirty_subset=true)`) consumes `update.total_used`, so a single dirty disk in an N-disk cluster made admin StorageInfo report only the scanned subset's bytes (a large transient undercount for that request and same-cycle joiners). `CachedDiskCapacity` also dropped each disk's `file_count`/`is_estimated`, so subset refreshes could not recompute a correct cluster file count and would launder an estimated per-disk value into an exact cluster total. Fix: - `update_capacity` now reconciles `total_used`, `file_count`, and `is_estimated` from the full per-disk cache and returns the corrected `CapacityUpdate`. - `CachedDiskCapacity` stores `file_count`/`is_estimated` per disk; `file_count` sums the cache and `is_estimated` is the OR across disks. - `refresh_or_join` and `spawn_refresh_if_needed` rebind their result to the reconciled update so the leader return value and the value published to joiners both carry cluster totals. Tests: extend the subset-refresh test to assert the returned update's reconciled `total_used`/`file_count`/`is_estimated`, and add a `refresh_or_join` dirty-subset test asserting the leader returns the merged cluster total (not the subset sum) and matches the cache. Refs: https://github.com/rustfs/backlog/issues/1011