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

Add a new API to reset the whole state machine. #477

Closed
wants to merge 1 commit into from

Conversation

JackyWoo
Copy link
Contributor

@JackyWoo JackyWoo commented Nov 7, 2023

Use case

If a node leave cluster for a long time, when it startup it wil first load local data into memory then it will receive the append_entry request from leader and leader will check data ga. If the gap can not satisfied by log, leader will send sanpshot.The newly startup node reveive the sanpshot and load it into memory.

But it should clear data in memory first, if not inconsistence may occur, details see here.

I think it is better to add a new reset API.

@greensky00
Copy link
Contributor

@JackyWoo
Actually, apply_snapshot() is for the purpose of resetting state machine (and then applying snapshot). Why don't you put your clean-up logic into apply_snapshot()? Unless reset() is independently used for somewhere else in NuRaft, having that API separate from apply_snapshot() seems to me redundant.

@JackyWoo
Copy link
Contributor Author

JackyWoo commented Nov 9, 2023

Got it, thanks.

@JackyWoo JackyWoo closed this Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants