mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-10-12 15:02:32 +00:00
fix(mito2): hold the bulk compact permit for the whole blocking task (#9252)
Keep the semaphore permit alive throughout queued and running bulk compaction in `src/mito2/src/memtable/bulk.rs`.
(cherry picked from commit e99f75f9b3)
Signed-off-by: Dennis Zhuang <killme2008@gmail.com>
Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
This commit is contained in:
@@ -1484,11 +1484,15 @@ impl CompactDispatcher {
|
||||
fn dispatch_compact(&self, task: MemCompactTask) {
|
||||
let semaphore = self.semaphore.clone();
|
||||
common_runtime::spawn_global(async move {
|
||||
let Ok(_permit) = semaphore.acquire().await else {
|
||||
let Ok(permit) = semaphore.acquire_owned().await else {
|
||||
return;
|
||||
};
|
||||
|
||||
common_runtime::spawn_blocking_global(move || {
|
||||
// The async task above returns as soon as the blocking task is
|
||||
// submitted, so the permit has to travel with it to bound the
|
||||
// compaction that actually runs.
|
||||
let _permit = permit;
|
||||
if let Err(e) = task.compact() {
|
||||
common_telemetry::error!(e; "Failed to compact memtable, region: {}", task.metadata.region_id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user