Skip to content
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

storage: calculate last_change_ts in rollback #13749

Merged
merged 2 commits into from Nov 10, 2022

Conversation

sticnarf
Copy link
Contributor

@sticnarf sticnarf commented Nov 8, 2022

What is changed and how it works?

Issue Number: Ref #13694

What's Changed:

This commit supports calculating last_change_ts when writing a new
Rollback record.

To get the correct last_change_ts, we always call seek_write to find the
last write record before start_ts.

Check List

Tests

  • Unit test

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 8, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • MyonKeminta
  • ekexium

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

Signed-off-by: Yilin Chen <sticnarf@gmail.com>
@ti-chi-bot ti-chi-bot added the status/LGT1 Status: PR - There is already 1 approval label Nov 9, 2022
assert_eq!(rollback.last_change_ts, 50.into());
assert_eq!(rollback.versions_to_last_change, 3);

// last_change_ts should point to the latest record before start_ts; prev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// last_change_ts should point to the latest record before start_ts; prev
// last_change_ts should point to the latest record before start_ts; prev writes:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, it's a compulsory new line limited by the line length.

@sticnarf
Copy link
Contributor Author

PTAL @ekexium

@ti-chi-bot ti-chi-bot added status/LGT2 Status: PR - There are already 2 approvals and removed status/LGT1 Status: PR - There is already 1 approval labels Nov 10, 2022
@sticnarf
Copy link
Contributor Author

/merge

@ti-chi-bot
Copy link
Member

@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 /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

Instructions 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.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 75e6b63

@ti-chi-bot ti-chi-bot added the status/can-merge Status: Can merge to base branch label Nov 10, 2022
@ti-chi-bot
Copy link
Member

@sticnarf: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions 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.

@ti-chi-bot ti-chi-bot merged commit 0339d51 into tikv:master Nov 10, 2022
@ti-chi-bot ti-chi-bot added this to the Pool milestone Nov 10, 2022
ti-chi-bot added a commit that referenced this pull request Nov 23, 2022
ref #13694, ref #13749

This commit reverts #13749 (calculate last_change_ts in rollback).

If we calculate last_change_ts, consider the following case:
Key k has a write record with commit_ts = 5.
1. Prewrite k, start_ts = 10
2. Rollback k, start_ts = 30, last_commit_ts = 5.
3. Commit k, start_ts = 10, commit_ts = 20

Then, read with ts = 40, it will get an incorrect last_commit_ts from
the rollback record.

There is no easy way to handle the rollback case. I choose to give up
calculating it.

Signed-off-by: Yilin Chen <sticnarf@gmail.com>

Co-authored-by: Ti Chi Robot <ti-community-prow-bot@tidb.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/XL status/can-merge Status: Can merge to base branch status/LGT2 Status: PR - There are already 2 approvals
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants