Skip to content

Conversation

@tennisleng
Copy link
Contributor

Summary

This PR implements the foundation for access-based cold file tiering to address issue #1022.

Changes

1. Access Time Tracking (FileInfo and ObjectInfo)

  • Added last_access_time: Option<OffsetDateTime> field to track when objects are last accessed
  • Updated from_file_info to propagate access time through conversions
  • Updated Clone implementation for ObjectInfo

2. Metadata Constant (filemeta.rs)

  • Added LAST_ACCESS_TIME constant (x-rustfs-last-access-time) for persisting access time in object metadata

3. Cold Tier Configuration Module (cold_tier_config.rs)

New module for configuring cold file tiering:

  • ColdTierConfig struct with configurable settings
  • GlobalColdTierConfig for runtime configuration
  • Environment variable support:
    • RUSTFS_COLD_TIER_ENABLED - Enable/disable cold tiering
    • RUSTFS_COLD_TIER_THRESHOLD_DAYS - Days since last access to mark as cold (default: 30)
    • RUSTFS_COLD_TIER_TARGET - Target tier name for cold files
    • RUSTFS_COLD_TIER_MIN_FILE_SIZE - Minimum file size to consider (default: 1MB)
    • RUSTFS_COLD_TIER_SAMPLE_RATE - Access time update sampling rate

4. Lifecycle Extensions (lifecycle.rs)

  • Added access_time field to ObjectOpts for lifecycle evaluation
  • Added is_cold(threshold_days) method for cold file detection
  • Added effective_access_time() helper method

Testing

  • Added unit tests for ColdTierConfig and GlobalColdTierConfig
  • Tests cover configuration defaults, enabling logic, and sampling rate behavior

Future Work

This PR provides the foundation. Follow-up PRs can:

  1. Integrate access time updates into GET operations
  2. Add scanner integration for automatic cold file detection
  3. Add admin API endpoints for cold tier configuration
  4. Add metrics for cold file transitions

Closes #1022

@CLAassistant
Copy link

CLAassistant commented Dec 7, 2025

CLA assistant check
All committers have signed the CLA.

This commit implements the foundation for access-based cold file tiering:

1. Add last_access_time field to FileInfo and ObjectInfo
   - Track when objects were last accessed for cold detection
   - Propagate access time through from_file_info conversion

2. Add LAST_ACCESS_TIME metadata constant
   - New constant for persisting access time in object metadata

3. Create cold_tier_config module
   - ColdTierConfig struct for cold tier settings
   - GlobalColdTierConfig for runtime configuration
   - Environment variable support (RUSTFS_COLD_TIER_*)
   - Configurable threshold days, target tier, min file size
   - Access time sampling rate to reduce write amplification

4. Extend ObjectOpts with access-based lifecycle support
   - Add access_time field for lifecycle evaluation
   - Add is_cold() method for cold file detection
   - Add effective_access_time() helper method

Closes rustfs#1022
@tennisleng
Copy link
Contributor Author

Closing in favor of split PRs: #1049, #1050

@tennisleng tennisleng closed this Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

moving cold files to cheaper storage backend

2 participants