Repository navigation
Description
Summary
On a FUSE cache miss, ask the cluster which peers hold the key and, on a match, read further from S3 —
not from the peer. A peer's claim is evidence that the key is hot in this cluster, which is the one thing a
cold node cannot learn on its own; the bytes still come from the object store.
Why this is a rescope, and it is not a smaller version of the same thing
The original plan above fetched the bytes from the peer via ExecuteOperation(&types.ReadOp{...}). That
transport cannot carry them. A remote operation response travels a gossip datagram, whose ceiling was
measured at 5802 bytes of object payload at the default max_gossip_packet of 8192 — so a single
128 KiB kernel read is 21× over and is refused at the socket. The responder logs and abandons; the
requester learns nothing until a 30-second timeout on a different host. #399 made that failure honest
(it now returns a size-naming error instead of a timeout), which is what made this rescope possible rather
than merely necessary.
So peer-fetch is not implemented, and a peer_fetch_timeout config knob would describe a code path that
does not exist. Serving object bytes between nodes needs a stream transport, which is its own piece of
work; #399 records that direction.
What was implemented
FileSystem.warmFromPeers, called from FileHandle.Read on the miss path only:
- Query
QueryKeyOwnership. No holders, or an error, warms nothing — the read has already succeeded. - Compare each holder's ETag against the version this node is reading, from the metadata cache. A version
mismatch, or no known version on either side, warms nothing. A holder's range describes the object it
cached; against another version the object may have a different length entirely, so warming on it fetches
bytes chosen by a claim about something else. Same fail-closed ruleannounceCachedapplies in the other
direction. - Of the holders at the matching version, take the one reaching furthest, not the freshest: holders
arrive freshest-first and the most recent claim can be the shortest. ALengthof 0 means the whole
object fromOffset, pertypes.KeyAnnouncement. - Warm
[end of this read, that holder's end), capped atmaxPeerWarmBytes= 4 MiB per miss. That is
the bound on wasted egress; it is deliberately notread_ahead.window_size, which is a prediction from
this reader's own offsets rather than a claim by another node. - Queue it through the read-ahead prefetch queue, so it inherits EOF clamping, skipping what is cached,
standing off in-flight reads, and flight-sharing. It does not update the read pattern — another
node's reads must not decide whether this reader looks sequential. - Called from
Readand never fromfetchUncached, so a warm's own GET cannot query ownership and queue
another; a warm cannot feed itself and walk the object. cache.read_ahead.enabled: falsesuppresses the warm and the query, rather than asking peers and
discarding the answer — one gossip round trip per cache miss in exchange for nothing.
Acceptance Criteria
- A miss on a key a peer holds past the read queues a warm of
[read end, holder end)— offset and
length both asserted, since starting at the read's own offset re-fetches what was just cached - The warmed range really is fetched from S3 and lands in this node's cache: asserted on observed
GETs and oncache.Getanswering for the whole warmed range, not on a queued request - A claim about a different version warms nothing; so does a read with no version known for the
object - The furthest holder at the matching version wins, with a further-reaching wrong-version claim present
to catch an implementation that checks the ETag after choosing -
Length: 0is read as the whole object rather than as an empty range - The warm is capped at 4 MiB against a peer claiming a 64 MiB object
- No holder reaching past the read warms nothing — the ordinary case, and why warming cannot loop
- A nil coordinator asks no peers and queues nothing; a nil read-ahead manager does not panic
- Read-ahead disabled issues no ownership query
- A failed ownership query does not affect the read's returned bytes
- The read pattern's
predictedNextandsequentialHitsare unchanged by a warm -
go test -race ./internal/fuse/...passes; all nine guards mutation-verified (each mutation breaks a
named test)
Not implemented, deliberately: peer fetch, Cluster.PeerFetchTimeout, and the 500 ms peer timeout — see
above.
Activity
feat(types)!: cache coordination on DistributedCoordinator, with stub…
scttfrdmn commentedon Aug 9, 2026
Proposing a rescope: metadata over gossip, bytes from S3. The title — "try peers before S3 on cache miss" — describes fetching data from a peer, and that cannot be built on the transport this project has. #399 has the measurement.
Why the current scope is blocked
The only node-to-node transport is UDP gossip, and a remote operation's response goes through
sendMessage'sMaxGossipPacketguard (gossip.go:1246).NodeResult.Datais a[]byte, so JSON base64-encodes it, and the envelope and MAC add more on top. Binary-searched against the realsealpath at the default 8192:MaxRead: 175220 sealed, 21× overSo a peer fetch fails for essentially every real read, and it fails in the worst available way: the responder logs
"failed to send operation response"at Warn (coordinator.go:705) and abandons the request, and the requester reports"operation timed out waiting for remote response"30 seconds later (coordinator.go:578). A size failure presented as a timeout, on a different host, at a level most deployments do not collect. RaisingMaxGossipPacketis not the fix — past the ~1500-byte path MTU it trades a clean error for IP fragmentation, where one lost fragment silently discards the datagram.The rescope
Keep gossip carrying only what fits in a datagram, which is metadata:
KeyAnnouncement.GetObjectfrom S3 rather than from the peer.Step 4 is the change, and it still pays: the value is knowing which keys are worth warming, not where the bytes come from. A peer holding a key at the current ETag is evidence that key is hot in this cluster — which is exactly what a cold node cannot know on its own, and exactly what #143's
cache.Warmup(internal/cache/multilevel.go:301) consumes, oneGetObjectper key. S3 read bandwidth is not the scarce resource here; knowing what to read is.What it gives up is the LAN-versus-S3 latency win on a miss. That is real, and it is what direction 2 in #399 (a separate stream transport, with its own listener, authentication and backpressure) would buy back later, as its own piece of work rather than as a hidden prerequisite of this one.
KeyAnnouncementneeds no change either waypkg/types/types.go:60already carriesKey,NodeID,ETag,Size,CachedAt,OffsetandLength— and its doc comment is explicit that the version is required rather than optional, precisely so a recipient can place the bytes relative to the object in the bucket. That reasoning holds under both scopes: under the rescope, the ETag is what lets a querier decide whether the peer's copy is the version it wants before spending a read.Happy to be overruled on the direction, but the metadata-only version is buildable on today's transport and the data-plane version is not, so filing the distinction rather than discovering it mid-implementation.
fix(distributed): a size failure that arrived as a timeout, and a bac…