mirror of https://github.com/tikv/client-go.git
refine error msg (#1338)
* refine error msg Signed-off-by: crazycs520 <crazycs520@gmail.com> * refine Signed-off-by: crazycs520 <crazycs520@gmail.com> * fix test Signed-off-by: crazycs520 <crazycs520@gmail.com> --------- Signed-off-by: crazycs520 <crazycs520@gmail.com>
This commit is contained in:
parent
c82e921992
commit
e1ca512cca
|
|
@ -924,8 +924,8 @@ func sendBatchRequest(
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
return nil, errors.WithMessage(context.DeadlineExceeded, "wait sendLoop")
|
return nil, errors.WithMessage(context.DeadlineExceeded, "wait sendLoop")
|
||||||
}
|
}
|
||||||
waitDuration := time.Since(start)
|
waitSendDuration := time.Since(start)
|
||||||
metrics.TiKVBatchWaitDuration.Observe(float64(waitDuration))
|
metrics.TiKVBatchWaitDuration.Observe(float64(waitSendDuration))
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case res, ok := <-entry.res:
|
case res, ok := <-entry.res:
|
||||||
|
|
@ -944,7 +944,8 @@ func sendBatchRequest(
|
||||||
return nil, errors.New("batchConn closed")
|
return nil, errors.New("batchConn closed")
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
atomic.StoreInt32(&entry.canceled, 1)
|
atomic.StoreInt32(&entry.canceled, 1)
|
||||||
reason := fmt.Sprintf("wait recvLoop timeout,timeout:%s, wait_duration:%s:", timeout, waitDuration)
|
reason := fmt.Sprintf("wait recvLoop timeout, timeout:%s, wait_send_duration:%s, wait_recv_duration:%s",
|
||||||
|
timeout, util.FormatDuration(waitSendDuration), util.FormatDuration(time.Since(start)-waitSendDuration))
|
||||||
return nil, errors.WithMessage(context.DeadlineExceeded, reason)
|
return nil, errors.WithMessage(context.DeadlineExceeded, reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ func TestSendWhenReconnect(t *testing.T) {
|
||||||
|
|
||||||
req := tikvrpc.NewRequest(tikvrpc.CmdEmpty, &tikvpb.BatchCommandsEmptyRequest{})
|
req := tikvrpc.NewRequest(tikvrpc.CmdEmpty, &tikvpb.BatchCommandsEmptyRequest{})
|
||||||
_, err = rpcClient.SendRequest(context.Background(), addr, req, 5*time.Second)
|
_, err = rpcClient.SendRequest(context.Background(), addr, req, 5*time.Second)
|
||||||
require.Regexp(t, "wait recvLoop timeout,timeout:5s, wait_duration:.* context deadline exceeded", err.Error())
|
require.Regexp(t, "wait recvLoop timeout, timeout:5s, wait_send_duration:.*, wait_recv_duration:.*: context deadline exceeded", err.Error())
|
||||||
server.Stop()
|
server.Stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue