You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2021/01/28 03:59:31 UTC

[GitHub] [incubator-doris] wangbo commented on issue #5308: Compaction producer hang and none compaction consumer works

wangbo commented on issue #5308:
URL: https://github.com/apache/incubator-doris/issues/5308#issuecomment-768783162


   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.
   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org