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 blobstore truncate size may not right (#5127) #5147

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #5127

What problem does this PR solve?

Issue Number: close #5076 , close #5134

Problem Summary:

  • DB::Exception: No enough data in file /data0/db/page/log/blobfile_6, read bytes: 0 , expected bytes: 43
  • In getGcStats, BlobStore will call the getRightMargin to get the last free space and truncate the file.
  • But getRightMargin will return a invalid value if last free space is not align to end.
  • For example:
    • Space limit is 100. So current space is [0, 100]
    • mark a span {offset=90, size=10} as used, then the free range in SpaceMap is [0, 90).
    • Then we should get 100 when we call getRightMargin
    • But it return 0. Because in getRightMargin, we will get the last free space, and return it start.

What is changed and how it works?

  • Fix the getRightMargin
  • Change the log level when we do truncate.

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 Author

ti-chi-bot commented Jun 14, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang
  • jiaqizho

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/cherry-pick-not-approved release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-6.1 This PR is cherry-picked to release-6.1 from a source PR. labels Jun 14, 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 the status/LGT1 Indicates that a PR has LGTM 1. label Jun 14, 2022
@JaySon-Huang
Copy link
Contributor

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Jun 14, 2022

Coverage for changed files

Filename                        Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BlobStore.cpp                       567               164    71.08%          56                 2    96.43%        1188               270    77.27%         360               133    63.06%
PageDirectory.cpp                   571                83    85.46%          32                 1    96.88%        1153               177    84.65%         434                97    77.65%
spacemap/SpaceMap.h                   8                 3    62.50%           4                 1    75.00%          20                 7    65.00%           8                 2    75.00%
spacemap/SpaceMapBig.h               31                11    64.52%          11                 4    63.64%          70                43    38.57%          14                 7    50.00%
spacemap/SpaceMapRBTree.cpp         346                91    73.70%          18                 0   100.00%         572               108    81.12%         202                62    69.31%
spacemap/SpaceMapRBTree.h             2                 0   100.00%           2                 0   100.00%           5                 0   100.00%           0                 0         -
spacemap/SpaceMapSTDMap.h           161                18    88.82%          11                 0   100.00%         264                17    93.56%         102                18    82.35%
tests/gtest_free_map.cpp           2506               408    83.72%          14                 0   100.00%         298                 0   100.00%         814               407    50.00%
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                              4192               778    81.44%         148                 8    94.59%        3570               622    82.58%        1934               726    62.46%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18242      9787             46.35%    204431  98029        52.05%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 15, 2022
@jiaqizho
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member Author

@jiaqizho: 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 Author

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

Commit hash: 5825bd0

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 15, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Jun 15, 2022

Coverage for changed files

Filename                        Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BlobStore.cpp                       567               164    71.08%          56                 2    96.43%        1188               270    77.27%         360               133    63.06%
PageDirectory.cpp                   571                83    85.46%          32                 1    96.88%        1153               177    84.65%         434                97    77.65%
spacemap/SpaceMap.h                   8                 3    62.50%           4                 1    75.00%          20                 7    65.00%           8                 2    75.00%
spacemap/SpaceMapBig.h               31                11    64.52%          11                 4    63.64%          70                43    38.57%          14                 7    50.00%
spacemap/SpaceMapRBTree.cpp         346                91    73.70%          18                 0   100.00%         572               108    81.12%         202                62    69.31%
spacemap/SpaceMapRBTree.h             2                 0   100.00%           2                 0   100.00%           5                 0   100.00%           0                 0         -
spacemap/SpaceMapSTDMap.h           161                18    88.82%          11                 0   100.00%         264                17    93.56%         102                18    82.35%
tests/gtest_free_map.cpp           2506               408    83.72%          14                 0   100.00%         298                 0   100.00%         814               407    50.00%
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                              4192               778    81.44%         148                 8    94.59%        3570               622    82.58%        1934               726    62.46%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18242      9787             46.35%    204431  98028        52.05%

full coverage report (for internal network access only)

@jiaqizho
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member Author

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

@sre-bot
Copy link
Collaborator

sre-bot commented Jun 16, 2022

Coverage for changed files

Filename                        Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BlobStore.cpp                       567               164    71.08%          56                 2    96.43%        1188               270    77.27%         360               133    63.06%
PageDirectory.cpp                   571                83    85.46%          32                 1    96.88%        1153               177    84.65%         434                97    77.65%
spacemap/SpaceMap.h                   8                 3    62.50%           4                 1    75.00%          20                 7    65.00%           8                 2    75.00%
spacemap/SpaceMapBig.h               31                11    64.52%          11                 4    63.64%          70                43    38.57%          14                 7    50.00%
spacemap/SpaceMapRBTree.cpp         346                91    73.70%          18                 0   100.00%         572               108    81.12%         202                62    69.31%
spacemap/SpaceMapRBTree.h             2                 0   100.00%           2                 0   100.00%           5                 0   100.00%           0                 0         -
spacemap/SpaceMapSTDMap.h           161                18    88.82%          11                 0   100.00%         264                17    93.56%         102                18    82.35%
tests/gtest_free_map.cpp           2506               408    83.72%          14                 0   100.00%         298                 0   100.00%         814               407    50.00%
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                              4192               778    81.44%         148                 8    94.59%        3570               622    82.58%        1934               726    62.46%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18242      9787             46.35%    204431  98042        52.04%

full coverage report (for internal network access only)

@jiaqizho
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member Author

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

@sre-bot
Copy link
Collaborator

sre-bot commented Jun 17, 2022

Coverage for changed files

Filename                        Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BlobStore.cpp                       567               164    71.08%          56                 2    96.43%        1188               270    77.27%         360               133    63.06%
PageDirectory.cpp                   571                83    85.46%          32                 1    96.88%        1153               177    84.65%         434                97    77.65%
spacemap/SpaceMap.h                   8                 3    62.50%           4                 1    75.00%          20                 7    65.00%           8                 2    75.00%
spacemap/SpaceMapBig.h               31                11    64.52%          11                 4    63.64%          70                43    38.57%          14                 7    50.00%
spacemap/SpaceMapRBTree.cpp         346                91    73.70%          18                 0   100.00%         572               108    81.12%         202                62    69.31%
spacemap/SpaceMapRBTree.h             2                 0   100.00%           2                 0   100.00%           5                 0   100.00%           0                 0         -
spacemap/SpaceMapSTDMap.h           161                18    88.82%          11                 0   100.00%         264                17    93.56%         102                18    82.35%
tests/gtest_free_map.cpp           2506               408    83.72%          14                 0   100.00%         298                 0   100.00%         814               407    50.00%
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                              4192               778    81.44%         148                 8    94.59%        3570               622    82.58%        1934               726    62.46%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18242      9787             46.35%    204431  98028        52.05%

full coverage report (for internal network access only)

@jiaqizho
Copy link
Contributor

/merge

@VelocityLight VelocityLight added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Aug 17, 2022
@JaySon-Huang
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member Author

@JaySon-Huang: 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.

@JaySon-Huang
Copy link
Contributor

/rebuild

@JaySon-Huang
Copy link
Contributor

/run-all-tests

@JaySon-Huang
Copy link
Contributor

/rebuild

@JaySon-Huang
Copy link
Contributor

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Aug 18, 2022

Coverage for changed files

Filename                        Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BlobStore.cpp                       568               163    71.30%          57                 2    96.49%        1201               270    77.52%         360               128    64.44%
PageDirectory.cpp                   580                87    85.00%          32                 1    96.88%        1161               181    84.41%         440               100    77.27%
spacemap/SpaceMap.h                   8                 3    62.50%           4                 1    75.00%          20                 7    65.00%           8                 2    75.00%
spacemap/SpaceMapBig.h               31                11    64.52%          11                 4    63.64%          70                43    38.57%          14                 7    50.00%
spacemap/SpaceMapRBTree.cpp         346                91    73.70%          18                 0   100.00%         572               108    81.12%         202                62    69.31%
spacemap/SpaceMapRBTree.h             2                 0   100.00%           2                 0   100.00%           5                 0   100.00%           0                 0         -
spacemap/SpaceMapSTDMap.h           161                18    88.82%          11                 0   100.00%         264                17    93.56%         102                18    82.35%
tests/gtest_free_map.cpp           2506               408    83.72%          14                 0   100.00%         298                 0   100.00%         814               407    50.00%
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                              4202               781    81.41%         149                 8    94.63%        3591               626    82.57%        1940               724    62.68%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18256      9782             46.42%    204824  98013        52.15%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit e7deb68 into pingcap:release-6.1 Aug 18, 2022
@jayl1e jayl1e added this to the v6.1.1 milestone Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 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. type/cherry-pick-for-release-6.1 This PR is cherry-picked to release-6.1 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants