klion26 commented on code in PR #3457:
URL: https://github.com/apache/amoro/pull/3457#discussion_r2000282504
##########
amoro-ams/src/main/java/org/apache/amoro/server/DefaultOptimizingService.java:
##########
@@ -571,4 +532,49 @@ private Predicate<TaskRuntime<?>>
buildSuspendingPredication(Set<String> activeT
&& task.getStartTime() + taskAckTimeout <
System.currentTimeMillis();
}
}
+
+ private class OptimizingConfigWatcher implements Runnable {
+ private final ScheduledExecutorService scheduler =
+ Executors.newSingleThreadScheduledExecutor(
+ new
ThreadFactoryBuilder().setNameFormat("resource-group-watcher-%d").build());
+
+ void start() {
+ run();
+ scheduler.scheduleAtFixedRate(
+ this, refreshGroupInterval, refreshGroupInterval,
TimeUnit.MILLISECONDS);
+ }
+
+ @Override
+ public void run() {
+ syncGroups();
+ }
+
+ private void syncGroups() {
+ try {
+ List<ResourceGroup> resourceGroups =
optimizerManager.listResourceGroups();
+ Set<String> groupNames =
+
resourceGroups.stream().map(ResourceGroup::getName).collect(Collectors.toSet());
+ Sets.difference(optimizingQueueByGroup.keySet(), groupNames)
+ .forEach(DefaultOptimizingService.this::deleteResourceGroup);
Review Comment:
Currently, `this::deleteResourceGroup` will call
`OptimizingQueue#dispose()`, it only unregister the metric, do we need to
cleanup other states in `OptimizingQueue` there?
##########
amoro-ams/src/main/java/org/apache/amoro/server/resource/DefaultOptimizerManager.java:
##########
@@ -40,8 +49,15 @@
public class DefaultOptimizerManager extends PersistentBase implements
OptimizerManager {
protected final Configurations serverConfiguration;
-
- public DefaultOptimizerManager(Configurations serverConfiguration) {
+ private final CatalogManager catalogManager;
+ private final MaintainedTableManager tableManager;
Review Comment:
it seems the `tableManager` does not need here
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]