-
Notifications
You must be signed in to change notification settings - Fork 84
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
Async snapshot by working thread of RAFT #309
Conversation
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.
We have the tests for snapshot passing. Just this one change and it should be good to go.
takeSnapshot(); sr.f.complete(null); | ||
} catch (Exception e) { | ||
sr.f.completeExceptionally(e); | ||
throw e; |
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.
There is no need to rethrow this exception. It will run from a single thread and would discard the batch of messages.
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.
It's in a Throwable try catch block, it can't affect other messages of the batch, and I think the exception is a internal error of the state machine it‘s worth printing out.
Sorry commit to a wrong branch |
Thanks, @yfei-z! |
Fix the issue #300, and a little change related to #308, I think DownRequests should failed directly if there is no space in the processing queue, let the caller to decide to retry or not, and this also meets the expectations of #168 which DownRequests has lower priority than UpRequests. And another thing is to make
setAsync
uninterruptible (no blocking operation), it helps StateMachine to implement uninterruptible interface.ArrayBlockingQueue.put
checks the interrupted status first, that means if the thread is interrupted before callingArrayBlockingQueue.put
then InterruptedException will be thrown even there is space available in the queue, so the outer method needs to check if there is an InterruptedException in the returned future and retry to make it uninterruptible, actually I think the IllegalStateException could be exposed directly while the processing queue is full.