Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadRegion from persistent storage should remove overlap region after compare version #2011

Closed
disksing opened this issue Dec 12, 2019 · 1 comment · Fixed by #2022
Closed
Labels
type/bug The issue is confirmed as a bug.

Comments

@disksing
Copy link
Contributor

disksing commented Dec 12, 2019

Currently, when PD loads regions from persistent storage, it inserts regions to the region tree one by one. When there are regions have overlapped range, the region that loaded earlier will be removed from the tree. See https://github.com/pingcap/pd/blob/035f65eebbd028449d9ebb06cb166ab3c266136d/server/cluster/cluster.go#L245

Because this process does not involve any epoch comparison, it may lead to gaps in the result region tree. For example, region A [m, x) merged to region B [c, m), produces new region B [c, x). If region B has a smaller region ID, it will be loaded before A and be removed when A is loaded, resulting a gap [c, m).

Possible fix is to compare region version and remove the one with older epoch.

@disksing disksing added the type/bug The issue is confirmed as a bug. label Dec 12, 2019
@disksing disksing changed the title LoadRegion from persistent storage should remove overlap region after compare epoch LoadRegion from persistent storage should remove overlap region after compare version Dec 12, 2019
@disksing
Copy link
Contributor Author

#3808 fixes this issue more completely. Regions are deleted at the follower after they are merged, rather than waiting until the reboot loading phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant