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

ensure every record in wal is only applied once when restart (#7920) #7922

Conversation

ti-chi-bot
Copy link
Member

@ti-chi-bot ti-chi-bot commented Aug 10, 2023

This is an automated cherry-pick of #7920

What problem does this PR solve?

Issue Number:

Problem Summary:
After dumping snapshot to checkpoint file, we only remove log files which max sequence is smaller than the sequence used to dump snapshot.
So the remaining wal files may have some overlap with the checkpoint file.
And at restart, we will apply all records in the checkpoint file and other wal files which will cause some records to be applied more than once.
This may cause some problem like the following picture.

image

Because page 88 was already deleted, it is not shown in the checkpoint file log_100_1. But the operation ref 90 -> 88 is still in later log files. So at restart, when it try to apply this record, it will fail to complete the ref operation.

What is changed and how it works?

Record the snap sequence used to dump checkpoint in the filename of checkpoint file. Specifically, change it from log_100_1 to log_100_1_400.
When restart, after apply all records in checkpoint file, we will skip later record which sequence is smaller than the snap sequence in the checkpoint file name.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility
    • Can not downgrade to a version earlier than v7.4.0

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Fix the problem that tiflash may fail to restart under some cases.

@ti-chi-bot ti-chi-bot bot added do-not-merge/cherry-pick-not-approved release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Aug 10, 2023
@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-7.3 labels Aug 10, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 10, 2023

This cherry pick PR is for a release branch and has not yet been approved by release team.
Adding the do-not-merge/cherry-pick-not-approved label.

To merge this cherry pick, it must first be approved by the collaborators.

AFTER it has been approved by collaborators, please ping the release team in a comment to request a cherry pick review.

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 kubernetes/test-infra repository.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Aug 10, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ilovesoup for approval. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@lidezhu
Copy link
Contributor

lidezhu commented Aug 10, 2023

/run-all-tests

@lidezhu lidezhu mentioned this pull request Aug 10, 2023
12 tasks
@lidezhu lidezhu closed this Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/cherry-pick-not-approved release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-7.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants