-
Notifications
You must be signed in to change notification settings - Fork 248
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
Reset peer's log info once new connection is established #182
Conversation
* To support offline data change (including snapshot installation), peer's log info should be reset if the previous connection is gone. Otherwise, there will be a data mismatch and the leader will attempt to send logs based on incorrect info. * The reset peer info will be recovered during the first `append_entries` communication between the leader and the peer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runtests.sh now passed. Please refer to other comments here.
src/handle_vote.cxx
Outdated
bool ok = pp->recreate_rpc(s_config, *ctx_); | ||
if (ok) { | ||
pp->set_free(); | ||
pp->set_manual_free(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that every time recreate_rpc()
call success, set_free()
and set_manual_free()
must be called. Better call them inside recreate_rpc()
before return true
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks.
src/raft_server.cxx
Outdated
bool ok = p.recreate_rpc(s_config, *ctx_); | ||
if (ok) { | ||
p.set_free(); | ||
p.set_manual_free(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as previous comment
@@ -209,10 +209,12 @@ void peer::recreate_rpc(ptr<srv_config>& config, | |||
// A reconnection attempt should be treated as an activity, | |||
// hence reset timer. | |||
reset_active_timer(); | |||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better call set_free()
and set_manual_free()
here?
* This happens due to recent protocol change: eBay#182
* This happens due to recent protocol change: #182
To support offline data change (including snapshot installation),
peer's log info should be reset if the previous connection is gone.
Otherwise, there will be a data mismatch and the leader will attempt
to send logs based on incorrect info.
The reset peer info will be recovered during the first
append_entries
communication between the leader and the peer.