Skip to content

Commit

Permalink
make it easier to be understand
Browse files Browse the repository at this point in the history
Signed-off-by: hillium <[email protected]>
  • Loading branch information
YuJuncen committed Nov 8, 2023
1 parent acd16c2 commit e25f2fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/locate/region_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -2468,8 +2468,9 @@ func (r *Region) Contains(key []byte) bool {
// for the maximum region endKey is empty.
// startKey < key <= endKey.
func (r *Region) ContainsByEnd(key []byte) bool {
return (bytes.Compare(r.meta.GetStartKey(), key) < 0 || len(key) == 0) &&
((bytes.Compare(key, r.meta.GetEndKey()) <= 0 && len(key) > 0) || len(r.meta.GetEndKey()) == 0)
return len(key) == 0 && len(r.EndKey()) == 0 ||
(bytes.Compare(r.meta.GetStartKey(), key) < 0 &&
(bytes.Compare(key, r.meta.GetEndKey()) <= 0 || len(r.meta.GetEndKey()) == 0))
}

// Store contains a kv process's address.
Expand Down

0 comments on commit e25f2fa

Please sign in to comment.