Skip to content

Commit

Permalink
store/tikv: cleanup warnings and unused code (#22648)
Browse files Browse the repository at this point in the history
Signed-off-by: disksing <i@disksing.com>
  • Loading branch information
disksing authored Feb 2, 2021
1 parent 4e4968c commit 7fbe3e5
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 50 deletions.
3 changes: 0 additions & 3 deletions store/tikv/2pc.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ type twoPhaseCommitter struct {
txnSize int
hasNoNeedCommitKeys bool

prewriteOnlyKeys int
ignoredKeys int

primaryKey []byte
forUpdateTS uint64

Expand Down
1 change: 0 additions & 1 deletion store/tikv/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ const (
rawkvMaxBackoff = 20000
splitRegionBackoff = 20000
maxSplitRegionsBackoff = 120000
scatterRegionBackoff = 20000
waitScatterRegionFinishBackoff = 120000
locateRegionMaxBackoff = 20000
pessimisticLockMaxBackoff = 20000
Expand Down
2 changes: 0 additions & 2 deletions store/tikv/batch_coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ type batchCopIterator struct {

memTracker *memory.Tracker

replicaReadSeed uint32

rpcCancel *RPCCanceller

wg sync.WaitGroup
Expand Down
6 changes: 1 addition & 5 deletions store/tikv/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,7 @@ type copResponse struct {
respTime time.Duration
}

const (
sizeofExecDetails = int(unsafe.Sizeof(execdetails.ExecDetails{}))
sizeofCommitDetails = int(unsafe.Sizeof(execdetails.CommitDetails{}))
)
const sizeofExecDetails = int(unsafe.Sizeof(execdetails.ExecDetails{}))

// GetData implements the kv.ResultSubset GetData interface.
func (rs *copResponse) GetData() []byte {
Expand Down Expand Up @@ -815,7 +812,6 @@ func (ch *clientHelper) SendReqCtx(bo *Backoffer, req *tikvrpc.Request, regionID
const (
minLogBackoffTime = 100
minLogKVProcessTime = 100
minLogKVWaitTime = 200
)

func (worker *copIteratorWorker) logTimeCopTask(costTime time.Duration, task *copTask, bo *Backoffer, resp *tikvrpc.Response) {
Expand Down
14 changes: 0 additions & 14 deletions store/tikv/coprocessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,20 +263,6 @@ func (s *testCoprocessorSuite) rangeEqual(c *C, ranges []kv.KeyRange, keys ...st
}
}

func (s *testCoprocessorSuite) checkEqual(c *C, copRanges *KeyRanges, ranges []kv.KeyRange, slice bool) {
c.Assert(copRanges.Len(), Equals, len(ranges))
for i := range ranges {
c.Assert(copRanges.At(i), DeepEquals, ranges[i])
}
if slice {
for i := 0; i <= copRanges.Len(); i++ {
for j := i; j <= copRanges.Len(); j++ {
s.checkEqual(c, copRanges.Slice(i, j), ranges[i:j], false)
}
}
}
}

func (s *testCoprocessorSuite) TestRateLimit(c *C) {
done := make(chan struct{}, 1)
rl := newRateLimit(1)
Expand Down
4 changes: 1 addition & 3 deletions store/tikv/gcworker/gc_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1201,9 +1201,7 @@ func (s *testGCWorkerSuite) TestMergeLockScanner(c *C) {

makeLockList := func(locks ...*tikv.Lock) []*tikv.Lock {
res := make([]*tikv.Lock, 0, len(locks))
for _, lock := range locks {
res = append(res, lock)
}
res = append(res, locks...)
return res
}

Expand Down
6 changes: 1 addition & 5 deletions store/tikv/region_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,7 @@ func (r *RegionStore) kvPeer(seed uint32, op *storeSelectorOp) AccessIndex {
func (r *RegionStore) filterStoreCandidate(aidx AccessIndex, op *storeSelectorOp) bool {
_, s := r.accessStore(TiKvOnly, aidx)
// filter label unmatched store
if !s.IsLabelsMatch(op.labels) {
return false
}
return true
return s.IsLabelsMatch(op.labels)
}

// init initializes region after constructed.
Expand Down Expand Up @@ -1670,7 +1667,6 @@ const (
unknown livenessState = iota
reachable
unreachable
offline
)

func (s *Store) requestLiveness(bo *Backoffer) (l livenessState) {
Expand Down
17 changes: 0 additions & 17 deletions store/tikv/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,7 @@ type tikvTxn struct {
committer *twoPhaseCommitter
lockedCnt int

// For data consistency check.
// assertions[:confirmed] is the assertion of current transaction.
// assertions[confirmed:len(assertions)] is the assertions of current statement.
// StmtCommit/StmtRollback may change the confirmed position.
assertions []assertionPair
confirmed int

valid bool
dirty bool

// txnInfoSchema is the infoSchema fetched at startTS.
txnInfoSchema SchemaVer
Expand Down Expand Up @@ -123,15 +115,6 @@ func newTiKVTxnWithExactStaleness(store *KVStore, txnScope string, prevSec uint6
return newTiKVTxnWithStartTS(store, txnScope, startTS, store.nextReplicaReadSeed())
}

type assertionPair struct {
key kv.Key
assertion kv.AssertionType
}

func (a assertionPair) String() string {
return fmt.Sprintf("key: %s, assertion type: %d", a.key, a.assertion)
}

// SetSuccess is used to probe if kv variables are set or not. It is ONLY used in test cases.
var SetSuccess = false

Expand Down

0 comments on commit 7fbe3e5

Please sign in to comment.