Skip to content

Conversation

@weizuo93
Copy link
Contributor

@weizuo93 weizuo93 commented Apr 9, 2021

Proposed changes

We hope that cumulative compaction can be implemented as soon as possible, but base compaction tasks are likely to execute for a long time and occupy most of the threads in thread pool, which may result in high CPU load.

This patch submits cumulative compaction and base compaction into separate thread pool. So we have more flexibility to adjust the execution of cumulative compaction and base compactionaccording to the status of cluster.

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

Comment on lines +286 to +289
CONF_mInt32(min_base_compaction_threads, "10");
CONF_mInt32(max_base_compaction_threads, "10");
CONF_mInt32(min_cumulative_compaction_threads, "10");
CONF_mInt32(max_cumulative_compaction_threads, "10");
Copy link
Member

Choose a reason for hiding this comment

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

They are not mutable, use CONF_Int32 instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are not mutable, use CONF_Int32 instead.

OK, thanks.

Comment on lines +697 to +706
std::set<TTabletId>::iterator it_tablet =
(*tablet_submitted_base_compaction).find(tablet_ptr->tablet_id());
if (it_tablet != (*tablet_submitted_base_compaction).end()) {
continue;
}
it_tablet = (*tablet_submitted_cumulative_compaction).find(tablet_ptr->tablet_id());
if (it_tablet != (*tablet_submitted_cumulative_compaction).end()) {
continue;
}

Copy link
Member

Choose a reason for hiding this comment

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

You can use ContainsKey in be/src/gutil/map-util.h instead to simplify code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You can use ContainsKey in be/src/gutil/map-util.h instead to simplify code.

We need to judge whether an element exists in setrather than map.

Comment on lines +339 to +347
std::unique_ptr<ThreadPool> _base_compaction_thread_pool;
std::unique_ptr<ThreadPool> _cumulative_compaction_thread_pool;

CompactionPermitLimiter _permit_limiter;

std::mutex _tablet_submitted_compaction_mutex;
std::map<DataDir*, vector<TTabletId>> _tablet_submitted_compaction;
RWMutex _tablet_submitted_base_compaction_mutex;
std::map<DataDir*, std::set<TTabletId>> _tablet_submitted_base_compaction;
RWMutex _tablet_submitted_cumulative_compaction_mutex;
std::map<DataDir*, std::set<TTabletId>> _tablet_submitted_cumulative_compaction;
Copy link
Member

Choose a reason for hiding this comment

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

How about use a two elements array, one for base compaction, the other for cumulative compaction, to simplify code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about use a two elements array, one for base compaction, the other for cumulative compaction, to simplify code?

OK, Thank you.

@weizuo93 weizuo93 closed this Apr 20, 2021
Hastyshell pushed a commit to Hastyshell/doris that referenced this pull request Nov 12, 2025
…or query tvf apache#57745 (apache#5618)

cherry-picks from apache#57745
Related to apache#5568

Co-authored-by: zy-kkk <zhongyk10@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants