mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
wdclient: let a disjoint answer fill an empty cache entry
Skipping the cache for every answer that shares no server with the master view made each read of such a volume another filer lookup, even with no adopted entry to protect. The answer is now cached when nothing is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bc9e2ff20e
commit
421db36ba2
2 files changed
+16
-1
No files matched your search
@@ -670,3 +670,18 @@ func TestDisjointAnswerDoesNotUndoAdoption(t *testing.T) {
|
||||
t.Fatalf("cache holds %v, want only %v", cached, a)
|
||||
}
|
||||
}
|
||||
|
||||
// With nothing cached there is no adopted entry to protect, so a disjoint
|
||||
// answer fills the cache instead of costing a lookup per read.
|
||||
func TestDisjointAnswerFillsEmptyCache(t *testing.T) {
|
||||
a := Location{Url: "a:8080"}
|
||||
b := Location{Url: "b:8080"}
|
||||
mc := moveClient()
|
||||
fc := hookedFilerClient(mc, &testLocationProvider{locations: map[string][]Location{"5": {b}}})
|
||||
pushVolumeLocation(mc, a.Url, []uint32{5}, nil, nil, nil)
|
||||
|
||||
expectServed(t, fc, "5", b)
|
||||
if cached, _ := fc.GetLocations(5); len(cached) != 1 || cached[0].Url != b.Url {
|
||||
t.Fatalf("cache holds %v, want %v", cached, b)
|
||||
}
|
||||
}
|
||||
@@ -455,7 +455,7 @@ func (vc *vidMapClient) fillLocations(vid uint32, locations []Location, epoch ui
|
||||
if current, found := vc.authority.GetCurrentLocations(vid); found {
|
||||
if listed := listedLocations(locations, current); len(listed) > 0 {
|
||||
locations = listed
|
||||
} else {
|
||||
} else if _, cached := vc.vidMap.GetLocations(vid); cached {
|
||||
// Served, but not merged into what a pushed add adopted.
|
||||
cache = false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user