tikv: use resolve lock lite for snapshot.Get() (#247)

Signed-off-by: lysu <sulifx@gmail.com>
This commit is contained in:
lysu 2021-07-22 17:59:20 +08:00 committed by GitHub
parent f3e7dc3042
commit 4e1417e3fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -58,12 +58,13 @@ type ClientHelper struct {
}
// NewClientHelper creates a helper instance.
func NewClientHelper(store *KVStore, resolvedLocks *util.TSSet) *ClientHelper {
func NewClientHelper(store *KVStore, resolvedLocks *util.TSSet, resolveLite bool) *ClientHelper {
return &ClientHelper{
lockResolver: store.GetLockResolver(),
regionCache: store.GetRegionCache(),
resolvedLocks: resolvedLocks,
client: store.GetTiKVClient(),
resolveLite: resolveLite,
}
}

View File

@ -328,7 +328,7 @@ func (s *KVSnapshot) batchGetKeysByRegions(bo *Backoffer, keys [][]byte, collect
}
func (s *KVSnapshot) batchGetSingleRegion(bo *Backoffer, batch batchKeys, collectF func(k, v []byte)) error {
cli := NewClientHelper(s.store, &s.resolvedLocks)
cli := NewClientHelper(s.store, &s.resolvedLocks, false)
s.mu.RLock()
if s.mu.stats != nil {
cli.Stats = make(map[tikvrpc.CmdType]*locate.RPCRuntimeStats)
@ -497,7 +497,7 @@ func (s *KVSnapshot) get(ctx context.Context, bo *Backoffer, k []byte) ([]byte,
}
})
cli := NewClientHelper(s.store, &s.resolvedLocks)
cli := NewClientHelper(s.store, &s.resolvedLocks, true)
s.mu.RLock()
if s.mu.stats != nil {