Skip to content

[Tech Request]: File-service cache v2: one range-fill model for the disk and index-file caches #33543

Todo

Description

@cpegeric

Is there an existing issue for the same tech request?

  • I have checked the existing issues.

Does this tech request not affect user experience?

  • This tech request doesn't affect user experience.

What would you like to be added ?

File-service cache v2: one range-fill model for the disk cache and the index-file cache (design doc docs/design/20261126-fileservice-cache-v2.md).

  • Every cached object is a set of immutable range files r<off>-<size>_<obj>.mofscache; a whole object is the range [0, size).
  • All fills, whole or ranged, go through one registry and one planner. A read takes each piece from a cached range, a running fill or a new fill, in that order.
  • Every object-storage request goes through the object storage server, which owns room, priority and a memory budget. A slow stream reader never holds request room.
  • One publisher per cache writes and removes cache files, ordered per object.
  • A whole-object fill takes its size from its first part's response; a 16 MiB first read of a smaller object returns it whole.

Why is this needed ?

The current disk cache has separate whole-file and range paths, versioned reads, and stream snapshot/restore, which have produced repeated integration bugs (stalls, leaked buffers, budget bypasses). Range fills also stop whole-object prefetch from thrashing the cache on column-subset scans.

Additional information

  • Upgrade: cache files with old names are removed at startup, so the disk cache starts cold after the upgrade (decided). With fix-missing on, main's whole-object files are kept until the restore has written their missing objects.
  • Cached objects are assumed immutable, as on main; the paths main writes again are audited in the design doc.
  • IsWholeObjectCached means "the cached ranges cover [0, size)".
  • Decisions (2026-12-01):
    • The configured max-conns-per-host / concurrency have a floor of 64: 1 to 63 is a misconfiguration and fails startup; the object storage server itself has no floor.
    • max-conns-per-host / concurrency in a SQL path's s3-opts cap each file service made for that path (as on main), from 1 up to the configured max-conns-per-host; a larger value is rejected.
    • A server's background share is half its room, rounded down; with a room of 1 a background request runs as a foreground one.
    • A stream reads object storage in parts of at most 8 MiB into one buffer it owns, outside the memory budget; a part read ahead is charged and taken only when it fits; each part reads the version of the first.
    • IndexFileObject never comes with SkipAllCache; a read with both is outside the contract.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/tech-request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions