Skip to content

Commit

Permalink
Compaction Failed Logging in TabletLogger
Browse files Browse the repository at this point in the history
Closes apache#4139
Changes:
- Methods compactionFailed() and externalCompactionFailed() in TabletLogger
- Small change to arg passed to updateTimer()
- Calls to compactionFailed() and externalCompactionFailed() in
  CompactableImpl
  • Loading branch information
kevinrr888 committed Jan 11, 2024
1 parent f26c702 commit 8886f20
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.accumulo.core.metadata.StoredTabletFile;
import org.apache.accumulo.core.metadata.TServerInstance;
import org.apache.accumulo.core.metadata.TabletFile;
import org.apache.accumulo.core.metadata.schema.ExternalCompactionId;
import org.apache.accumulo.core.spi.compaction.CompactionJob;
import org.apache.accumulo.core.spi.compaction.CompactionKind;
import org.apache.accumulo.core.tabletserver.log.LogEntry;
Expand Down Expand Up @@ -148,6 +149,18 @@ public static void compacted(KeyExtent extent, CompactionJob job, StoredTabletFi
asMinimalString(job.getFiles()));
}

public static void compactionFailed(KeyExtent extent, CompactionJob job,
CompactionConfig config) {
fileLog.debug("Failed to compact: extent: {}, input files: {}, iterators: {}", extent,
asMinimalString(job.getFiles()), config.getIterators());
}

public static void externalCompactionFailed(KeyExtent extent, ExternalCompactionId id,
CompactionJob job, CompactionConfig config) {
fileLog.debug("Failed to compact: id: {}, extent: {}, input files: {}, iterators: {}", id,
extent, asMinimalString(job.getFiles()), config.getIterators());
}

public static void flushed(KeyExtent extent, Optional<StoredTabletFile> newDatafile) {
if (newDatafile.isPresent()) {
fileLog.debug("Flushed {} created {} from [memory]", extent, newDatafile.orElseThrow());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1108,10 +1108,11 @@ public void compact(CompactionServiceId service, CompactionJob job, BooleanSuppl
log.debug("Compaction canceled {} ", getExtent());
} catch (Exception e) {
newFile = Optional.empty();
TabletLogger.compactionFailed(getExtent(), job, cInfo.localCompactionCfg);
throw new RuntimeException(e);
} finally {
completeCompaction(job, cInfo.jobFiles, newFile, successful);
tablet.updateTimer(MAJOR, queuedTime, startTime, stats.getEntriesRead(), newFile == null);
tablet.updateTimer(MAJOR, queuedTime, startTime, stats.getEntriesRead(), newFile.isEmpty());
}
}

Expand Down Expand Up @@ -1161,6 +1162,8 @@ public ExternalCompactionJob reserveExternalCompaction(CompactionServiceId servi

} catch (Exception e) {
externalCompactions.remove(externalCompactionId);
TabletLogger.externalCompactionFailed(getExtent(), externalCompactionId, job,
cInfo.localCompactionCfg);
completeCompaction(job, cInfo.jobFiles, Optional.empty(), false);
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 8886f20

Please sign in to comment.