mirror of https://github.com/tikv/client-go.git
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:
parent
277844b462
commit
bc884ee6ac
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue