@@ -11,7 +11,6 @@ import (
1111 "time"
1212 "unsafe"
1313
14- "github.com/cockroachdb/cockroach/pkg/base"
1514 "github.com/cockroachdb/cockroach/pkg/kv/kvpb"
1615 "github.com/cockroachdb/cockroach/pkg/kv/kvserver/concurrency/poison"
1716 "github.com/cockroachdb/cockroach/pkg/kv/kvserver/spanset"
@@ -579,7 +578,9 @@ func (m *Manager) waitForSignal(
579578 }()
580579 log .Eventf (ctx , "waiting to acquire %s latch %s, held by %s latch %s" , waitType , wait , heldType , held )
581580 poisonCh := held .g .poison .signalChan ()
582- t .Reset (base .SlowRequestThreshold )
581+
582+ slowThreshold := m .slowLatchRequestThreshold ()
583+ t .Reset (slowThreshold )
583584 for {
584585 select {
585586 case <- held .g .done .signalChan ():
@@ -604,7 +605,7 @@ func (m *Manager) waitForSignal(
604605 t .Read = true
605606
606607 log .Warningf (ctx , "have been waiting %s to acquire %s latch %s, held by %s latch %s" ,
607- base . SlowRequestThreshold , waitType , wait , heldType , held )
608+ slowThreshold , waitType , wait , heldType , held )
608609 if m .slowReqs != nil {
609610 m .slowReqs .Inc (1 )
610611 defer m .slowReqs .Dec (1 )
@@ -682,6 +683,14 @@ func (m *Manager) longLatchHoldThreshold() time.Duration {
682683 return LongLatchHoldThreshold .Get (& m .settings .SV )
683684}
684685
686+ // slowLatchRequestThreshold returns the threshold for logging slow latch requests.
687+ func (m * Manager ) slowLatchRequestThreshold () time.Duration {
688+ if m .settings == nil {
689+ return math .MaxInt64 // disable
690+ }
691+ return SlowLatchRequestThreshold .Get (& m .settings .SV )
692+ }
693+
685694// Metrics holds information about the state of a Manager.
686695type Metrics struct {
687696 ReadCount int64
0 commit comments