zhoujinsong commented on code in PR #3457:
URL: https://github.com/apache/amoro/pull/3457#discussion_r2002361751
##########
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:
What else do you think should added to the disposal process?
The code looks safe according to the existing codes in the master branch.
But I am not sure if it is possible some process is open in the queue will
be deleted.
##########
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:
Yes, it can be dropped.
--
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]