From af1d216cbe6da75be90318b486240157efdc1b4f Mon Sep 17 00:00:00 2001 From: disksing Date: Wed, 11 Dec 2019 14:29:58 +0800 Subject: [PATCH] *: fix some golint warnings (#14012) --- store/tikv/client_batch.go | 4 ++-- store/tikv/snapshot_test.go | 4 +++- store/tikv/txn.go | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/store/tikv/client_batch.go b/store/tikv/client_batch.go index 73167e710b..e54b8a76c1 100644 --- a/store/tikv/client_batch.go +++ b/store/tikv/client_batch.go @@ -440,9 +440,9 @@ func (a *batchConn) batchSendLoop(cfg config.TiKVClient) { return } else if uint(length) < bestBatchWaitSize && bestBatchWaitSize > 1 { // Waits too long to collect requests, reduce the target batch size. - bestBatchWaitSize -= 1 + bestBatchWaitSize-- } else if uint(length) > bestBatchWaitSize+4 && bestBatchWaitSize < cfg.MaxBatchSize { - bestBatchWaitSize += 1 + bestBatchWaitSize++ } entries, requests = removeCanceledRequests(entries, requests) diff --git a/store/tikv/snapshot_test.go b/store/tikv/snapshot_test.go index fa7cac8de2..91a1f9ab47 100644 --- a/store/tikv/snapshot_test.go +++ b/store/tikv/snapshot_test.go @@ -119,6 +119,8 @@ func (s *testSnapshotSuite) TestBatchGet(c *C) { } } +type contextKey string + func (s *testSnapshotSuite) TestSnapshotCache(c *C) { txn := s.beginTxn(c) c.Assert(txn.Set(kv.Key("x"), []byte("x")), IsNil) @@ -131,7 +133,7 @@ func (s *testSnapshotSuite) TestSnapshotCache(c *C) { c.Assert(err, IsNil) c.Assert(failpoint.Enable("github.com/pingcap/tidb/store/tikv/snapshot-get-cache-fail", `return(true)`), IsNil) - ctx := context.WithValue(context.Background(), "TestSnapshotCache", true) + ctx := context.WithValue(context.Background(), contextKey("TestSnapshotCache"), true) _, err = snapshot.Get(ctx, kv.Key("x")) c.Assert(err, IsNil) diff --git a/store/tikv/txn.go b/store/tikv/txn.go index 61a7874435..4a063b4bc3 100644 --- a/store/tikv/txn.go +++ b/store/tikv/txn.go @@ -301,7 +301,7 @@ func (txn *tikvTxn) Commit(ctx context.Context) error { if ctxValue != nil { commitDetail := ctxValue.(**execdetails.CommitDetails) if *commitDetail != nil { - (*commitDetail).TxnRetry += 1 + (*commitDetail).TxnRetry++ } else { *commitDetail = committer.getDetail() }