Skip to content

Commit

Permalink
Merge pull request #17291 from rahulbapumore/backport-feature
Browse files Browse the repository at this point in the history
[3.5] mvcc: Printing etcd backend database related metrics inside scheduleCompaction function
  • Loading branch information
ahrtr committed Jan 23, 2024
2 parents 0ed58e9 + 2c3b614 commit c7bcb5f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/mvcc/kvstore_compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"time"

"go.etcd.io/etcd/server/v3/mvcc/buckets"
humanize "github.com/dustin/go-humanize"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -63,11 +64,16 @@ func (s *store) scheduleCompaction(compactMainRev, prevCompactRev int64) (KeyVal
tx.UnsafePut(buckets.Meta, finishedCompactKeyName, rbytes)
tx.Unlock()
hash := h.Hash()
size, sizeInUse := s.b.Size(), s.b.SizeInUse()
s.lg.Info(
"finished scheduled compaction",
zap.Int64("compact-revision", compactMainRev),
zap.Duration("took", time.Since(totalStart)),
zap.Uint32("hash", hash.Hash),
zap.Int64("current-db-size-bytes", size),
zap.String("current-db-size", humanize.Bytes(uint64(size))),
zap.Int64("current-db-size-in-use-bytes", sizeInUse),
zap.String("current-db-size-in-use", humanize.Bytes(uint64(sizeInUse))),
)
return hash, nil
}
Expand Down

0 comments on commit c7bcb5f

Please sign in to comment.