*: fix some golint warnings (#14012)

This commit is contained in:
disksing
2019-12-11 14:29:58 +08:00
committed by pingcap-github-bot
parent 7c17add7c0
commit af1d216cbe
3 changed files with 6 additions and 4 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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()
}