Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public void maybeScan() {
}

for (CompactionTask target : targets) {
tracker.addManualCompaction();
ioExecutor.execute(
() ->
tracker.runWithTracking(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ private synchronized void runIfNoManualCompactions(Runnable runnable) {
}
}

public synchronized void addManualCompaction() {
Copy link
Contributor

Choose a reason for hiding this comment

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

the method name does not seem correct. haveManualCompactions refers to runningManualCompactions and pendingManualCompactions. I suggest scheduleManualCompaction.

Copy link
Contributor

@davidradl davidradl Oct 21, 2025

Choose a reason for hiding this comment

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

can we add some unit tests for this class.
I am curious about the method

private synchronized void cancel() {
        pendingManualCompactions--;
    }

If the cancel can be called while it is running then the pending counter could go negative - as we have already decremented the pending counter when we incremented the running one.

pendingManualCompactions++;
}

public synchronized boolean haveManualCompactions() {
return runningManualCompactions > 0 || pendingManualCompactions > 0;
}
Expand Down