mirror of https://github.com/tikv/client-go.git
Merge pull request #968 from bufferflies/add_log
Add log for detail rpc failed reason
This commit is contained in:
commit
78834eef77
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue