From 75d2a9325029b0d7070f84e825ccb541b89bac5d Mon Sep 17 00:00:00 2001 From: Jackson Owens Date: Tue, 4 Jun 2024 17:00:48 -0400 Subject: [PATCH] sstable: increment BlockBytes and BlockReadDuration together 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. --- sstable/reader.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sstable/reader.go b/sstable/reader.go index d86a424f98..9766ce95ff 100644 --- a/sstable/reader.go +++ b/sstable/reader.go @@ -571,6 +571,7 @@ func (r *Reader) readBlock( int(bh.Length+blockTrailerLen), readDuration.String()) } if stats != nil { + stats.BlockBytes += bh.Length stats.BlockReadDuration += readDuration } if err != nil { @@ -628,9 +629,6 @@ func (r *Reader) readBlock( decompressed = transformed } - if stats != nil { - stats.BlockBytes += bh.Length - } if decompressed.buf.Valid() { return bufferHandle{b: decompressed.buf}, nil }