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_pool_size not take effect and BackgroundProcessingPool::getThreadIds may misses some thread_ids. (#4686) #4697

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #4686

What problem does this PR solve?

Issue Number: close #4684 #4685

Problem Summary:

  1. Context::setDefaultProfiles should be called before Context::initializeRateLimiter. Because Context::initializeRateLimiter calls Context::getBackgroundPool and Context::getBlockableBackgroundPool inside to get background thread ids.
  2. BackgroundProcessingPool::getThreadIds and BackgroundProcessingPool::addThreadId are executing concurrently. BackgroundProcessingPool::getThreadIds may be called before all background threads executing ``BackgroundProcessingPool::addThreadId` completely.

What is changed and how it works?

  1. Adjust the initialization sequence of Context.
  2. Add absl::BlockingCounter to count all background threads executing BackgroundProcessingPool::addThreadId completely.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  1. Set configuration profiles.default.background_pool_size: 8.
  2. The expected log is found:
[2022/04/16 11:22:31.740 +08:00] [INFO] [BackgroundProcessingPool.cpp:90] ["BackgroundProcessingPool:Create BackgroundProcessingPool with 8 threads"] [thread_id=1]
[2022/04/16 11:22:31.763 +08:00] [INFO] [BackgroundProcessingPool.cpp:90] ["BackgroundProcessingPool:Create BackgroundProcessingPool with 8 threads"] [thread_id=1]
[2022/04/16 11:22:31.775 +08:00] [INFO] [RateLimiter.cpp:526] ["IORateLimiter:bg_thread_ids 16 => [9489, 9491, 9492, 9493, 9494, 9495, 9496, 9490, 9504, 9505, 9506, 9507, 9508, 9509, 9510, 9511]"] [thread_id=1]
  • 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 Apr 18, 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.

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 Apr 18, 2022
@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/cherry-pick-for-release-6.0 labels Apr 18, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Apr 19, 2022
#elif
inline static pid_t gettid()
{
return -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

changes needed according to #4704

@JaySon-Huang JaySon-Huang added this to the v6.0.1 (?) milestone Apr 21, 2022
@JaySon-Huang
Copy link
Contributor

close as no further patch version for the 6.0 branch

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/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/LGT1 Indicates that a PR has LGTM 1. type/cherry-pick-for-release-6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants