Skip to content

Commit

Permalink
store/tikv: remove use of SampleStep option in store/tikv (#24461)
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing committed May 12, 2021
1 parent 771255e commit d54e884
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions store/driver/txn/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ func (s *tikvSnapshot) SetOption(opt int, val interface{}) {
s.KVSnapshot.SetSnapshotTS(val.(uint64))
case tikvstore.ReplicaRead:
s.KVSnapshot.SetReplicaRead(val.(tikvstore.ReplicaReadType))
case tikvstore.SampleStep:
s.KVSnapshot.SetSampleStep(val.(uint32))
case tikvstore.TaskID:
s.KVSnapshot.SetTaskID(val.(uint64))
case tikvstore.IsStalenessReadOnly:
Expand Down
2 changes: 2 additions & 0 deletions store/driver/txn/txn_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ func (txn *tikvTxn) SetOption(opt int, val interface{}) {
txn.SetSchemaVer(val.(tikv.SchemaVer))
case tikvstore.SchemaAmender:
txn.SetSchemaAmender(val.(tikv.SchemaAmender))
case tikvstore.SampleStep:
txn.KVTxn.GetSnapshot().SetSampleStep(val.(uint32))
case tikvstore.CommitHook:
txn.SetCommitCallback(val.(func(string, error)))
case tikvstore.EnableAsyncCommit:
Expand Down
7 changes: 5 additions & 2 deletions store/tikv/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,6 @@ func (s *KVSnapshot) SetOption(opt int, val interface{}) {
s.mu.Lock()
s.mu.stats = val.(*SnapshotRuntimeStats)
s.mu.Unlock()
case kv.SampleStep:
s.sampleStep = val.(uint32)
}
}

Expand Down Expand Up @@ -607,6 +605,11 @@ func (s *KVSnapshot) SetIsolationLevel(level IsoLevel) {
s.isolationLevel = level
}

// SetSampleStep skips 'step - 1' number of keys after each returned key.
func (s *KVSnapshot) SetSampleStep(step uint32) {
s.sampleStep = step
}

// SetPriority sets the priority for tikv to execute commands.
func (s *KVSnapshot) SetPriority(pri Priority) {
s.priority = pri
Expand Down

0 comments on commit d54e884

Please sign in to comment.