hanahmily commented on code in PR #670: URL: https://github.com/apache/skywalking-banyandb/pull/670#discussion_r2109273212
########## banyand/internal/storage/cache.go: ########## Review Comment: You need test this file ########## banyand/measure/part_iter.go: ########## @@ -180,8 +184,18 @@ func searchPBM(pbmIndex []primaryBlockMetadata, sid common.SeriesID) []primaryBl } func (pi *partIter) readPrimaryBlock(bms []blockMetadata, mr *primaryBlockMetadata) ([]blockMetadata, error) { - pi.compressedPrimaryBuf = bytes.ResizeOver(pi.compressedPrimaryBuf, int(mr.size)) - fs.MustReadData(pi.p.primary, int64(mr.offset), pi.compressedPrimaryBuf) + pi.compressedPrimaryBuf = pi.sc.Get(storage.EntryKey{ + PartID: pi.p.partMetadata.ID, + Offset: mr.offset, + }) + if pi.compressedPrimaryBuf == nil { + pi.compressedPrimaryBuf = bytes.ResizeOver(pi.compressedPrimaryBuf, int(mr.size)) + fs.MustReadData(pi.p.primary, int64(mr.offset), pi.compressedPrimaryBuf) + pi.sc.Put(storage.EntryKey{ + PartID: pi.p.partMetadata.ID, + Offset: mr.offset, + }, pi.compressedPrimaryBuf) + } Review Comment: We should cache `[]blockMetadata` instead of the byte array. ########## banyand/measure/query.go: ########## @@ -148,14 +149,17 @@ func (s *measure) Query(ctx context.Context, mqo model.MeasureQueryOptions) (mqr continue } parts, n = s.getParts(parts, qo.minTimestamp, qo.maxTimestamp) + for j := 1; j <= n; j++ { Review Comment: Would you put the cache into a part in `table.getParts`? A possible path to inject the cache into tstable in `openShard`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@skywalking.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org