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 empty segment cannot merge after gc and avoid write index data for empty dmfile #4500

Merged
merged 14 commits into from
Mar 30, 2022

Conversation

lidezhu
Copy link
Contributor

@lidezhu lidezhu commented Mar 30, 2022

What problem does this PR solve?

Issue Number: close #4511

Problem Summary:

  1. empty segments cannot be merged after gc;
  2. the stable size is not 0 for empty dmfile because there is a '0' in every index file in such case;
  3. when a segment can be triggerred to gc because of too many delete range, we still wait for the gc_safe_point change, which is not needed.

What is changed and how it works?

  1. when segment should be gced because of too many delete range, do it regardless of the gc_safe_point;
  2. only update index cache for read thread;
  3. fix unstable rough set filter test because of more fast gc speed.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  1. load data into tiflash and check segment status;
    image
  2. set tiflash replica to 0 and check segment status after a while
    image

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

Fix the problem that empty segments cannot be merged after gc

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 30, 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/needs-triage-completed and removed do-not-merge/needs-linked-issue labels Mar 30, 2022
@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-4.0 PR which needs to be cherry-picked to release-4.0 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 and removed do-not-merge/needs-triage-completed labels Mar 30, 2022
@lidezhu lidezhu removed needs-cherry-pick-release-4.0 PR which needs to be cherry-picked to release-4.0 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 labels Mar 30, 2022
@lidezhu
Copy link
Contributor Author

lidezhu commented Mar 30, 2022

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Mar 30, 2022

Coverage for changed files

Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DeltaMergeStore.cpp              1333               467    64.97%          64                 5    92.19%        1912               435    77.25%         778               368    52.70%
File/DMFilePackFilter.h           101                 6    94.06%          12                 1    91.67%         194                 6    96.91%          72                 7    90.28%
File/DMFileWriter.cpp             101                 8    92.08%          15                 0   100.00%         442                18    95.93%          70                 9    87.14%
File/DMFileWriter.h                24                 1    95.83%          14                 1    92.86%          37                 3    91.89%           6                 0   100.00%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                            1559               482    69.08%         105                 7    93.33%        2585               462    82.13%         926               384    58.53%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17044      9571             43.85%    191845  97042        49.42%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot added the needs-cherry-pick-release-4.0 PR which needs to be cherry-picked to release-4.0 label Mar 30, 2022
@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 30, 2022
@sre-bot
Copy link
Collaborator

sre-bot commented Mar 30, 2022

Coverage for changed files

Filename                                                Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Debug/dbgFuncMisc.cpp                                        35                35     0.00%           2                 2     0.00%          56                56     0.00%          26                26     0.00%
Storages/DeltaMerge/ColumnFile/ColumnFileBig.cpp             68                 9    86.76%          12                 0   100.00%         168                20    88.10%          40                10    75.00%
Storages/DeltaMerge/DeltaMergeStore.cpp                    1342               478    64.38%          64                 5    92.19%        1917               442    76.94%         786               373    52.54%
Storages/DeltaMerge/File/DMFileBlockInputStream.cpp          12                 2    83.33%           2                 0   100.00%          44                 6    86.36%          12                 3    75.00%
Storages/DeltaMerge/File/DMFilePackFilter.h                 123                14    88.62%          12                 1    91.67%         202                 7    96.53%          88                15    82.95%
Storages/DeltaMerge/File/DMFileWriter.cpp                   101                 8    92.08%          15                 0   100.00%         442                18    95.93%          70                 9    87.14%
Storages/DeltaMerge/File/DMFileWriter.h                      24                 1    95.83%          14                 1    92.86%          37                 3    91.89%           6                 0   100.00%
Storages/DeltaMerge/StableValueSpace.cpp                    107                25    76.64%          15                 1    93.33%         275                66    76.00%          74                25    66.22%
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                      1812               572    68.43%         136                10    92.65%        3141               618    80.32%        1102               461    58.17%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
17069      9588             43.83%    192123  97199        49.41%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit 5e0c2f8 into pingcap:master Mar 30, 2022
ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Mar 30, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

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

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

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

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

@lidezhu lidezhu deleted the check-gc-hint-version branch March 30, 2022 11:48
ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Mar 30, 2022
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

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

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

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

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

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

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

Fix some problem involve background gc thread
5 participants