log-backup: Keep the order of observation IDs consistent with the order in which they were received#18290
Conversation
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
81e52a9 to
5caf380
Compare
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
Signed-off-by: Jianjun Liao <36503113+Leavrth@users.noreply.github.com>
| .try_for_each(|r| { | ||
| tx.blocking_send(ObserveOp::Start { | ||
| region: r.region.clone(), | ||
| handle: ObserveHandle::new(), |
There was a problem hiding this comment.
If remove the handle here, will some stale region change of Lock CF came and Lock forever?
@YuJuncen WDYT?
There was a problem hiding this comment.
It seems no problem, since every places is use equal to condition rather than less or greater to compare handle id.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 3pointer, YuJuncen The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
close tikv#18243 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
In response to a cherrypick label: new pull request created to branch |
|
In response to a cherrypick label: new pull request created to branch |
|
In response to a cherrypick label: new pull request created to branch |
…er in which they were received (tikv#18290) close tikv#18243 Keep the order of observation IDs consistent with the order in which they were received Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com> Signed-off-by: Jianjun Liao <36503113+Leavrth@users.noreply.github.com>
…er in which they were received (tikv#18290) close tikv#18243 Keep the order of observation IDs consistent with the order in which they were received Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com> Signed-off-by: Jianjun Liao <36503113+Leavrth@users.noreply.github.com>
What is changed and how it works?
Issue Number: Close #18243
What's Changed:
Additional notes
There are always three observe operations (Stop[Pre-Candidate], Stop[Candidate] and Start[Leader]) generated when any peer becomes leader. But the observe operation
Start[Leader]may lost due to no task registered yet. Besides, when a log backup task is being registered, the endpoint will send a observe operationStart[Scanned]for a leader.Case 1: If the observe operation
Start[Leader]is ignored because the task is not registered yet.We can make sure the endpoint must get the region when a new task is being registered. We have the following execution order:
In this case, the step 2 is already done, so we can make sure that the region update query is already in the queue of
region_info_accessor.schedulerwhen the endpoint sendsRegionInfoQuery::SeekRegionto theregion_info_accessor. Therefore, the endpoint can get the region fromseek_region.Case2: If the endpoint can not get the region from
seek_region.We can make sure the observe operation
Start[Leader]is not ignored. We have the following execution order:In this case, the step 2 is already done, so we can make sure that the task range is registered. Therefore, the step 4 is not ignored and the observe operation
Start[Leader]is scheduled.In summary, the
region_operatormay meet theStart[Scanned] -> Stop[Pre-Candidate] -> Stop[Candidate] -> Start[Leader]and repeat scanning the region. But it won't lost the region if it is leader.Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
Side effects
Release note