mirror of https://github.com/tikv/client-go.git
do not format error when response does not include ExecDetailsV2 (#553)
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
This commit is contained in:
parent
aa9ded37d1
commit
e38d2b07de
|
@ -437,8 +437,8 @@ func (c *RPCClient) updateTiKVSendReqHistogram(req *tikvrpc.Request, resp *tikvr
|
|||
counter.(sendReqCounterCacheValue).counter.Inc()
|
||||
counter.(sendReqCounterCacheValue).timeCounter.Add(secs)
|
||||
|
||||
if execDetail, err := resp.GetExecDetailsV2(); err == nil &&
|
||||
execDetail != nil && execDetail.TimeDetail != nil && execDetail.TimeDetail.TotalRpcWallTimeNs > 0 {
|
||||
if execDetail := resp.GetExecDetailsV2(); execDetail != nil &&
|
||||
execDetail.TimeDetail != nil && execDetail.TimeDetail.TotalRpcWallTimeNs > 0 {
|
||||
latHist, ok := rpcNetLatencyHistCache.Load(storeID)
|
||||
if !ok {
|
||||
if len(storeIDStr) == 0 {
|
||||
|
|
|
@ -931,18 +931,15 @@ type getExecDetailsV2 interface {
|
|||
}
|
||||
|
||||
// GetExecDetailsV2 returns the ExecDetailsV2 of the underlying concrete response.
|
||||
func (resp *Response) GetExecDetailsV2() (*kvrpcpb.ExecDetailsV2, error) {
|
||||
func (resp *Response) GetExecDetailsV2() *kvrpcpb.ExecDetailsV2 {
|
||||
if resp == nil || resp.Resp == nil {
|
||||
return nil, nil
|
||||
return nil
|
||||
}
|
||||
details, ok := resp.Resp.(getExecDetailsV2)
|
||||
if !ok {
|
||||
if _, isEmpty := resp.Resp.(*tikvpb.BatchCommandsEmptyResponse); isEmpty {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, errors.Errorf("invalid response type %v", resp)
|
||||
return nil
|
||||
}
|
||||
return details.GetExecDetailsV2(), nil
|
||||
return details.GetExecDetailsV2()
|
||||
}
|
||||
|
||||
// CallRPC launches a rpc call.
|
||||
|
|
Loading…
Reference in New Issue