talent-plan/tinykv

Check whether the leader is valid

hzh0425 opened this issue · 4 comments

When a network partition occurs, if there is only the leader node in a partition, it will not stepdown.
Therefore, should the logic of checking leader stepdown be added to make the leader stepdown when a network partition occurs

no need, the leader can't do any write/read successfully

no need, the leader can't do any write/read successfully

However, in the 3B test, I encountered a situation:

The old leader is partitioned by the network, but it does not stop the leadership and will continue to send heartbeat to PD

Newleader will also send heartbeat to PD

This causes the cache in PD to change constantly, which slows down the performance of the system, and log replication becomes very slow. I solved this problem by adding leader lease detection

Yes, it's a problem. In the implementation of tikv's raft-rs, it avoids by leader checking quorum and stepping down if the quorum is not active. But no need to consider it in tinykv for simplicity.