mirror of https://github.com/tikv/client-go.git
*: remove use of errors.Trace (#353)
Signed-off-by: disksing <i@disksing.com>
This commit is contained in:
parent
796f5433f5
commit
c425022782
|
|
@ -184,7 +184,7 @@ func ParsePath(path string) (etcdAddrs []string, disableGC bool, err error) {
|
|||
var u *url.URL
|
||||
u, err = url.Parse(path)
|
||||
if err != nil {
|
||||
err = errors.Trace(err)
|
||||
err = errors.WithStack(err)
|
||||
return
|
||||
}
|
||||
if strings.ToLower(u.Scheme) != "tikv" {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func (o *MockOracle) GetTimestamp(ctx context.Context, _ *oracle.Option) (uint64
|
|||
defer o.Unlock()
|
||||
|
||||
if o.stop {
|
||||
return 0, errors.Trace(errStopped)
|
||||
return 0, errors.WithStack(errStopped)
|
||||
}
|
||||
ts := oracle.GoTimeToTS(time.Now().Add(o.offset))
|
||||
if oracle.ExtractPhysical(o.lastTS) == oracle.ExtractPhysical(ts) {
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ func (f *tsFuture) Wait() (uint64, error) {
|
|||
physical, logical, err := f.TSFuture.Wait()
|
||||
metrics.TiKVTSFutureWaitDuration.Observe(time.Since(now).Seconds())
|
||||
if err != nil {
|
||||
return 0, errors.Trace(err)
|
||||
return 0, errors.WithStack(err)
|
||||
}
|
||||
ts := oracle.ComposeTS(physical, logical)
|
||||
f.o.setLastTS(ts, f.txnScope)
|
||||
|
|
@ -320,10 +320,10 @@ func (o *pdOracle) GetStaleTimestamp(ctx context.Context, txnScope string, prevS
|
|||
// If any error happened, we will try to fetch tso and set it as last ts.
|
||||
_, tErr := o.GetTimestamp(ctx, &oracle.Option{TxnScope: txnScope})
|
||||
if tErr != nil {
|
||||
return 0, errors.Trace(tErr)
|
||||
return 0, tErr
|
||||
}
|
||||
}
|
||||
return 0, errors.Trace(err)
|
||||
return 0, err
|
||||
}
|
||||
return ts, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1048,7 +1048,7 @@ func (resp *CopStreamResponse) Recv() (*coprocessor.Response, error) {
|
|||
ret, err := resp.Tikv_CoprocessorStreamClient.Recv()
|
||||
|
||||
atomic.StoreInt64(&resp.Lease.deadline, 0) // Stop the lease check.
|
||||
return ret, errors.Trace(err)
|
||||
return ret, errors.WithStack(err)
|
||||
}
|
||||
|
||||
// Close closes the CopStreamResponse object.
|
||||
|
|
@ -1069,7 +1069,7 @@ func (resp *BatchCopStreamResponse) Recv() (*coprocessor.BatchResponse, error) {
|
|||
ret, err := resp.Tikv_BatchCoprocessorClient.Recv()
|
||||
|
||||
atomic.StoreInt64(&resp.Lease.deadline, 0) // Stop the lease check.
|
||||
return ret, errors.Trace(err)
|
||||
return ret, errors.WithStack(err)
|
||||
}
|
||||
|
||||
// Close closes the BatchCopStreamResponse object.
|
||||
|
|
@ -1090,7 +1090,7 @@ func (resp *MPPStreamResponse) Recv() (*mpp.MPPDataPacket, error) {
|
|||
ret, err := resp.Tikv_EstablishMPPConnectionClient.Recv()
|
||||
|
||||
atomic.StoreInt64(&resp.Lease.deadline, 0) // Stop the lease check.
|
||||
return ret, errors.Trace(err)
|
||||
return ret, errors.WithStack(err)
|
||||
}
|
||||
|
||||
// Close closes the MPPStreamResponse object.
|
||||
|
|
|
|||
|
|
@ -256,14 +256,14 @@ func DecodeComparableUvarint(b []byte) ([]byte, uint64, error) {
|
|||
first := b[0]
|
||||
b = b[1:]
|
||||
if first < negativeTagEnd {
|
||||
return nil, 0, errors.Trace(errDecodeInvalid)
|
||||
return nil, 0, errors.WithStack(errDecodeInvalid)
|
||||
}
|
||||
if first <= positiveTagStart {
|
||||
return b, uint64(first) - negativeTagEnd, nil
|
||||
}
|
||||
length := int(first) - positiveTagStart
|
||||
if len(b) < length {
|
||||
return nil, 0, errors.Trace(errDecodeInsufficient)
|
||||
return nil, 0, errors.WithStack(errDecodeInsufficient)
|
||||
}
|
||||
var v uint64
|
||||
for _, c := range b[:length] {
|
||||
|
|
@ -275,7 +275,7 @@ func DecodeComparableUvarint(b []byte) ([]byte, uint64, error) {
|
|||
// DecodeComparableVarint decodes mem-comparable varint.
|
||||
func DecodeComparableVarint(b []byte) ([]byte, int64, error) {
|
||||
if len(b) == 0 {
|
||||
return nil, 0, errors.Trace(errDecodeInsufficient)
|
||||
return nil, 0, errors.WithStack(errDecodeInsufficient)
|
||||
}
|
||||
first := b[0]
|
||||
if first >= negativeTagEnd && first <= positiveTagStart {
|
||||
|
|
@ -291,15 +291,15 @@ func DecodeComparableVarint(b []byte) ([]byte, int64, error) {
|
|||
length = int(first) - positiveTagStart
|
||||
}
|
||||
if len(b) < length {
|
||||
return nil, 0, errors.Trace(errDecodeInsufficient)
|
||||
return nil, 0, errors.WithStack(errDecodeInsufficient)
|
||||
}
|
||||
for _, c := range b[:length] {
|
||||
v = (v << 8) | uint64(c)
|
||||
}
|
||||
if first > positiveTagStart && v > math.MaxInt64 {
|
||||
return nil, 0, errors.Trace(errDecodeInvalid)
|
||||
return nil, 0, errors.WithStack(errDecodeInvalid)
|
||||
} else if first < negativeTagEnd && v <= math.MaxInt64 {
|
||||
return nil, 0, errors.Trace(errDecodeInvalid)
|
||||
return nil, 0, errors.WithStack(errDecodeInvalid)
|
||||
}
|
||||
return b[length:], int64(v), nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue