mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-21 05:24:28 +02:00
2.4 KiB
2.4 KiB
S3 Storage Class to Disk Routing
Problem
SeaweedFS already stores S3 x-amz-storage-class as object metadata, but write allocation (AssignVolume) does not use it. Objects are therefore not routed to specific disk tags by storage class.
Goals
- Route new writes to disk types based on storage class.
- Preserve current behavior when no routing map is configured.
- Keep implementation incremental so future storage-class transitions can reuse the same decision logic.
Phase 1 (implemented in this PR)
Scope
- Configure routing in
filer.toml:- section:
[s3.storage_class_disk_type] - keys: lowercase storage classes (e.g.
standard_ia = "hdd").
- section:
- Load this routing map from filer via gRPC (
GetFilerConfiguration) so S3 instances use filer-provided config. - Provide explicit defaults (when not set in
filer.toml):standard = "ssd"- all colder classes default to
"hdd".
- Resolve effective storage class from:
- request header
X-Amz-Storage-Class - fallback to stored entry metadata (when available)
- fallback to
STANDARD
- request header
- Apply mapped disk type on
AssignVolumeforputToFilerupload path. - For multipart uploads, propagate storage class from upload metadata to part requests so part chunk allocation also follows routing.
Behavior
- If class mapping is not configured explicitly in
filer.toml, filer defaults are applied. - If class is unknown to the routing table at runtime: unchanged behavior (
DiskType=""). - Invalid storage class in request header: return
InvalidStorageClass. - Metadata storage remains AWS-compatible (
X-Amz-Storage-Classis still saved when explicitly provided).
Phase 2 (next)
- Apply the same routing decision to server-side copy chunk allocation paths.
- Ensure storage-class changes via copy (
x-amz-metadata-directive: REPLACE+ new class) move chunks to target disk type immediately.
Phase 3 (future)
- Add async background transition API for in-place class change:
- mark object transition intent in metadata
- enqueue migration job
- copy chunks to target class disk
- atomically swap metadata/chunks
- garbage collect old chunks
- Add transition job status and retry handling.
- Add bucket policy controls for allowed transitions.
Non-goals for Phase 1
- Lifecycle-driven transitions (
STANDARD->GLACIERby age). - Cost-aware placement balancing.
- Cross-cluster migration.