-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 memory locks in replica read #8926
Conversation
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
…ex-2 Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
…ad-index Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
…ad-index-2 Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
I am not so confident in the raftstore changes. Please be careful in checking whether all paths of replica read are covered. This PR mixes a lot of transaction related code into raftstore. This makes me feel uncomfortable... Code style and organization suggestions are welcome. |
/run-all-tests |
Can you put them into coprocessor? |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
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.
lgtm
@@ -3471,6 +3516,127 @@ fn make_transfer_leader_response() -> RaftCmdResponse { | |||
resp | |||
} | |||
|
|||
const UUID_LEN: usize = 16; |
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.
Can it be moved out of peer.rs, like read_queue.rs
? It's large enough.
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
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
if ctx.coprocessor_host.on_step_read_index(&mut m) { | ||
return Ok(self.raft_group.step(m)?); | ||
} | ||
// Here we hold up MsgReadIndex. If current peer has valid lease, then we could handle the | ||
// request directly, rather than send a heartbeat to check quorum. |
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.
Even though there are memory locks encountered, I think we can still utilize the leader lease to avoid broadcasting a heartbeat to check quorum. /cc @5kbpers
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 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.
LGTM
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
LGTM |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
…narf/tikv into mem-lock-check-read-index-2
/merge |
/run-all-tests |
@sticnarf merge failed. |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
/merge |
/run-all-tests |
What problem does this PR solve?
Issue Number: tikv/sig-transaction#20
Problem Summary: Replica read in TiKV currently conflicts with async commit.
What is changed and how it works?
Depends on pingcap/kvproto#687
This PR changes the read index context from a UUID to something more complex. Now the context may contain the range to check and also may contain the lock returned by the leader. When a leader receives a read index context with key ranges, it will check the in-memory lock table and see if there is any lock blocking this read. If any, it will send the lock back to the follower or learner via the read index context.
Related changes
pingcap/docs
/pingcap/docs-cn
:pingcap/tidb-ansible
:Check List
Tests
There should be more tests for each reading RPC. We can add them later.
Release note