Fix range in clearExtraData (#278)

* Fix range in clearExtraData
This commit is contained in:
Whorra 2022-07-06 13:09:40 +08:00 committed by GitHub
parent d975005666
commit 28f12587cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -261,7 +261,7 @@ func (ps *PeerStorage) clearExtraData(newRegion *metapb.Region) {
if bytes.Compare(oldStartKey, newStartKey) < 0 {
ps.clearRange(newRegion.Id, oldStartKey, newStartKey)
}
if bytes.Compare(newEndKey, oldEndKey) < 0 {
if bytes.Compare(newEndKey, oldEndKey) < 0 || (len(oldEndKey) == 0 && len(newEndKey) != 0) {
ps.clearRange(newRegion.Id, newEndKey, oldEndKey)
}
}