Skip to content

Commit e49742c

Browse files
committed
logstore: refresh the TODO in loading term
Epic: none Release note: none
1 parent f4cd444 commit e49742c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

pkg/kv/kvserver/replica_raftlog.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,13 @@ func (r *Replica) raftTermShMuLocked(index kvpb.RaftIndex) (kvpb.RaftTerm, error
143143
}
144144
// Cache the entry except if it is sideloaded. We don't load/inline the
145145
// sideloaded entries here to keep the term fetching cheap.
146-
// TODO(pav-kv): consider not caching here, after measuring if it makes any
147-
// difference.
146+
//
147+
// TODO(pav-kv): consider not caching here, after measuring or guessing
148+
// whether it makes any difference. It might be harmful to the cache since
149+
// terms tend to be loaded randomly, and the cache assumes moving forward. We
150+
// also now have the term cache in raft which makes optimizations here
151+
// unnecessary. Plus, there is a longer-term better solution not involving
152+
// entry loads: the term cache can be maintained in storage. See #136296.
148153
if typ, _, err := raftlog.EncodingOf(entry); err != nil {
149154
return 0, err
150155
} else if !typ.IsSideloaded() {

0 commit comments

Comments
 (0)