integration_tests: remove use of errors.Trace (#327)

Signed-off-by: disksing <i@disksing.com>
This commit is contained in:
disksing 2021-10-13 14:58:44 +08:00 committed by GitHub
parent 3e9bd8b941
commit 61664cf55c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 13 deletions

View File

@ -211,7 +211,7 @@ func (s *testSnapshotSuite) TestSkipLargeTxnLock() {
txn1 := s.beginTxn()
// txn1 is not blocked by txn in the large txn protocol.
_, err = txn1.Get(ctx, x)
s.True(error.IsErrNotFound(errors.Trace(err)))
s.True(error.IsErrNotFound(err))
res, err := toTiDBTxn(&txn1).BatchGet(ctx, toTiDBKeys([][]byte{x, y, []byte("z")}))
s.Nil(err)
@ -243,7 +243,7 @@ func (s *testSnapshotSuite) TestPointGetSkipTxnLock() {
s.Equal(committer.GetPrimaryKey(), x)
// Point get secondary key. Shouldn't be blocked by the lock and read old data.
_, err = snapshot.Get(ctx, y)
s.True(error.IsErrNotFound(errors.Trace(err)))
s.True(error.IsErrNotFound(err))
s.Less(time.Since(start), 500*time.Millisecond)
// Commit the primary key

View File

@ -160,7 +160,7 @@ func (c *mockPDClient) GetTS(ctx context.Context) (int64, int64, error) {
defer c.RUnlock()
if c.stop {
return 0, 0, errors.Trace(errStopped)
return 0, 0, errors.WithStack(errStopped)
}
return c.client.GetTS(ctx)
}
@ -182,7 +182,7 @@ func (c *mockPDClient) GetRegion(ctx context.Context, key []byte) (*pd.Region, e
defer c.RUnlock()
if c.stop {
return nil, errors.Trace(errStopped)
return nil, errors.WithStack(errStopped)
}
return c.client.GetRegion(ctx, key)
}
@ -196,7 +196,7 @@ func (c *mockPDClient) GetPrevRegion(ctx context.Context, key []byte) (*pd.Regio
defer c.RUnlock()
if c.stop {
return nil, errors.Trace(errStopped)
return nil, errors.WithStack(errStopped)
}
return c.client.GetPrevRegion(ctx, key)
}
@ -206,7 +206,7 @@ func (c *mockPDClient) GetRegionByID(ctx context.Context, regionID uint64) (*pd.
defer c.RUnlock()
if c.stop {
return nil, errors.Trace(errStopped)
return nil, errors.WithStack(errStopped)
}
return c.client.GetRegionByID(ctx, regionID)
}
@ -216,7 +216,7 @@ func (c *mockPDClient) ScanRegions(ctx context.Context, startKey []byte, endKey
defer c.RUnlock()
if c.stop {
return nil, errors.Trace(errStopped)
return nil, errors.WithStack(errStopped)
}
return c.client.ScanRegions(ctx, startKey, endKey, limit)
}
@ -226,7 +226,7 @@ func (c *mockPDClient) GetStore(ctx context.Context, storeID uint64) (*metapb.St
defer c.RUnlock()
if c.stop {
return nil, errors.Trace(errStopped)
return nil, errors.WithStack(errStopped)
}
return c.client.GetStore(ctx, storeID)
}
@ -236,7 +236,7 @@ func (c *mockPDClient) GetAllStores(ctx context.Context, opts ...pd.GetStoreOpti
defer c.Unlock()
if c.stop {
return nil, errors.Trace(errStopped)
return nil, errors.WithStack(errStopped)
}
return c.client.GetAllStores(ctx)
}

View File

@ -42,7 +42,6 @@ import (
"testing"
"unsafe"
"github.com/pingcap/errors"
"github.com/pingcap/tidb/kv"
txndriver "github.com/pingcap/tidb/store/driver/txn"
"github.com/pingcap/tidb/store/mockstore/unistore"
@ -91,16 +90,16 @@ func NewTestStore(t *testing.T) *tikv.KVStore {
func clearStorage(store *tikv.KVStore) error {
txn, err := store.Begin()
if err != nil {
return errors.Trace(err)
return err
}
iter, err := txn.Iter(nil, nil)
if err != nil {
return errors.Trace(err)
return err
}
for iter.Valid() {
txn.Delete(iter.Key())
if err := iter.Next(); err != nil {
return errors.Trace(err)
return err
}
}
return txn.Commit(context.Background())