Repository navigation
fix(zipper): rediscover backends for hot cached paths - #589
Merged
Merged
Conversation
added 2 commits
November 6, 2026 13:31
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both replicas hold the series; one is unreachable for longer than the path cache expiry, then returns. It must rejoin within one more expiry, or the other replica stays the only route and its next miss drops the series. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
emadolsky
approved these changes
Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Reads can drop a whole series for a few minutes although a store still holds it. The zipper's per-backend path cache renews a routing entry from every successful response, including responses to requests it already filtered with that same cache. A path that is read more often than
expireDelaySectherefore never re-runs discovery:expireDelaySec(a store restart or a network block) drops out and never rejoins. Hot paths shrink towards a single replica, and that replica's next timeout returns not-found for the series. With a response cache in front, the gap is served for another cache TTL.Architecture
The bug is in the feedback loop: responses to filtered requests also called
setAll/setLeaves, so the set of routed backends could only shrink while a path stayed hot.The fix adds a local
PathCacheFilteredflag toRenderRequest/FindRequest, set wherebackend.Filterruns (upstream.goFind/Render,stable_render.go). Backends learn paths only from unfiltered (discovery) responses: buffered HTTP, streaming/packed HTTP, gRPC render and exact-name HTTP/gRPC find. The flag is never put on the wire. Stable and opportunistic render batching keep requests with different flags in separate batches, so a filtered request cannot renew entries through a shared batch. Expiry is exclusive at the deadline (now < validUntil).Unchanged: TLD discovery (
tldcacherebuilds per probe cycle and bypassesFilter), replica merge and mismatch modes, response-cache keys, absent-point handling.Before / after
expireDelaySecexpireDelaySecexpireDelaySecand learns the new holderexpireDelaySecRbackend requests/render forRholdersR + (N−R)/K(one discovery per window,Krenders per window)TestPathCacheSteadyStateFanout, 8 backends polled every 5s with a 120s TTL: 1 holder 1.29 requests/render (was 1; always-fan-out is 8), 3 holders 3.21 (was 3).Validation
TestPathCacheReplicaRejoinsAfterOutage: one replica is unreachable for 125s, then returns. Without the fix it is never asked again in any of the four render modes (buffered, stream, packed, gRPC); with the fix it rejoins and the other replica's next miss no longer drops the series.TestPathCacheHotRoutingRediscovery: 12 cases (four render modes × render-only / find-only / mixed) fail without the fix and pass with it.TestUpstreamRoutingCacheMetadataandTestCollectRenderBatchBoundsAndIdentity/different_routing_cache_policycover the upstream flag and batch separation.go test -race ./...and thenativegzipnet tests pass; golangci-lint v2.13.2: 0 issues.