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: Fix GC for logical split not working #5941

Merged
merged 6 commits into from
Sep 19, 2022

Conversation

breezewish
Copy link
Member

@breezewish breezewish commented Sep 17, 2022

What problem does this PR solve?

Issue Number: ref #5237

I discovered that some space is not reclaimed after ingestBySplit. After investigation the problem is we are not triggering GC for these segments due to some refactoring mistake introduced in #5863

What is changed and how it works?

  1. Fixed such GC not working

image

  1. Changed merge in metrics to be merge_bg_gc so that it is more clear

  2. Made GC logs more verbose

Check List

Tests

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

Space can be successfully reclaimed after using the new TiFlash binary:

image

  • 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

This is a bug fix, however the bug is not release to user so there is no release note.

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 17, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang
  • lidezhu

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 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. labels Sep 17, 2022
Copy link
Contributor

@lidezhu lidezhu 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 Sep 17, 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. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 17, 2022
@JaySon-Huang
Copy link
Contributor

/run-integration-test

@breezewish
Copy link
Member Author

I guess there are some problems in the master branch:

[2022-09-17T13:54:09.190Z]   Error: use test; set @@tidb_isolation_read_engines='tiflash'; select count(distinct pk), count(id), count(value), count(1) from a;
[2022-09-17T13:54:09.190Z]   Result:
[2022-09-17T13:54:09.190Z]     ERROR 1105 (HY000) at line 1: other error for mpp stream: From MPP<query:436056319140823047,task:2>: Code: 0, e.displayText() = DB::TiFlashException: Different aggregation mode detected, e.what() = DB::TiFlashException,
[2022-09-17T13:54:09.190Z]   Expected:
[2022-09-17T13:54:09.190Z]     +--------------------+-----------+--------------+----------+
[2022-09-17T13:54:09.190Z]     | count(distinct pk) | count(id) | count(value) | count(1) |
[2022-09-17T13:54:09.190Z]     +--------------------+-----------+--------------+----------+
[2022-09-17T13:54:09.190Z]     |                  0 |         0 |            0 |        0 |
[2022-09-17T13:54:09.190Z]     +--------------------+-----------+--------------+----------+

@breezewish
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

@breezewish: 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: 6e860bf

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

sre-bot commented Sep 17, 2022

Coverage for changed files

Filename                                                    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                          18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Storages/DeltaMerge/DeltaMergeStore.h                            17                 2    88.24%          16                 2    87.50%          50                 7    86.00%           0                 0         -
Storages/DeltaMerge/DeltaMergeStore_InternalBg.cpp              478               200    58.16%          16                 2    87.50%         616               182    70.45%         218               100    54.13%
Storages/DeltaMerge/DeltaMergeStore_InternalSegment.cpp         562               339    39.68%           5                 1    80.00%         419               122    70.88%         148                80    45.95%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                          1075               541    49.67%          48                 5    89.58%        1132               312    72.44%         374               180    51.87%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18866      8120             56.96%    219592  83615        61.92%

full coverage report (for internal network access only)

@sre-bot
Copy link
Collaborator

sre-bot commented Sep 19, 2022

Coverage for changed files

Filename                                                    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                          18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Storages/DeltaMerge/DeltaMergeStore.h                            17                 2    88.24%          16                 2    87.50%          50                 7    86.00%           0                 0         -
Storages/DeltaMerge/DeltaMergeStore_InternalBg.cpp              478               200    58.16%          16                 2    87.50%         616               182    70.45%         218               100    54.13%
Storages/DeltaMerge/DeltaMergeStore_InternalSegment.cpp         562               339    39.68%           5                 1    80.00%         419               122    70.88%         148                80    45.95%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                          1075               541    49.67%          48                 5    89.58%        1132               312    72.44%         374               180    51.87%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18863      8117             56.97%    219543  83621        61.91%

full coverage report (for internal network access only)

@breezewish
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

@breezewish: 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-integration-test

@sre-bot
Copy link
Collaborator

sre-bot commented Sep 19, 2022

Coverage for changed files

Filename                                                    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                          18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Storages/DeltaMerge/DeltaMergeStore.h                            17                 2    88.24%          16                 2    87.50%          50                 7    86.00%           0                 0         -
Storages/DeltaMerge/DeltaMergeStore_InternalBg.cpp              478               200    58.16%          16                 2    87.50%         616               182    70.45%         218               100    54.13%
Storages/DeltaMerge/DeltaMergeStore_InternalSegment.cpp         562               339    39.68%           5                 1    80.00%         419               122    70.88%         148                80    45.95%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                          1075               541    49.67%          48                 5    89.58%        1132               312    72.44%         374               180    51.87%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18863      8115             56.98%    219543  83628        61.91%

full coverage report (for internal network access only)

@ti-chi-bot
Copy link
Member

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

@sre-bot
Copy link
Collaborator

sre-bot commented Sep 19, 2022

Coverage for changed files

Filename                                                    Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Common/TiFlashMetrics.h                                          18                 0   100.00%          11                 0   100.00%          47                 1    97.87%           8                 0   100.00%
Storages/DeltaMerge/DeltaMergeStore.h                            17                 2    88.24%          16                 2    87.50%          50                 7    86.00%           0                 0         -
Storages/DeltaMerge/DeltaMergeStore_InternalBg.cpp              478               200    58.16%          16                 2    87.50%         616               182    70.45%         218               100    54.13%
Storages/DeltaMerge/DeltaMergeStore_InternalSegment.cpp         562               339    39.68%           5                 1    80.00%         419               122    70.88%         148                80    45.95%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                          1075               541    49.67%          48                 5    89.58%        1132               312    72.44%         374               180    51.87%

Coverage summary

Functions  MissedFunctions  Executed  Lines   MissedLines  Cover
18863      8116             56.97%    219544  83600        61.92%

full coverage report (for internal network access only)

@ti-chi-bot ti-chi-bot merged commit fba461d into master Sep 19, 2022
@JaySon-Huang JaySon-Huang deleted the wenxuan/fix_dt_file_gc branch September 19, 2022 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants