diff --git a/internal/client/client_batch.go b/internal/client/client_batch.go index 632d6f30..b7159847 100644 --- a/internal/client/client_batch.go +++ b/internal/client/client_batch.go @@ -37,6 +37,7 @@ package client import ( "context" + "fmt" "math" "runtime/trace" "sync" @@ -793,7 +794,8 @@ func sendBatchRequest( case <-timer.C: return nil, errors.WithMessage(context.DeadlineExceeded, "wait sendLoop") } - metrics.TiKVBatchWaitDuration.Observe(float64(time.Since(start))) + waitDuration := time.Since(start) + metrics.TiKVBatchWaitDuration.Observe(float64(waitDuration)) select { case res, ok := <-entry.res: @@ -808,7 +810,8 @@ func sendBatchRequest( return nil, errors.WithStack(ctx.Err()) case <-timer.C: atomic.StoreInt32(&entry.canceled, 1) - return nil, errors.WithMessage(context.DeadlineExceeded, "wait recvLoop") + reason := fmt.Sprintf("wait recvLoop timeout,timeout:%s, wait_duration:%s:", timeout, waitDuration) + return nil, errors.WithMessage(context.DeadlineExceeded, reason) } } diff --git a/internal/locate/region_request.go b/internal/locate/region_request.go index 449db7be..33d56cba 100644 --- a/internal/locate/region_request.go +++ b/internal/locate/region_request.go @@ -113,7 +113,7 @@ type RegionRequestSender struct { } func (s *RegionRequestSender) String() string { - return fmt.Sprintf("{replicaSelector: %v}", s.replicaSelector.String()) + return fmt.Sprintf("{rpcError:%v,replicaSelector: %v}", s.rpcError, s.replicaSelector.String()) } // RegionRequestRuntimeStats records the runtime stats of send region requests.