server, storage: make flashback compatible with resolved_ts#13823
server, storage: make flashback compatible with resolved_ts#13823ti-chi-bot merged 20 commits intotikv:masterfrom
Conversation
|
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. DetailsReviewer can indicate their review by submitting an approval review. |
|
/cc @overvenus @Connor1996 @sticnarf Please help review this PR, thx a lot. |
1cd8f03 to
c7276ac
Compare
b4cc9d4 to
95d4bb1
Compare
| /// 2. Read-and-flashback writes phase: | ||
| /// - Scan all the latest writes and their corresponding values at | ||
| /// `self.version`. | ||
| /// - Write the old MVCC version writes again for all these keys with | ||
| /// `self.commit_ts` excluding the `self.start_key` . | ||
| /// 3. Read-and-rollback locks phase: | ||
| /// - Scan all locks. | ||
| /// - Rollback all these locks excluding the `self.start_key` lock we write | ||
| /// at the first phase. |
There was a problem hiding this comment.
I notice you swap the order of FlashbackLock and FlashbackWrite. Is there a reason for that?
Is it possible that some lock exists while you are writing the new flashbacked records? If so, it seems a bit weird... And I just start wondering what will happen if there is a lock on the start_key before flashback begins...
There was a problem hiding this comment.
At first, I wanted to clean up the "placeholder" lock by finally cleaning the lock. Now that we have changed the way, I will change it back. Thx for pointing this out.
There was a problem hiding this comment.
And I just start wondering what will happen if there is a lock on the start_key before flashback begins...
Since all the other read/write transactions will be blocked and fail during the flashback, I think this kind of lock doesn't have any side effects. 🤔
There was a problem hiding this comment.
I'm just not sure how CDC will react if a lock is rewritten with a different start ts...
There was a problem hiding this comment.
I have adjusted the whole process, now it works more reasonably I think.
In PrepareFlashback, we will:
- Roll back all locks.
- Prewrite the
self.start_key.
In FinishFlashback, we will:
- Flashback all writes with 1PC.
- Commit the
self.start_key.
As for the lock, after discussing with @overvenus, as long as the lock is roll backed normally, it won't be a bother to CDC. Also, since we checked the minimal store resolved_ts with the flashback version before sending the request, so it won't break any half-committed transaction either.
|
@overvenus @Connor1996 PTAL also, thx. |
|
/merge |
|
@Connor1996: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: 470a674 |
|
/hold |
Signed-off-by: JmPotato <ghzpotato@gmail.com>
|
/unhold |
Signed-off-by: JmPotato <ghzpotato@gmail.com>
|
/test |
Signed-off-by: JmPotato <ghzpotato@gmail.com>
Signed-off-by: JmPotato <ghzpotato@gmail.com>
src/storage/mvcc/reader/reader.rs
Outdated
| } | ||
|
|
||
| #[inline(always)] | ||
| pub fn get_value(&mut self, key: &Key, start_ts: TimeStamp) -> Result<Option<Value>> { |
There was a problem hiding this comment.
SnapshotReader typically uses its own start_ts for something. If it doesn't need the start_ts of SnapshotReader itself, I suggest to just use the inner MvccReader directly.
There was a problem hiding this comment.
Removed. PTAL.
BTW, your suggestion made me realize that there is a mix of SnapshotReader and MvccReader in the flashback commands, and I think we can open another separate PR to improve this situation, after this PR is merged, of course.
Signed-off-by: JmPotato <ghzpotato@gmail.com>
|
/merge |
|
@sticnarf: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
|
This pull request has been accepted and is ready to merge. DetailsCommit hash: da39377 |
Signed-off-by: JmPotato ghzpotato@gmail.com
What is changed and how it works?
Issue Number: ref #13787. Should merge after pingcap/kvproto#1016.
What's Changed:
The whole process now looks like these:
In PrepareFlashback, we will:
self.start_key.In FinishFlashback, we will:
self.start_key.Check List
Tests
Release note