mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdserver: v3compactor should use proper clock for latency (took) reporting.
The code used to: - report time since previous compaction success as a 'duration' of compaction process itself. - mix real clock with 'injected' clock. This led to strange log-lines in tests in order of 234543543h of duration.
This commit is contained in:
parent
76e769ce95
commit
2048c80760
@ -136,13 +136,14 @@ func (pc *Periodic) Run() {
|
||||
zap.Int64("revision", rev),
|
||||
zap.Duration("compact-period", pc.period),
|
||||
)
|
||||
startTime := pc.clock.Now()
|
||||
_, err := pc.c.Compact(pc.ctx, &pb.CompactionRequest{Revision: rev})
|
||||
if err == nil || err == mvcc.ErrCompacted {
|
||||
pc.lg.Info(
|
||||
"completed auto periodic compaction",
|
||||
zap.Int64("revision", rev),
|
||||
zap.Duration("compact-period", pc.period),
|
||||
zap.Duration("took", time.Since(lastSuccess)),
|
||||
zap.Duration("took", pc.clock.Now().Sub(startTime)),
|
||||
)
|
||||
lastSuccess = pc.clock.Now()
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user