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

raftstore: add tick registry #4632

Merged
merged 5 commits into from May 6, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

address comment

Signed-off-by: Jay Lee <busyjaylee@gmail.com>
  • Loading branch information...
BusyJay committed May 6, 2019
commit 3af10c6b0cb9a0bc7078592d92e6076c4acd69a1
@@ -326,7 +326,12 @@ impl<'a, T: Transport, C: PdClient> PeerFsmDelegate<'a, T, C> {
if self.fsm.stopped {
return;
}
trace!("tick"; "tick" => ?tick, "peer_id" => self.fsm.peer_id(), "region_id" => self.region_id());
trace!(
"tick";
"tick" => ?tick,
"peer_id" => self.fsm.peer_id(),
"region_id" => self.region_id(),
);
self.fsm.tick_registry.remove(tick);
match tick {
PeerTicks::RAFT => self.on_raft_base_tick(),
@@ -596,13 +601,20 @@ impl<'a, T: Transport, C: PdClient> PeerFsmDelegate<'a, T, C> {
if is_zero_duration(&timeout) {
return;
}
trace!("schedule tick"; "tick" => ?tick, "timeout" => ?timeout, "region_id" => self.region_id(), "peer_id" => self.fsm.peer_id());
trace!(
"schedule tick";
"tick" => ?tick,
"timeout" => ?timeout,
"region_id" => self.region_id(),
"peer_id" => self.fsm.peer_id(),
);
self.fsm.tick_registry.insert(tick);
This conversation was marked as resolved by Connor1996

This comment has been minimized.

Copy link
@Connor1996

Connor1996 May 6, 2019

Member

what if it failed to get mailbox or schedule peer tick below, then the flag would be never removed

This comment has been minimized.

Copy link
@BusyJay

BusyJay May 6, 2019

Author Contributor

The error can only happen when the node is shutting down. But it makes sense to keep registry clean.


let region_id = self.region_id();
let mb = match self.ctx.router.mailbox(region_id) {
Some(mb) => mb,
None => {
self.fsm.tick_registry.remove(tick);
error!(
"failed to get mailbox";
"region_id" => self.fsm.region_id(),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.