-
Notifications
You must be signed in to change notification settings - Fork 158
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
panicked at 'assertion failed: (left == right)
when adding learner
#471
Comments
👋 Thanks for opening this issue! Get help or engage by:
|
I believe the panic happens here: This is to check if replication to the newly added learner becomes up to date. I will remove this Thank you man! 😆 |
When waiting for a newly added learner to become up to date, it tries to compare last-log-id and the reported `matched` replication state. But the `matched` may have not yet receive any update and is unitialized, in such case, it tries to create a temp LogId with `leader_id(0, 0)`, which is illegal. The fix is simple: do not use log-id. Just calculating replication lag by log index. Add test to reproduce it: openraft/tests/membership/t99_issue_471_adding_learner_uses_uninit_leader_id.rs - Fix: databendlabs#471
When calling
app.raft.add_learner(node_id, Some(node), true)
the application crashes and a error happens.Payload:
POST - /add-learner [8117459876464397197, "0.0.0.0:8101"]
Error:
Full log: https://gist.github.com/ppamorim/520c04892db587790e07cadf2b30c6e4
Openraft is in sync with the main branch.
EDIT 1:
It seems to not be deterministic, if I call this a couple of seconds after the nodes start and attempt multiple times, the error doesn't happen.
This bug is visible on this branch: https://shorturl.at/cgOU0 (shorted to prevent indexing by search engines)
To reproduce: run
./script/start-cluster.sh
and checkn0.log
.EDIT 2:
By adding a
loop
inside the request to add the learner, it seems to sort the issue but it's a workaround. Feels like the version of openraft on themain
branch is not ready after its initial setup. Interesting.As:
The text was updated successfully, but these errors were encountered: