Skip to content

fix(mount): preserve default TTL for legacy mount requests#654

Closed
jlon wants to merge 1 commit intoCurvineIO:mainfrom
jlon:fix/mount-ttl-defaults-unified
Closed

fix(mount): preserve default TTL for legacy mount requests#654
jlon wants to merge 1 commit intoCurvineIO:mainfrom
jlon:fix/mount-ttl-defaults-unified

Conversation

@jlon
Copy link
Contributor

@jlon jlon commented Feb 11, 2026

Problem

Mount requests coming from legacy clients (or compatibility paths) may omit ttl_ms and ttl_action in MountOptionsProto.

In the previous flow, missing TTL fields were deserialized as None, then converted into MountInfo as ttl_ms=0 and ttl_action=none. This disabled auto_cache and caused read miss paths to fall back to UFS instead of triggering async cache loading.

Fix Intent

Ensure mount TTL behavior is stable and backward-compatible when optional TTL fields are missing, while keeping default handling centralized to avoid drift across modules.

Implementation Details

  • Added centralized mount default constants in curvine-common/src/state/mount.rs:
    • DEFAULT_MOUNT_TTL_STR (7d)
    • DEFAULT_MOUNT_TTL_ACTION_STR (delete)
    • DEFAULT_MOUNT_TTL_MS
    • DEFAULT_MOUNT_TTL_ACTION
  • Updated MountOptionsBuilder::new() and MountOptions::to_info() to use these constants.
  • Added compatibility backfill at protobuf decode boundary in ProtoUtils::mount_options_from_pb():
    • missing ttl_ms => DEFAULT_MOUNT_TTL_MS
    • missing ttl_action => DEFAULT_MOUNT_TTL_ACTION
  • Updated CLI mount defaults to reference shared constants instead of hardcoded literals.
  • Updated client config defaults (auto_cache_ttl, default_cache_ttl) to reference the same shared mount TTL string constant.

Tests

  • Added regression test: curvine-tests/tests/mount_ttl_compat_test.rs
    • Reproduces legacy payload with missing TTL fields
    • Verifies decode-layer backfill and final MountInfo defaults
    • Verifies auto_cache() remains enabled

Verification

  • RUSTC_WRAPPER= cargo check -p curvine-cli -p curvine-common
  • RUSTC_WRAPPER= cargo test -p curvine-tests --test mount_ttl_compat_test -- --nocapture

@jlon jlon force-pushed the fix/mount-ttl-defaults-unified branch from c0848c8 to e040c41 Compare February 11, 2026 10:17
properties: self.add_properties,
ttl_ms: self.ttl_ms.unwrap_or(0),
ttl_action: self.ttl_action.unwrap_or(TtlAction::None),
ttl_ms: self.ttl_ms.unwrap_or(DEFAULT_MOUNT_TTL_MS),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not set, the default value should be 0, meaning the data will not expire.

@jlon jlon closed this Feb 12, 2026
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.

2 participants