use of org.apache.accumulo.core.spi.compaction.CompactionDispatcher.DispatchParameters in project accumulo by apache.
the class CompactableImpl method getConfiguredService.
@Override
public CompactionServiceId getConfiguredService(CompactionKind kind) {
Map<String, String> debugHints = null;
try {
var dispatcher = tablet.getTableConfiguration().getCompactionDispatcher();
Map<String, String> tmpHints = Map.of();
if (kind == CompactionKind.USER) {
synchronized (this) {
if (fileMgr.getSelectionStatus() != FileSelectionStatus.NOT_ACTIVE && fileMgr.getSelectionStatus() != FileSelectionStatus.CANCELED && fileMgr.getSelectionKind() == CompactionKind.USER) {
tmpHints = compactionConfig.getExecutionHints();
}
}
}
var hints = tmpHints;
debugHints = hints;
var dispatch = dispatcher.dispatch(new DispatchParameters() {
private final ServiceEnvironment senv = new ServiceEnvironmentImpl(tablet.getContext());
@Override
public ServiceEnvironment getServiceEnv() {
return senv;
}
@Override
public Map<String, String> getExecutionHints() {
return hints;
}
@Override
public CompactionKind getCompactionKind() {
return kind;
}
@Override
public CompactionServices getCompactionServices() {
return manager.getServices();
}
});
return dispatch.getService();
} catch (RuntimeException e) {
log.error("Failed to dispatch compaction {} kind:{} hints:{}, falling back to {} service.", getExtent(), kind, debugHints, CompactionServicesConfig.DEFAULT_SERVICE, e);
return CompactionServicesConfig.DEFAULT_SERVICE;
}
}
Aggregations