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

fix pagestorage v2 restore #5384

Merged
merged 5 commits into from
Jul 15, 2022
Merged

Conversation

lidezhu
Copy link
Contributor

@lidezhu lidezhu commented Jul 15, 2022

What problem does this PR solve?

Issue Number: close #5385

Problem Summary: When restart, ps v2 will try to reuse old page file for writing. But if no file can be used for writing, it will create new page file. But the file id of the new page file is determined by the max file id in writing page file set which is empty now. And it will create PageFile_1_0 in this case for writing which may override previous data.

What is changed and how it works?

Make sure new page file id is larger than all current page files at restart.

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

Documentation

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

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jul 15, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang
  • flowbehappy

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.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 15, 2022
@ti-chi-bot ti-chi-bot added status/LGT1 Indicates that a PR has LGTM 1. do-not-merge/needs-triage-completed needs-cherry-pick-release-5.0 PR which needs to be cherry-picked to release-5.0 needs-cherry-pick-release-5.1 PR which needs to be cherry-picked to release-5.1 needs-cherry-pick-release-5.2 PR which needs to be cherry-picked to release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.0 Type: Need cherry pick to release-6.0 needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. and removed do-not-merge/needs-triage-completed labels Jul 15, 2022
Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed status/LGT1 Indicates that a PR has LGTM 1. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 15, 2022
@lidezhu lidezhu force-pushed the fix-ps-v2-restore branch from 47ad3f7 to 35d1d99 Compare July 15, 2022 11:03
@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jul 15, 2022
@ti-chi-bot
Copy link
Member

@lidezhu: 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.

@lidezhu
Copy link
Contributor Author

lidezhu commented Jul 15, 2022

/run-unit-test

@sre-bot
Copy link
Collaborator

sre-bot commented Jul 15, 2022

Coverage for changed files

Filename                         Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PageStorage.cpp                      553               191    65.46%          39                 5    87.18%         952               211    77.84%         370               169    54.32%
PageStorage.h                         49                13    73.47%          20                 3    85.00%          48                 4    91.67%          22                13    40.91%
tests/gtest_page_storage.cpp        4916              1005    79.56%          33                 2    93.94%        1070                 5    99.53%        1514               721    52.38%
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                               5518              1209    78.09%          92                10    89.13%        2070               220    89.37%        1906               903    52.62%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18594      9573             48.52%    211802  96369        54.50%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit f7be362 into pingcap:master Jul 15, 2022
ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 15, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot mentioned this pull request Jul 15, 2022
12 tasks
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5387.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 15, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot mentioned this pull request Jul 15, 2022
12 tasks
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5388.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 15, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot mentioned this pull request Jul 15, 2022
12 tasks
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5389.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 15, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot mentioned this pull request Jul 15, 2022
12 tasks
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5390.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 15, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot mentioned this pull request Jul 15, 2022
12 tasks
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5391.

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Jul 15, 2022
@ti-chi-bot ti-chi-bot mentioned this pull request Jul 15, 2022
12 tasks
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5392.

@ti-chi-bot ti-chi-bot mentioned this pull request Jul 15, 2022
12 tasks
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #5393.

@lidezhu lidezhu deleted the fix-ps-v2-restore branch July 15, 2022 13:28
ti-chi-bot added a commit that referenced this pull request Aug 17, 2022
lidezhu added a commit that referenced this pull request Sep 14, 2022
* This is an automated cherry-pick of #5384

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>

* Update PageStorage.h

* fix static analysis

* update format code

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
Co-authored-by: lidezhu <47731263+lidezhu@users.noreply.github.com>
Co-authored-by: lidezhu <lidezhu@pingcap.com>
ti-chi-bot added a commit that referenced this pull request Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.0 PR which needs to be cherry-picked to release-5.0 needs-cherry-pick-release-5.1 PR which needs to be cherry-picked to release-5.1 needs-cherry-pick-release-5.2 PR which needs to be cherry-picked to release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-cherry-pick-release-6.0 Type: Need cherry pick to release-6.0 needs-cherry-pick-release-6.1 Should cherry pick this PR to release-6.1 branch. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PageFile in PageStorage V2 maybe truncate at restart
5 participants