[fix](metrics) fix compaction_used_permits are negative numbers (#32440)

Co-authored-by: hugoluo <hugoluo@tencent.com>
This commit is contained in:
yuxuan-luo
2024-03-22 15:53:52 +08:00
committed by yiguolei
parent cb3a329169
commit 3f093627f2

View File

@ -984,7 +984,7 @@ Status StorageEngine::_submit_compaction_task(TabletSharedPtr tablet,
? _cumu_compaction_thread_pool
: _base_compaction_thread_pool;
auto st = thread_pool->submit_func([tablet, compaction = std::move(compaction),
compaction_type, permits, is_low_priority_task,
compaction_type, permits, force, is_low_priority_task,
this]() {
if (is_low_priority_task && !_increase_low_priority_task_nums(tablet->data_dir())) {
VLOG_DEBUG << "skip low priority compaction task for tablet: "
@ -996,11 +996,15 @@ Status StorageEngine::_submit_compaction_task(TabletSharedPtr tablet,
_decrease_low_priority_task_nums(tablet->data_dir());
}
}
_permit_limiter.release(permits);
if (!force) {
_permit_limiter.release(permits);
}
_pop_tablet_from_submitted_compaction(tablet, compaction_type);
});
if (!st.ok()) {
_permit_limiter.release(permits);
if (!force) {
_permit_limiter.release(permits);
}
_pop_tablet_from_submitted_compaction(tablet, compaction_type);
return Status::InternalError(
"failed to submit compaction task to thread pool, "