Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: nolouch <nolouch@gmail.com>
  • Loading branch information
nolouch committed Sep 13, 2024
1 parent 175893e commit 80dae73
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/locate/region_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,19 @@ func (s *testRegionRequestToSingleStoreSuite) TestOnSendFailByResourceGroupThrot
defer func() {
s.regionRequestSender.client = oc
}()
storeOld, _ := s.regionRequestSender.regionCache.stores.get(1)
s.regionRequestSender.regionCache.storeMu.Lock()
storeOld := s.regionRequestSender.regionCache.storeMu.stores[1]
s.regionRequestSender.regionCache.storeMu.Unlock()
epoch := storeOld.epoch
s.regionRequestSender.client = &fnClient{fn: func(ctx context.Context, addr string, req *tikvrpc.Request, timeout time.Duration) (response *tikvrpc.Response, err error) {
return nil, pderr.ErrClientResourceGroupThrottled
}}
bo := retry.NewBackofferWithVars(context.Background(), 5, nil)
_, _, err := s.regionRequestSender.SendReq(bo, req, region.Region, time.Second)
s.NotNil(err)
storeNew, _ := s.regionRequestSender.regionCache.stores.get(1)
s.regionRequestSender.regionCache.storeMu.Lock()
storeNew := s.regionRequestSender.regionCache.storeMu.stores[1]
s.regionRequestSender.regionCache.storeMu.Unlock()
// not mark the store need be refill, then the epoch should not be changed.
s.Equal(epoch, storeNew.epoch)
// no rpc error if the error is ErrClientResourceGroupThrottled
Expand Down

0 comments on commit 80dae73

Please sign in to comment.