Skip to content

Commit

Permalink
fix unstable test
Browse files Browse the repository at this point in the history
  • Loading branch information
3pointer committed Sep 8, 2023
1 parent ba6c52a commit 78ace34
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions store/gcworker/gc_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1167,14 +1167,22 @@ func TestResolveLockRangeMeetRegionEnlargeCausedByRegionMerge(t *testing.T) {
if region.GetId() == s.initRegion.regionID {
return []*txnlock.Lock{{Key: []byte("a")}, {Key: []byte("b")}},
&tikv.KeyLocation{
Region: tikv.NewRegionVerID(s.initRegion.regionID, 0, 0),
Region: tikv.NewRegionVerID(
region.GetId(),
region.GetRegionEpoch().ConfVer,
region.GetRegionEpoch().Version,
),
}
}
// second time scan locks
if region.GetId() == region2 {
return []*txnlock.Lock{{Key: []byte("o")}, {Key: []byte("p")}},
&tikv.KeyLocation{
Region: tikv.NewRegionVerID(region2, 0, 0),
Region: tikv.NewRegionVerID(
region.GetId(),
region.GetRegionEpoch().ConfVer,
region.GetRegionEpoch().Version,
),
}
}
return []*txnlock.Lock{}, nil
Expand Down Expand Up @@ -1206,7 +1214,10 @@ func TestResolveLockRangeMeetRegionEnlargeCausedByRegionMerge(t *testing.T) {
}
for i, lock := range locks {
if bytes.Compare(key, lock.Key) <= 0 {
return locks[i:], &tikv.KeyLocation{Region: tikv.NewRegionVerID(s.initRegion.regionID, 0, 0)}
return locks[i:], &tikv.KeyLocation{Region: tikv.NewRegionVerID(
regionMeta.GetId(),
regionMeta.GetRegionEpoch().ConfVer,
regionMeta.GetRegionEpoch().Version)}
}
}
}
Expand All @@ -1219,7 +1230,7 @@ func TestResolveLockRangeMeetRegionEnlargeCausedByRegionMerge(t *testing.T) {
}
return loc, nil
}
_, err := tikv.ResolveLocksForRange(gcContext(), mockGCLockResolver, 1, []byte(""), []byte("z"), tikv.NewNoopBackoff, 10)
_, err := tikv.ResolveLocksForRange(gcContext(), mockGCLockResolver, 1, []byte(""), []byte("z"), tikv.NewGcResolveLockMaxBackoffer, 10)
require.NoError(t, err)
require.Len(t, resolvedLock, 4)
expects := [][]byte{[]byte("a"), []byte("b"), []byte("o"), []byte("p")}
Expand Down

0 comments on commit 78ace34

Please sign in to comment.