From d54e8841a130a6c1d2b0f5ad13d13d4590f1d55b Mon Sep 17 00:00:00 2001 From: disksing Date: Thu, 13 May 2021 00:27:40 +0800 Subject: [PATCH] store/tikv: remove use of SampleStep option in store/tikv (#24461) --- store/driver/txn/snapshot.go | 2 ++ store/driver/txn/txn_driver.go | 2 ++ store/tikv/snapshot.go | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/store/driver/txn/snapshot.go b/store/driver/txn/snapshot.go index 6dc2e5c18465c..ee1d1eeee29d8 100644 --- a/store/driver/txn/snapshot.go +++ b/store/driver/txn/snapshot.go @@ -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: diff --git a/store/driver/txn/txn_driver.go b/store/driver/txn/txn_driver.go index d12a70dc2e2b5..12f2c8233ccb1 100644 --- a/store/driver/txn/txn_driver.go +++ b/store/driver/txn/txn_driver.go @@ -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: diff --git a/store/tikv/snapshot.go b/store/tikv/snapshot.go index d28ee7ed1fd6b..ae65f15dc18e6 100644 --- a/store/tikv/snapshot.go +++ b/store/tikv/snapshot.go @@ -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) } } @@ -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