Skip to content

Conversation

@acelyc111
Copy link
Member

Proposed changes

BE can not graceful exit because some threads are running in endless
loop. This patch do the following optimization:

  • Use the well encapsulated Thread and ThreadPool instead of std::thread
    and std::vectorstd::thread
  • Use CountDownLatch in thread's loop condition to avoid endless loop
  • Introduce a new class Daemon for daemon works, like tcmalloc_gc,
    memory_maintenance and calculate_metrics
  • Decouple statistics type TaskWorkerPool and StorageEngine notification
    by submit tasks to TaskWorkerPool's queue
  • Reorder objects' stop and deconstruct in main(), i.e. stop network
    services at first, then internal services
  • Use libevent in pthreads mode, by calling evthread_use_pthreads(),
    then EvHttpServer can exit gracefully in multi-threads
  • Call brpc::Server's Stop() and ClearServices() explicitly

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • [] Bugfix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] Documentation Update (if none of the other choices apply)
  • Code refactor (Modify the code structure, format the code, etc...)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • [] I have create an issue on (Fix #ISSUE), and have described the bug/feature there in detail
  • Compiling and unit tests pass locally with my changes
  • [] I have added tests that prove my fix is effective or that my feature works
  • [] If this change need a document change, I have updated the document
  • [] Any dependent changes have been merged

Further comments

none

morningman
morningman previously approved these changes Aug 28, 2020
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@morningman
Copy link
Contributor

Hi @acelyc111 please resolve the conflict

BE can not graceful exit because some threads are running in endless
loop. This patch do the following optimization:
- Use the well encapsulated Thread and ThreadPool instead of std::thread
  and std::vector<std::thread>
- Use CountDownLatch in thread's loop condition to avoid endless loop
- Introduce a new class Daemon for daemon works, like tcmalloc_gc,
  memory_maintenance and calculate_metrics
- Decouple statistics type TaskWorkerPool and StorageEngine notification
  by submit tasks to TaskWorkerPool's queue
- Reorder objects' stop and deconstruct in main(), i.e. stop network
  services at first, then internal services
- Use libevent in pthreads mode, by calling evthread_use_pthreads(),
  then EvHttpServer can exit gracefully in multi-threads
- Call brpc::Server's Stop() and ClearServices() explicitly
@acelyc111
Copy link
Member Author

Hi @acelyc111 please resolve the conflict

Resolved

@morningman morningman added the approved Indicates a PR has been approved by one committer. label Sep 6, 2020
@morningman morningman merged commit b780df6 into apache:master Sep 6, 2020
morningman pushed a commit to morningman/doris that referenced this pull request Sep 7, 2020
The number of thread initialized in task worker pool is not right.
This bug is introduced from apache#4440
morningman added a commit that referenced this pull request Sep 8, 2020
The number of thread initialized in task worker pool is not right.
This bug is introduced from #4440
morningman pushed a commit to morningman/doris that referenced this pull request Sep 14, 2020
The tablet and disk information reporting threads need to report to the FE periodically.
At the same time these two reporting threads will also be triggered by certain events.

The modification in PR apache#4440 caused these two threads to be triggered only by events,
and could not report regularly.
morningman added a commit that referenced this pull request Sep 20, 2020
The tablet and disk information reporting threads need to report to the FE periodically.
At the same time these two reporting threads will also be triggered by certain events.

The modification in PR #4440 caused these two threads to be triggered only by events,
and could not report regularly.
@yangzhg yangzhg mentioned this pull request Feb 9, 2021
w41ter pushed a commit to w41ter/incubator-doris that referenced this pull request Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. kind/improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants