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

gc stale peer #804

Closed
siddontang opened this issue Jul 12, 2016 · 0 comments
Closed

gc stale peer #804

siddontang opened this issue Jul 12, 2016 · 0 comments
Labels
sig/raft Component: Raft, RaftStore, etc. type/enhancement The issue or PR belongs to an enhancement.
Milestone

Comments

@siddontang
Copy link
Contributor

See https://github.com/pingcap/tikv/blob/master/src/raftstore/store/store.rs#L356

We don't handle following case now:

nodes 1, 2, 3, 1 is leader, 2 is isolated.
1 adds 4, 5, 6, Now assume 4 is leader, and 4 removes 1, 3 first, then remove 2.
When 2 re-joins the cluster, it will send vote to 1, 3, but 1, 3 will ignore this message, and 2 can't know it is already stale.

To handle this, if a peer has no leader for a long time (e.g, 10m, set in configuration), it will ask pd whether it is stale or not. We can save a last check time and check this in every region tick.
To ask pd, we can use pd GetRegion with region start key directly, if the returned region doesn't contain this peer, we can think the peer is stale.

Notice:
The GetRegion may return another next region if splitting. we should handle this case.

@siddontang siddontang modified the milestone: Beta 3 Jul 17, 2016
@siddontang siddontang assigned BusyJay and unassigned zhangjinpeng87 Jul 19, 2016
@siddontang siddontang modified the milestones: Beta 2, beta3 Jul 30, 2016
@siddontang siddontang assigned hhkbp2 and unassigned BusyJay Aug 15, 2016
@siddontang siddontang added type/enhancement The issue or PR belongs to an enhancement. sig/raft Component: Raft, RaftStore, etc. labels Aug 18, 2016
@siddontang siddontang modified the milestones: beta3, beta4 Aug 26, 2016
@hhkbp2 hhkbp2 closed this as completed Sep 12, 2016
CalvinNeo pushed a commit to CalvinNeo/tidb-engine-ext that referenced this issue Oct 23, 2023
Signed-off-by: yongman <yming0221@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/raft Component: Raft, RaftStore, etc. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

No branches or pull requests

4 participants