Skip to content

Commit 0e5ba7d

Browse files
committed
logstore: use entry cache Get() to find entry
Epic: none Release note: none
1 parent 0cbfd4a commit 0e5ba7d

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

pkg/kv/kvserver/logstore/sideload.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,11 @@ func MaybeInlineSideloadedRaftCommand(
169169
return nil, nil
170170
}
171171
log.Event(ctx, "inlining sideloaded SSTable")
172-
// We could unmarshal this yet again, but if it's committed we
173-
// are very likely to have appended it recently, in which case
174-
// we can save work.
175-
cachedSingleton, _, _, _ := entryCache.Scan(
176-
nil, rangeID, kvpb.RaftIndex(ent.Index), kvpb.RaftIndex(ent.Index+1), 1<<20,
177-
)
178-
179-
if len(cachedSingleton) > 0 {
172+
// We could unmarshal this yet again, but if it's committed we are very likely
173+
// to have appended it recently, in which case we can save work.
174+
if entry, hit := entryCache.Get(rangeID, kvpb.RaftIndex(ent.Index)); hit {
180175
log.Event(ctx, "using cache hit")
181-
return &cachedSingleton[0], nil
176+
return &entry, nil
182177
}
183178

184179
// Make a shallow copy.

0 commit comments

Comments
 (0)