Skip to content

Commit 3af978d

Browse files
committed
kvserver: rename numWriteBytes to numWriteAndIngestedBytes
This commit renames numWriteBytes in appBatchStats to numWriteAndIngestedBytes for accuracy, as it accounts for both bytes written to the replica and bytes ingested via SSTables. Epic: none Release note: none
1 parent 9483b21 commit 3af978d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

pkg/kv/kvserver/app_batch.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ type appBatchStats struct {
3333
numEntriesProcessedBytes int64
3434
numEmptyEntries int
3535
numAddSST, numAddSSTCopies int
36-
numWriteBytes int64
36+
// numWriteAndIngestedBytes is the sum of number of bytes written to the replica and size
37+
// of the sstable to ingest.
38+
numWriteAndIngestedBytes int64
3739

3840
// NB: update `merge` when adding a new field.
3941
}
@@ -43,7 +45,7 @@ func (s *appBatchStats) merge(ss appBatchStats) {
4345
s.numEntriesProcessed += ss.numEntriesProcessed
4446
s.numEntriesProcessedBytes += ss.numEntriesProcessedBytes
4547
ss.numEmptyEntries += ss.numEmptyEntries
46-
s.numWriteBytes += ss.numWriteBytes
48+
s.numWriteAndIngestedBytes += ss.numWriteAndIngestedBytes
4749
}
4850

4951
// appBatch is the in-progress foundation for standalone log entry

pkg/kv/kvserver/replica_app_batch.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ func (b *replicaAppBatch) runPostAddTriggersReplicaOnly(
256256
if !cmd.IsLocal() {
257257
writeBytes, ingestedBytes := cmd.getStoreWriteByteSizes()
258258
if writeBytes > 0 || ingestedBytes > 0 {
259-
b.ab.numWriteBytes += writeBytes + ingestedBytes
259+
b.ab.numWriteAndIngestedBytes += writeBytes + ingestedBytes
260260
}
261261
// TODO(irfansharif): This code block can be removed once below-raft
262262
// admission control is the only form of IO admission control. It pre-dates
@@ -725,7 +725,7 @@ func (b *replicaAppBatch) recordStatsOnCommit() {
725725
b.applyStats.appBatchStats.merge(b.ab.appBatchStats)
726726
b.applyStats.numBatchesProcessed++
727727
b.applyStats.followerStoreWriteBytes.Merge(b.followerStoreWriteBytes)
728-
b.r.recordRequestWriteBytes(b.ab.numWriteBytes)
728+
b.r.recordRequestWriteBytes(b.ab.numWriteAndIngestedBytes)
729729

730730
if n := b.ab.numAddSST; n > 0 {
731731
b.r.store.metrics.AddSSTableApplications.Inc(int64(n))

pkg/kv/kvserver/replica_raft.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ func (s handleRaftReadyStats) SafeFormat(p redact.SafePrinter, _ rune) {
823823
p.Printf(" (copies=%d)", c)
824824
}
825825
}
826-
if b := s.apply.numWriteBytes; b > 0 {
826+
if b := s.apply.numWriteAndIngestedBytes; b > 0 {
827827
p.Printf(", apply-write-bytes=%s", humanizeutil.IBytes(b))
828828
}
829829
p.SafeString("]")

0 commit comments

Comments
 (0)