use of org.apache.accumulo.core.spi.compaction.CompactionExecutorId in project accumulo by apache.
the class CompactableImplTest method newECM.
private static ExternalCompactionMetadata newECM(Set<StoredTabletFile> jobFiles, Set<StoredTabletFile> nextFiles, CompactionKind kind, boolean propagateDeletes, boolean initiallySelectedAll, Long compactionId) {
TabletFile compactTmpName = newFile("C00000A.rf_tmp");
String compactorId = "cid";
short priority = 9;
CompactionExecutorId ceid = CompactionExecutorIdImpl.externalId("ecs1");
return new ExternalCompactionMetadata(jobFiles, nextFiles, compactTmpName, compactorId, kind, priority, ceid, propagateDeletes, initiallySelectedAll, compactionId);
}
use of org.apache.accumulo.core.spi.compaction.CompactionExecutorId in project accumulo by apache.
the class CompactionService method configurationChanged.
public void configurationChanged(String plannerClassName, Long maxRate, Map<String, String> plannerOptions) {
Preconditions.checkArgument(maxRate >= 0);
var old = this.rateLimit.getAndSet(maxRate);
if (old != maxRate)
log.debug("Updated compaction service id:{} rate limit:{}", myId, maxRate);
if (this.plannerClassName.equals(plannerClassName) && this.plannerOpts.equals(plannerOptions))
return;
var initParams = new CompactionPlannerInitParams(myId, plannerOptions, new ServiceEnvironmentImpl(context));
var tmpPlanner = createPlanner(plannerClassName);
tmpPlanner.init(initParams);
Map<CompactionExecutorId, CompactionExecutor> tmpExecutors = new HashMap<>();
initParams.getRequestedExecutors().forEach((ceid, numThreads) -> {
InternalCompactionExecutor executor = (InternalCompactionExecutor) executors.get(ceid);
if (executor == null) {
executor = new InternalCompactionExecutor(ceid, numThreads, ceMetrics, readLimiter, writeLimiter);
} else {
executor.setThreads(numThreads);
}
tmpExecutors.put(ceid, executor);
});
initParams.getRequestedExternalExecutors().forEach(ceid -> {
ExternalCompactionExecutor executor = (ExternalCompactionExecutor) executors.get(ceid);
if (executor == null) {
executor = externExecutorSupplier.apply(ceid);
}
tmpExecutors.put(ceid, executor);
});
Sets.difference(executors.keySet(), tmpExecutors.keySet()).forEach(ceid -> {
executors.get(ceid).stop();
});
this.plannerClassName = plannerClassName;
this.plannerOpts = plannerOptions;
this.executors = Map.copyOf(tmpExecutors);
this.planner = tmpPlanner;
log.debug("Updated compaction service id:{} planner:{} options:{}", myId, plannerClassName, plannerOptions);
}
Aggregations