Skip to content

Commit

Permalink
store/tikv: remove use of NotFillCache transaction option in store/ti…
Browse files Browse the repository at this point in the history
…kv (#24361)
  • Loading branch information
disksing authored Apr 29, 2021
1 parent 64938b8 commit ec3558b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions store/driver/txn/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 4 additions & 2 deletions store/driver/txn/txn_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 6 additions & 2 deletions store/tikv/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ec3558b

Please sign in to comment.