Jzjsnow commented on code in PR #3776:
URL: https://github.com/apache/amoro/pull/3776#discussion_r2544775508


##########
amoro-ams/src/main/java/org/apache/amoro/server/refresh/event/MetricBasedRefreshEvent.java:
##########
@@ -0,0 +1,206 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.amoro.server.refresh.event;
+
+import static 
org.apache.amoro.table.TablePartitionDetailProperties.FILE_SIZE_SQUARED_ERROR_SUM;
+import static 
org.apache.amoro.table.TablePartitionDetailProperties.FILE_SIZE_SQUARED_ERROR_SUM_DEFAULT;
+
+import org.apache.amoro.TableFormat;
+import org.apache.amoro.config.OptimizingConfig;
+import org.apache.amoro.server.dashboard.MixedAndIcebergTableDescriptor;
+import org.apache.amoro.server.table.DefaultTableRuntime;
+import 
org.apache.amoro.shade.guava32.com.google.common.annotations.VisibleForTesting;
+import org.apache.amoro.table.MixedTable;
+import org.apache.amoro.table.descriptor.PartitionBaseInfo;
+import org.apache.amoro.utils.MemorySize;
+import org.apache.iceberg.SnapshotSummary;
+import org.apache.iceberg.util.PropertyUtil;
+import org.apache.iceberg.util.ThreadPools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.stream.Collectors;
+
+public class MetricBasedRefreshEvent {
+  private static final Logger logger = 
LoggerFactory.getLogger(MetricBasedRefreshEvent.class);
+
+  /**
+   * Determines if evaluating pending input is necessary.
+   *
+   * @param tableRuntime The runtime information of the table.
+   * @param table The table to be evaluated.
+   * @return true if evaluation is necessary, otherwise false.
+   */
+  public static boolean isEvaluatingPendingInputNecessary(
+      DefaultTableRuntime tableRuntime, MixedTable table) {
+    if (table.format() != TableFormat.ICEBERG && table.format() != 
TableFormat.MIXED_ICEBERG) {
+      logger.debug(
+          "MetricBasedRefreshEvent only support ICEBERG/MIXED_ICEBERG tables. 
Always return true for other table formats.");
+      return true;
+    }
+
+    // Perform periodic scheduling according to the fallback interval to avoid 
false positives or
+    // missed triggers based on metadata metric-driven evaluation
+    OptimizingConfig config = tableRuntime.getOptimizingConfig();
+    if (reachFallbackInterval(
+        tableRuntime.getLastPlanTime(), 
config.getEvaluationFallbackInterval())) {
+      logger.info("Maximum interval for evaluating table {} has reached.", 
table.id());
+      return true;
+    }
+
+    ExecutorService executorService = ThreadPools.getWorkerPool();

Review Comment:
   The latest commit removes the separate thread pool for manifest file MSE 
calculation since we now handle this during the evaluation scan phase instead.



-- 
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]

Reply via email to