wangbo commented on issue #5308:
URL:
https://github.com/apache/incubator-doris/issues/5308#issuecomment-768790322
> > code version: master
> > ```
> > bool CompactionPermitLimiter::request(int64_t permits) {
> >
DorisMetrics::instance()->compaction_waitting_permits->set_value(permits);
> > if (permits > config::total_permits_for_compaction_score) {
> > // when tablet's compaction score is larger than
"config::total_permits_for_compaction_score",
> > // it's necessary to do compaction for this tablet because this
tablet will not get "permits"
> > // anyway. otherwise, compaction task for this tablet will not
be executed forever.
> > std::unique_lock<std::mutex> lock(_permits_mutex);
> > _permits_cv.wait(lock, [=] {
> > return _used_permits == 0 ||
> > _used_permits + permits <=
config::total_permits_for_compaction_score;
> > });
> > } else {
> > if (_used_permits + permits >
config::total_permits_for_compaction_score) {
> > std::unique_lock<std::mutex> lock(_permits_mutex);
> > _permits_cv.wait(lock, [=] {
> > return _used_permits + permits <=
config::total_permits_for_compaction_score;
> > });
> > }
> > }
> > _used_permits += permits; // here _used_permits is updated out of
lock, Does this have concurrency issues ?
> > DorisMetrics::instance()->compaction_waitting_permits->set_value(0);
> >
DorisMetrics::instance()->compaction_used_permits->set_value(_used_permits);
> > return true;
> > }
> > ```
> >
> >
> > I have a question as in the comment above.
>
> @wangbo
> `_used_permits` is defined as a type of `AtomicInt64`.
I understand.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]