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 background gc when rows covered by delete range is larger than stable #3657

Merged
merged 15 commits into from
Dec 21, 2021

Conversation

lidezhu
Copy link
Contributor

@lidezhu lidezhu commented Dec 16, 2021

What problem does this PR solve?

Issue Number: close #3659

Problem Summary: If some segments was generated by logical split, the new segments will keep the delete range of the old segment. And by the old gc logic, the rows in stable covered by delete range is larger than the valid rows in the stable which will skip gc on these segments.
The original purpose of this check is to prevent small segments to merge delta. But after some detail investigation, this check is really unnecessary.

What is changed and how it works?

  1. remove the check to forbid gc when stable is smaller than delta
  2. use the new log macro

Check List

Tests

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

image

  1. deploy a cluster with master version and load tpcc data
  2. set replica to 0 and watch the change in tiflash storage space
  3. patch to this fixed version and watch the change in tiflash storage space

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Dec 16, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 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 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. labels Dec 16, 2021
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
@flowbehappy PTAL

@ilovesoup
Copy link
Contributor

Which version it affects?

@flowbehappy
Copy link
Contributor

flowbehappy commented Dec 20, 2021

Which version it affects?
@ilovesoup

Before 5.3.0, we don't have a mechanism to completely delete data after removing tiflash replicas. We should cherry-pick relative PRs to 5.x to address this issue. CC @lidezhu

@flowbehappy flowbehappy reopened this Dec 20, 2021
@flowbehappy flowbehappy self-requested a review December 20, 2021 06:40
Copy link
Contributor

@flowbehappy flowbehappy left a comment

Choose a reason for hiding this comment

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

LGTM with a minor comment.

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 20, 2021
@lidezhu lidezhu added the needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 label Dec 20, 2021
@lidezhu
Copy link
Contributor Author

lidezhu commented Dec 20, 2021

/rebuild

@lidezhu
Copy link
Contributor Author

lidezhu commented Dec 20, 2021

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Dec 20, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/494/cobertura/
(Coverage detail url is limited office network access)

lines: 42.5% (47529 out of 111815)
branches: 6.0% (73026 out of 1208733)

@lidezhu
Copy link
Contributor Author

lidezhu commented Dec 21, 2021

/merge

@ti-chi-bot
Copy link
Member

@lidezhu: 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: 004c7be

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

sre-bot commented Dec 21, 2021

Coverage detail: https://ci-internal.pingcap.net/job/tics_ghpr_unit_test/510/cobertura/
(Coverage detail url is limited office network access)

lines: 42.5% (47533 out of 111816)
branches: 6.0% (73019 out of 1208721)

@ti-chi-bot
Copy link
Member

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

@lidezhu lidezhu deleted the check-bg-1215 branch December 21, 2021 05:15
lidezhu added a commit that referenced this pull request Feb 21, 2022
…able (#3657) (#3694)

* Fix gc mechanism when rows covered by delete range is larger than stable rows

* remove check to forbid gc on small table

* make sure delete range is not empty before gc

* small refactor

* remove obsolete header file

* add some comment about the gc trigger criteria

* add more comments

* avoid gc on empty tables and avoid gc work triggered too much at the same interval

* add some comment about BackgroundProcessingPool::addTask behaviour

* small improvement on comments

* add more comments

* use old log macro

Co-authored-by: lidezhu <[email protected]>
Co-authored-by: lidezhu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 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/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TPCC data cannot be reclaimed after tiflash replica set to 0
6 participants