storage: Eliminate use of hlc.Clock in replicaStats#30651
storage: Eliminate use of hlc.Clock in replicaStats#30651a-robinson wants to merge 1 commit intocockroachdb:masterfrom
Conversation
nvb
left a comment
There was a problem hiding this comment.
Reviewed 6 of 6 files at r1.
Reviewable status:complete! 0 of 0 LGTMs obtained
pkg/storage/store_pool_test.go, line 475 at r1 (raw file):
} replica.mu.Unlock() rs := newReplicaStats(func() time.Time { return clock.PhysicalTime() }, nil)
Can these closures be replaced by method references?
pkg/storage/store_pool_test.go, line 586 at r1 (raw file):
} replica.leaseholderStats = newReplicaStats( func() time.Time { return store.Clock().PhysicalTime() }, nil)
Same question.
Touches cockroachdb#30520. This was almost certainly the worst offender because it was getting the hlc physical time in recordCount, which is called once (or twice for writes) on every replica.Send call. Release note: None
d9641bf to
a018870
Compare
a-robinson
left a comment
There was a problem hiding this comment.
Reviewable status:
complete! 0 of 0 LGTMs obtained
pkg/storage/store_pool_test.go, line 475 at r1 (raw file):
Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Can these closures be replaced by method references?
Of course, done. Although for this one I can actually replace the hlc entirely since it isn't being used by anything else.
pkg/storage/store_pool_test.go, line 586 at r1 (raw file):
Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Same question.
Done.
nvb
left a comment
There was a problem hiding this comment.
thanks for fixing this so quickly!
Reviewable status:
complete! 1 of 0 LGTMs obtained
pkg/storage/store_rebalancer_test.go, line 102 at r2 (raw file):
// rangeInfo code is ripped out of the allocator. repl.mu.state.Stats = &enginepb.MVCCStats{} repl.leaseholderStats = newReplicaStats(func() time.Time { return s.Clock().PhysicalTime() }, nil)
nit: two more cases for method references.
Touches #30520. This was almost certainly the worst offender because it
was getting the hlc physical time in recordCount, which is called once
(or twice for writes) on every replica.Send call.
Release note: None