dlmarion commented on code in PR #5807:
URL: https://github.com/apache/accumulo/pull/5807#discussion_r2290800307


##########
server/base/src/main/java/org/apache/accumulo/server/util/UpgradeUtil.java:
##########
@@ -304,4 +329,92 @@ public void execute(String[] args) throws Exception {
 
   }
 
+  private void validateCompactionServiceConfiguration(ServerContext ctx)
+      throws KeeperException, InterruptedException {
+
+    boolean configurationError = false;
+
+    final CompactionServicesConfig servicesConfig =
+        new CompactionServicesConfig(ctx.getConfiguration());
+    final Set<CompactionServiceId> definedServiceIds = 
servicesConfig.getPlanners().keySet()
+        
.stream().map(CompactionServiceId::of).collect(Collectors.toUnmodifiableSet());
+
+    LOG.info("Defined compaction service ids: {}", definedServiceIds);
+
+    final ZooReader zr = ctx.getZooSession().asReader();
+    List<String> zooTableIds = zr.getChildren(ZTABLES);
+
+    for (String tableId : zooTableIds) {
+
+      final String tableName =
+          new String(zr.getData(Constants.ZTABLES + "/" + tableId + 
ZTABLE_NAME), UTF_8);
+      final String namespaceId = new String(
+          zr.getData(Constants.ZTABLES + "/" + tableId + 
Constants.ZTABLE_NAMESPACE), UTF_8);
+
+      final NamespaceId nsid = NamespaceId.of(namespaceId);
+      final TableId tid = TableId.of(tableId);
+
+      final NamespaceConfiguration nsConf =
+          new NamespaceConfiguration(ctx, nsid, ctx.getConfiguration());
+      final TableConfiguration tconf = new TableConfiguration(ctx, tid, 
nsConf);
+
+      final CompactionDispatcher dispatcher = tconf.getCompactionDispatcher();
+
+      for (CompactionKind kind : CompactionKind.values()) {
+        final CompactionDispatcher.DispatchParameters dispatchParams =
+            new CompactionDispatcher.DispatchParameters() {
+              @Override
+              public CompactionServices getCompactionServices() {
+                return () -> definedServiceIds;
+              }
+
+              @Override
+              public ServiceEnvironment getServiceEnv() {
+                return (ServiceEnvironment) ctx;
+              }
+
+              @Override
+              public CompactionKind getCompactionKind() {
+                return kind;
+              }
+
+              @Override
+              public Map<String,String> getExecutionHints() {
+                return Map.of();
+              }
+            };
+        final CompactionServiceId expectedCompactionService =
+            dispatcher.dispatch(dispatchParams).getService();
+        LOG.info("Table {} is configured to use service \"{}\" for compaction 
kind {}", tableName,
+            expectedCompactionService, kind);
+        if 
(!servicesConfig.getPlanners().containsKey(expectedCompactionService.canonical()))
 {
+          if (tid.equals(SystemTables.ROOT.tableId())
+              || tid.equals(SystemTables.METADATA.tableId())) {

Review Comment:
   Added in 9b7bf48



-- 
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-unsubscr...@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to