Skip to content

Commit

Permalink
sstable: increment BlockBytes and BlockReadDuration together
Browse files Browse the repository at this point in the history
During a cache miss, increment the BlockBytes and BlockReadDuration iterator
stats together, immediately after the read. Previously, if an error occurred,
it was possible for the duration to be incremented without updating the bytes
stats.
  • Loading branch information
jbowens committed Jun 5, 2024
1 parent 907d865 commit 90b8682
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions sstable/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,7 @@ func (r *Reader) readBlock(
int(bh.Length+blockTrailerLen), readDuration.String())
}
if stats != nil {
stats.BlockBytes += bh.Length
stats.BlockReadDuration += readDuration
}
if err != nil {
Expand Down Expand Up @@ -718,9 +719,6 @@ func (r *Reader) readBlock(
decompressed = transformed
}

if stats != nil {
stats.BlockBytes += bh.Length
}
if iterStats != nil {
iterStats.reportStats(bh.Length, 0, readDuration)
}
Expand Down

0 comments on commit 90b8682

Please sign in to comment.