Skip to content

Commit c7bcb5f

Browse files
authored
Merge pull request #17291 from rahulbapumore/backport-feature
[3.5] mvcc: Printing etcd backend database related metrics inside scheduleCompaction function
2 parents 0ed58e9 + 2c3b614 commit c7bcb5f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

server/mvcc/kvstore_compaction.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"time"
2121

2222
"go.etcd.io/etcd/server/v3/mvcc/buckets"
23+
humanize "github.com/dustin/go-humanize"
2324
"go.uber.org/zap"
2425
)
2526

@@ -63,11 +64,16 @@ func (s *store) scheduleCompaction(compactMainRev, prevCompactRev int64) (KeyVal
6364
tx.UnsafePut(buckets.Meta, finishedCompactKeyName, rbytes)
6465
tx.Unlock()
6566
hash := h.Hash()
67+
size, sizeInUse := s.b.Size(), s.b.SizeInUse()
6668
s.lg.Info(
6769
"finished scheduled compaction",
6870
zap.Int64("compact-revision", compactMainRev),
6971
zap.Duration("took", time.Since(totalStart)),
7072
zap.Uint32("hash", hash.Hash),
73+
zap.Int64("current-db-size-bytes", size),
74+
zap.String("current-db-size", humanize.Bytes(uint64(size))),
75+
zap.Int64("current-db-size-in-use-bytes", sizeInUse),
76+
zap.String("current-db-size-in-use", humanize.Bytes(uint64(sizeInUse))),
7177
)
7278
return hash, nil
7379
}

0 commit comments

Comments
 (0)