Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HBASE-25880 remove files in CompactionContext from filesCompacting when clear com… #3255

Closed
wants to merge 1 commit into from
Closed
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 @@ -24,6 +24,7 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Optional;
Expand Down Expand Up @@ -444,14 +445,24 @@ public int getCompactionQueueSize() {
}

public int getLargeCompactionQueueSize() {
removeFilesFromFilesCompacting(longCompactions);
return longCompactions.getQueue().size();
}


public int getSmallCompactionQueueSize() {
removeFilesFromFilesCompacting(shortCompactions);
return shortCompactions.getQueue().size();
}

private void removeFilesFromFilesCompacting(ThreadPoolExecutor compactor) {
for (Runnable runnable : compactor.getQueue()) {
CompactionRunner runner = (CompactionRunner) runnable;
Collection<HStoreFile> files = runner.compaction.getRequest().getFiles();
runner.store.removeFromCompactingFiles(files);
}
}

public int getSplitQueueSize() {
return splits.getQueue().size();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,16 @@ private void addToCompactingFiles(Collection<HStoreFile> filesToAdd) {
Collections.sort(filesCompacting, storeEngine.getStoreFileManager().getStoreFileComparator());
}

/**
* remove the files from compacting files. This usually happens when we clear compaction queues.
*/
public void removeFromCompactingFiles(Collection<HStoreFile> filesToRemove) {
synchronized (filesCompacting) {
filesCompacting.removeAll(filesToRemove);
Collections.sort(filesCompacting, storeEngine.getStoreFileManager().getStoreFileComparator());
}
}

private void removeUnneededFiles() throws IOException {
if (!conf.getBoolean("hbase.store.delete.expired.storefile", true)) {
return;
Expand Down