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

Applied commands get reapplied after restart #27

Open
evanxg852000 opened this issue Jan 9, 2025 · 2 comments
Open

Applied commands get reapplied after restart #27

evanxg852000 opened this issue Jan 9, 2025 · 2 comments

Comments

@evanxg852000
Copy link

evanxg852000 commented Jan 9, 2025

I have developed and key-value store with Bbolt. when testing, I noticed the previously applied commands get applied again after restart. I also tested this with the basic example in the repo. For an in-memory (volatile) key-value store this is fine. But for a persisted one this is creating duplicated values. I mean my raft commands are not idempotent so I want to make sure it only gets applied once.
Please, could you tell me how I do this?

Is there a way to tell to set the current node appliedIndex right after applying?
As I can see in the log, the apply index is always zero.

Note: I am just starting with a single node for now.

I have read this (#7), it's related but could not understand its relation to the snapshot

On a design note, how are you handling errors during apply?
My intuition was that the StateMache.Apply(data []byte) should return an error that informs the engine that we could not apply and therefore need to retry the same entry sequence. if no error appliedIndex gets updated forward.
I may be missing key understanding here, just trying to solidify my intuition around raft and this implementation. Thanks

@evanxg852000
Copy link
Author

@kotyara85 Maybe your experience from this (#7) issue can help here

@evanxg852000
Copy link
Author

Go it resolved here hashicorp/raft#523

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

No branches or pull requests

1 participant