From ec3558b7bfbd45f9312fa2c23754a05f9b327af8 Mon Sep 17 00:00:00 2001 From: disksing Date: Thu, 29 Apr 2021 14:35:57 +0800 Subject: [PATCH] store/tikv: remove use of NotFillCache transaction option in store/tikv (#24361) --- store/driver/txn/snapshot.go | 2 ++ store/driver/txn/txn_driver.go | 6 ++++-- store/tikv/snapshot.go | 8 ++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/store/driver/txn/snapshot.go b/store/driver/txn/snapshot.go index 28ecbd567e..34ad18b11b 100644 --- a/store/driver/txn/snapshot.go +++ b/store/driver/txn/snapshot.go @@ -69,6 +69,8 @@ func (s *tikvSnapshot) SetOption(opt int, val interface{}) { s.KVSnapshot.SetIsolationLevel(level) case tikvstore.Priority: s.KVSnapshot.SetPriority(getTiKVPriority(val.(int))) + case tikvstore.NotFillCache: + s.KVSnapshot.SetNotFillCache(val.(bool)) default: s.KVSnapshot.SetOption(opt, val) } diff --git a/store/driver/txn/txn_driver.go b/store/driver/txn/txn_driver.go index 9984473d92..4ab9b0f437 100644 --- a/store/driver/txn/txn_driver.go +++ b/store/driver/txn/txn_driver.go @@ -134,10 +134,12 @@ func (txn *tikvTxn) SetOption(opt int, val interface{}) { case tikvstore.IsolationLevel: level := getTiKVIsolationLevel(val.(kv.IsoLevel)) txn.KVTxn.GetSnapshot().SetIsolationLevel(level) - case tikvstore.SyncLog: - txn.EnableForceSyncLog() case tikvstore.Priority: txn.KVTxn.SetPriority(getTiKVPriority(val.(int))) + case tikvstore.NotFillCache: + txn.KVTxn.GetSnapshot().SetNotFillCache(val.(bool)) + case tikvstore.SyncLog: + txn.EnableForceSyncLog() case tikvstore.Pessimistic: txn.SetPessimistic(val.(bool)) default: diff --git a/store/tikv/snapshot.go b/store/tikv/snapshot.go index 21063ec122..750b20b904 100644 --- a/store/tikv/snapshot.go +++ b/store/tikv/snapshot.go @@ -565,8 +565,6 @@ func (s *KVSnapshot) IterReverse(k []byte) (unionstore.Iterator, error) { // value of this option. Only ReplicaRead is supported for snapshot func (s *KVSnapshot) SetOption(opt int, val interface{}) { switch opt { - case kv.NotFillCache: - s.notFillCache = val.(bool) case kv.SnapshotTS: s.setSnapshotTS(val.(uint64)) case kv.ReplicaRead: @@ -610,6 +608,12 @@ func (s *KVSnapshot) DelOption(opt int) { } } +// SetNotFillCache indicates whether tikv should skip filling cache when +// loading data. +func (s *KVSnapshot) SetNotFillCache(b bool) { + s.notFillCache = b +} + // SetKeyOnly indicates if tikv can return only keys. func (s *KVSnapshot) SetKeyOnly(b bool) { s.keyOnly = b