Skip to content

HBASE-26938 Compaction failures after StoreFileTracker integration (branch-2, branch-2.5) #4334

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

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 @@ -420,7 +420,13 @@ private Optional<CompactionContext> selectCompaction(HRegion region, HStore stor
throws IOException {
// don't even select for compaction if disableCompactions is set to true
if (!isCompactionsEnabled()) {
LOG.info(String.format("User has disabled compactions"));
LOG.info("User has disabled compactions");
return Optional.empty();
}
if (store.isCompacting()) {
// There is only one Compactor instance for a given store. We cannot concurrently compact
// the store.
LOG.debug("Store is already compacting");
return Optional.empty();
}
Optional<CompactionContext> compaction = store.requestCompaction(priority, tracker, user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ public class HStore implements Store, HeapSize, StoreConfigInformation,
// rows that has cells from both memstore and files (or only files)
private LongAdder mixedRowReadsCount = new LongAdder();

private boolean cacheOnWriteLogged;

/**
* Lock specific to archiving compacted store files. This avoids races around
* the combination of retrieving the list of compacted files and moving them to
Expand Down Expand Up @@ -290,7 +288,6 @@ protected HStore(final HRegion region, final ColumnFamilyDescriptor family,
this, memstore.getClass().getSimpleName(), policyName, verifyBulkLoads,
parallelPutCountPrintThreshold, family.getDataBlockEncoding(),
family.getCompressionType());
cacheOnWriteLogged = false;
}

private StoreContext initializeStoreContext(ColumnFamilyDescriptor family) throws IOException {
Expand Down Expand Up @@ -578,6 +575,13 @@ public Collection<HStoreFile> getCompactedFiles() {
return this.storeEngine.getStoreFileManager().getCompactedfiles();
}

@Override
public boolean isCompacting() {
synchronized (filesCompacting) {
return !filesCompacting.isEmpty();
}
}

/**
* This throws a WrongRegionException if the HFile does not fit in this region, or an
* InvalidHFileException if the HFile is not valid.
Expand Down Expand Up @@ -2404,4 +2408,5 @@ void updateMetricsStore(boolean memstoreRead) {
mixedRowReadsCount.increment();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public interface Store {

Collection<? extends StoreFile> getCompactedFiles();

boolean isCompacting();

/**
* When was the last edit done in the memstore
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,12 @@ protected final List<Path> compact(final CompactionRequestImpl request,
smallestReadPoint = Math.min(fd.minSeqIdToKeep, smallestReadPoint);
cleanSeqId = true;
}
if (writer != null){
LOG.warn("Writer exists when it should not: " + getCompactionTargets().stream()
if (writer != null) {
String message = "Writer exists when it should not: " + getCompactionTargets().stream()
.map(n -> n.toString())
.collect(Collectors.joining(", ", "{ ", " }")));
.collect(Collectors.joining(", ", "{ ", " }"));
LOG.error(message);
throw new IllegalStateException(message);
}
writer = sinkFactory.createWriter(scanner, fd, dropCache, request.isMajor());
finished = performCompaction(fd, scanner, smallestReadPoint, cleanSeqId,
Expand Down Expand Up @@ -564,7 +566,7 @@ public List<Path> getCompactionTargets() {
/**
* Reset the Writer when the new storefiles were successfully added
*/
public void resetWriter(){
public void resetWriter() {
writer = null;
}
}