Skip to content

Commit

Permalink
HBASE-26271: Cleanup the broken store files under data directory
Browse files Browse the repository at this point in the history
improve naming and add some explanation in the comments
  • Loading branch information
BukrosSzabolcs committed Nov 8, 2021
1 parent 9b6d72f commit a86b9ca
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public boolean getEnabled() {
return this.enabled.get();
}

@InterfaceAudience.Private
@Override public void chore() {
@Override
public void chore() {
if (getEnabled()) {
long start = EnvironmentEdgeManager.currentTime();
AtomicLong deletedFiles = new AtomicLong(0);
Expand Down Expand Up @@ -132,20 +132,22 @@ private void cleanFileIfNeeded(FileStatus file, HStore store,
return;
}

// Compacted files can still have readers and are cleaned by a separate chore, so they have to
// be skipped here
if(isCompactedFile(file, store)){
LOG.trace("Cleanup is done by a different chore for file {}, skip cleanup", file.getPath());
return;
}

if(isCompactingFile(file, store)){
if(isCompactionResultFile(file, store)){
LOG.trace("The file is the result of an ongoing compaction {}, skip cleanup", file.getPath());
return;
}

deleteFile(file, store, deletedFiles, failedDeletes);
}

private boolean isCompactingFile(FileStatus file, HStore store) {
private boolean isCompactionResultFile(FileStatus file, HStore store) {
return store.getStoreEngine().getCompactor().getCompactionTargets().contains(file.getPath());
}

Expand Down

0 comments on commit a86b9ca

Please sign in to comment.