Skip to content

Support blobstore gc when data bigger than 512M#3907

Merged
ti-chi-bot merged 11 commits intopingcap:masterfrom
jiaqizho:add-gc-512m-support
Jan 24, 2022
Merged

Support blobstore gc when data bigger than 512M#3907
ti-chi-bot merged 11 commits intopingcap:masterfrom
jiaqizho:add-gc-512m-support

Conversation

@jiaqizho
Copy link
Contributor

@jiaqizho jiaqizho commented Jan 20, 2022

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What is changed and how it works?

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 Jan 20, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • JaySon-Huang

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.

Details

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 the release-note-none Denotes a PR that doesn't merit a release note. label Jan 20, 2022
@jiaqizho jiaqizho requested a review from JaySon-Huang January 20, 2022 06:07
@ti-chi-bot ti-chi-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jan 20, 2022
@jiaqizho jiaqizho mentioned this pull request Jan 20, 2022
12 tasks
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 21, 2022
@jiaqizho
Copy link
Contributor Author

@JaySon-Huang PTAL

Comment on lines +249 to +251
auto lock_stats = blob_stats.lock();
blob_stats.eraseStat(stat, lock_stats);
getBlobFile(blob_id)->del();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to lock it when removing the file on disk?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

need protecting when changing stats_map.

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.

Pass written_blobs as a reference, and only append to it after successfully write.

And also capture log, write_lilmiter to make the params of lambda to be more clear.

@JaySon-Huang
Copy link
Contributor

Can we simplify BlobStore::BlobStats::eraseStat to eliminate the variable found?

void BlobStore::BlobStats::eraseStat(const BlobFileId blob_file_id, const std::lock_guard<std::mutex> & lock)
{
    BlobStatPtr stat = nullptr;

    for (auto & stat_in_map : stats_map)
    {
        if (stat->id == blob_file_id)
        {
            stat = stat_in_map;
            break;
        }
    }

    if (stat != nullptr)
    {
        LOG_FMT_ERROR(log, "No exist BlobStat [BlobFileId={}]", blob_file_id);
        return;
    }

    LOG_FMT_DEBUG(log, "Erase BlobStat from maps [BlobFileId={}]", blob_file_id);

    eraseStat(std::move(stat), lock);
}

@jiaqizho
Copy link
Contributor Author

Can we simplify BlobStore::BlobStats::eraseStat to eliminate the variable found?

void BlobStore::BlobStats::eraseStat(const BlobFileId blob_file_id, const std::lock_guard<std::mutex> & lock)
{
    BlobStatPtr stat = nullptr;

    for (auto & stat_in_map : stats_map)
    {
        if (stat->id == blob_file_id)
        {
            stat = stat_in_map;
            break;
        }
    }

    if (stat != nullptr)
    {
        LOG_FMT_ERROR(log, "No exist BlobStat [BlobFileId={}]", blob_file_id);
        return;
    }

    LOG_FMT_DEBUG(log, "Erase BlobStat from maps [BlobFileId={}]", blob_file_id);

    eraseStat(std::move(stat), lock);
}

changed.

Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 24, 2022
@JaySon-Huang
Copy link
Contributor

/run-all-tests

@sre-bot
Copy link
Collaborator

sre-bot commented Jan 24, 2022

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

lines: 44.7% (51591 out of 115297)
branches: 7.0% (89898 out of 1275491)

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jan 24, 2022
@JaySon-Huang
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Details

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.

DetailsCommit hash: ff56640

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jan 24, 2022
@ti-chi-bot
Copy link
Member

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

Details

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 Jan 24, 2022

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

lines: 44.8% (51637 out of 115387)
branches: 7.1% (89938 out of 1275203)

@ti-chi-bot ti-chi-bot merged commit 095613e into pingcap:master Jan 24, 2022
@JaySon-Huang JaySon-Huang deleted the add-gc-512m-support branch January 24, 2022 11:14
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/XL Denotes a PR that changes 500-999 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.

4 participants