Fix txn_scope miss setting for snapshot Get (#89)

* fix

Signed-off-by: yisaer <disxiaofei@163.com>

* remove useless assert

Signed-off-by: yisaer <disxiaofei@163.com>
This commit is contained in:
Song Gao 2021-06-17 16:29:08 +08:00 committed by GitHub
parent 277844b462
commit bc884ee6ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 17 deletions

View File

@ -516,16 +516,6 @@ func (c *RegionCache) GetTiKVRPCContext(bo *retry.Backoffer, id RegionVerID, rep
for _, op := range opts {
op(options)
}
if val, err := util.EvalFailpoint("assertStoreLabels"); err == nil {
if len(opts) > 0 {
kv := strings.Split(val.(string), "_")
for _, label := range options.labels {
if label.Key == kv[0] && label.Value != kv[1] {
panic(fmt.Sprintf("StoreSelectorOption's label %v is not %v", kv[0], kv[1]))
}
}
}
}
isLeaderReq := false
switch replicaRead {
case kv.ReplicaReadFollower:

View File

@ -80,13 +80,6 @@ func (ch *ClientHelper) SendReqCtx(bo *Backoffer, req *tikvrpc.Request, regionID
}
sender.Stats = ch.Stats
req.Context.ResolvedLocks = ch.resolvedLocks.GetAll()
if val, err := util.EvalFailpoint("assertStaleReadFlag"); err == nil {
if val.(bool) {
if len(opts) > 0 && !req.StaleRead {
panic("req.StaleRead shouldn't be false when opts is not empty")
}
}
}
resp, ctx, err := sender.SendReqCtx(bo, req, regionID, timeout, et, opts...)
return resp, ctx, sender.GetStoreAddr(), err
}

View File

@ -500,7 +500,9 @@ func (s *KVSnapshot) get(ctx context.Context, bo *Backoffer, k []byte) ([]byte,
})
isStaleness := s.mu.isStaleness
matchStoreLabels := s.mu.matchStoreLabels
txnScope := s.mu.txnScope
s.mu.RUnlock()
req.TxnScope = txnScope
var ops []locate.StoreSelectorOption
if isStaleness {
req.EnableStaleRead()