Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
3pointer committed Aug 28, 2023
1 parent 1cd747c commit 091467b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tikv/gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ type RegionLockResolver interface {
//
// regionLocation should return if resolve locks succeed. if regionLocation return nil,
// which means not all locks are resolved in someway. the caller should retry scan locks.
// ** the locks are assumed sorted by key in ascending order **
ResolveLocksInOneRegion(bo *Backoffer, locks []*txnlock.Lock, regionLocation *locate.KeyLocation) (*locate.KeyLocation, error)

// ScanLocksInOneRegion return locks and location with given start key in a region.
Expand All @@ -164,14 +165,14 @@ func ResolveLocksForRange(
// cleaned.
var stat rangetask.TaskStat
key := startKey
// create new backoffer for every scan and resolve locks
bo := createBackoffFn(ctx)
for {
select {
case <-ctx.Done():
return stat, errors.New("[gc worker] gc job canceled")
default:
}
// create new backoffer for every scan and resolve locks
bo := createBackoffFn(ctx)
locks, loc, err := resolver.ScanLocksInOneRegion(bo, key, maxVersion, scanLimit)
if err != nil {
return stat, err
Expand Down Expand Up @@ -204,6 +205,7 @@ func ResolveLocksForRange(
if len(key) == 0 || (len(endKey) != 0 && bytes.Compare(key, endKey) >= 0) {
break
}
bo = createBackoffFn(ctx)
}
return stat, nil
}
Expand Down

0 comments on commit 091467b

Please sign in to comment.