Skip to content

Commit 69854cb

Browse files
committed
snaprecv: avoid double counting in msstw
We were previously adding the last open SST's DataSize into EstimatedDataSize() even if that DataSize was already reflected in `msstw.sstSize`. This led to double-counting and is now fixed.
1 parent 763afb3 commit 69854cb

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pkg/kv/kvserver/kvstorage/snaprecv/multi_sst_writer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ func (msstw *MultiSSTWriter) finalizeSST(ctx context.Context, nextKey *storage.E
321321
msstw.sstSize += int64(msstw.currSST.Meta.Size)
322322
msstw.currSpan++
323323
msstw.currSST.Close()
324+
// Zero the SSTWriter to avoid double-counting in EstimatedDataSize.
325+
msstw.currSST = storage.SSTWriter{}
324326
return nil
325327
}
326328

pkg/kv/kvserver/kvstorage/snaprecv/testdata/echotest/TestMultiSSTWriterInitSST_interesting=true

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ echo
99
>> rangekeyset ["e"-"f")
1010
>> sstSize=4140 estDataSize=4140
1111
>> finishing msstw
12-
>> sstSize=5092 estDataSize=5096
12+
>> sstSize=5092 estDataSize=5092
1313
>> sst0:
1414
rangedel: /Local/RangeID/100/r{""-/AbortSpan/"00000000-0000-0000-0000-000000000000"}
1515
rangedel: /Local/RangeID/100/r/AbortSpan/"{00000000-0000-0000-0000-000000000000"-6ba7b810-9dad-11d1-80b4-00c04fd430c8"}

0 commit comments

Comments
 (0)