From bc9e2ff20e25dbdc81d5a11272bd6d3e1123395f Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 17 Nov 2026 03:35:29 -0800 Subject: [PATCH] wdclient: gate the master lookup provider's cache writes on the map epoch The provider wrote each answer straight into the vid map, so a lookup sent before a master reset and answered after it landed in the new generation, which a gateway's FilerClient now reads as the current master's view. The answer now goes through fillLocations, which drops it once a reset passed. Co-Authored-By: Claude Opus 5.5 --- weed/wdclient/masterclient.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/weed/wdclient/masterclient.go b/weed/wdclient/masterclient.go index e738c38871..6cc97f76fc 100644 --- a/weed/wdclient/masterclient.go +++ b/weed/wdclient/masterclient.go @@ -72,6 +72,7 @@ func (p *masterVolumeProvider) LookupVolumeIds(ctx context.Context, volumeIds [] func() error { result = make(map[string][]Location) lookupErrors = nil + epoch := p.masterClient.mapEpoch() // Per-attempt timeout bounds both master resolution and the RPC // so a single attempt cannot consume the entire retry budget. @@ -124,10 +125,9 @@ func (p *masterVolumeProvider) LookupVolumeIds(ctx context.Context, volumeIds [] ReadOnly: masterLoc.ReadOnly, ReadOnlyCanDelete: masterLoc.ReadOnlyCanDelete, } - // Update cache with the location - p.masterClient.addLocation(uint32(vid), loc) locations = append(locations, loc) } + p.masterClient.fillLocations(uint32(vid), locations, epoch) if len(locations) > 0 { result[vidOnly] = locations