You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "keith-turner (via GitHub)" <gi...@apache.org> on 2023/06/13 00:35:50 UTC
[GitHub] [accumulo] keith-turner commented on a diff in pull request #3484: Start Compactors when starting MiniAccumuloCluster
keith-turner commented on code in PR #3484:
URL: https://github.com/apache/accumulo/pull/3484#discussion_r1227374072
##########
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java:
##########
@@ -614,8 +623,50 @@ public synchronized void start() throws IOException, InterruptedException {
executor = Executors.newSingleThreadExecutor();
}
+ Set<String> queues = getCompactionQueueNames();
+ if (queues.isEmpty()) {
+ throw new IllegalStateException("No Compactor queues configured.");
+ }
+
+ for (String name : queues) {
+ control.startCompactors(Compactor.class, getConfig().getNumCompactors(), name);
+ }
+
verifyUp();
+ printProcessSummary();
+
+ }
+
+ private void printProcessSummary() {
+ log.info("Process Summary:");
+ getProcesses().forEach((k, v) -> log.info("{}: {}", k,
+ v.stream().map((pr) -> pr.getProcess().pid()).collect(Collectors.toList())));
+ }
+
+ private Set<String> getCompactionQueueNames() {
+
+ Set<String> queueNames = new HashSet<>();
+ AccumuloConfiguration aconf = new ConfigurationCopy(config.getSiteConfig());
+ CompactionServicesConfig csc = new CompactionServicesConfig(aconf);
+ ServiceEnvironment senv = new ServiceEnvironmentImpl(getServerContext());
+
+ for (var entry : csc.getPlanners().entrySet()) {
+ String serviceId = entry.getKey();
+
+ var initParams = new CompactionPlannerInitParams(CompactionServiceId.of(serviceId),
+ csc.getOptions().get(serviceId), senv);
+
+ ExecutorConfig[] execConfigs =
+ new Gson().fromJson(initParams.getOptions().get("executors"), ExecutorConfig[].class);
+
+ for (ExecutorConfig ec : execConfigs) {
+ if (ec.getQueue() != null) {
+ queueNames.add(ec.getQueue());
+ }
+ }
Review Comment:
The code is assuming the DefaultCompactionPlanner is configured. The following is an attempt to instantiate whatever planner is configured, initiatlize it with its config, and then get the external executors it configured.
```suggestion
String serviceId = entry.getKey();
String plannerClass = entry.getValue();
CompactionPlanner planner = // create instance of plannerClass
var initParams = new CompactionPlannerInitParams(CompactionServiceId.of(serviceId),
csc.getOptions().get(serviceId), senv);
planner.init(initParams);
// TODO may need to strip "e." prefix from ceid.canonical() below
initParams.getRequestedExternalExecutors().forEach(ceid->queueNames.add(ceid.canonical()));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org