-
Notifications
You must be signed in to change notification settings - Fork 400
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
check pending reads when quorum becomes small #363
Conversation
Signed-off-by: qupeng <[email protected]>
src/raft.rs
Outdated
@@ -2325,4 +2305,21 @@ impl<T: Storage> Raft<T> { | |||
m.request_snapshot = self.pending_request_snapshot; | |||
self.send(m); | |||
} | |||
|
|||
fn response_ready_read(&mut self, mut req: Message, index: u64) -> Option<Message> { |
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.
s/response_ready_read/handle_ready_read_index/
|
||
// The quorum size is now smaller, consider to response some read requests. | ||
// If there is only one peer, all pending read requests must be responsed. | ||
if let Some(ctx) = self.read_only.last_pending_request_ctx() { |
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.
What if some reads in the front of the queue are ready to be processed?
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.
Without iterating the pending queue, they can only become ready when more heartbeat responses
are received. Do you have any solution to handle them without iterating?
@@ -4920,3 +4920,36 @@ fn test_group_commit_consistent() { | |||
} | |||
} | |||
} | |||
|
|||
#[test] | |||
fn test_read_when_quorum_becomes_small() { |
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.
Please add comment what it is testing.
Signed-off-by: qupeng <[email protected]>
/run-all-tests |
/rebuild |
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.
rest LGTM
@@ -4920,3 +4920,38 @@ fn test_group_commit_consistent() { | |||
} | |||
} | |||
} | |||
|
|||
// `test_read_when_quorum_becomes_small` tests read requests could be handled earlier |
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 it should be test_read_when_quorum_becomes_less
?
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
Signed-off-by: qupeng <[email protected]>
Close #345 .
Signed-off-by: qupeng [email protected]