Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
import org.apache.amoro.config.OptimizingConfig;
import org.apache.amoro.config.TableConfiguration;
import org.apache.amoro.optimizing.OptimizingType;
import org.apache.amoro.optimizing.plan.AbstractOptimizingEvaluator;
import org.apache.amoro.process.ProcessStatus;
import org.apache.amoro.server.optimizing.OptimizingProcess;
import org.apache.amoro.server.optimizing.OptimizingStatus;
import org.apache.amoro.server.scheduler.PeriodicTableScheduler;
import org.apache.amoro.server.table.DefaultTableRuntime;
import org.apache.amoro.server.table.TableService;
import org.apache.amoro.server.utils.IcebergTableUtil;
import org.apache.amoro.shade.guava32.com.google.common.base.Preconditions;
import org.apache.amoro.table.MixedTable;
import org.apache.amoro.utils.CronUtils;
Expand Down Expand Up @@ -108,7 +110,10 @@ public void execute(TableRuntime tableRuntime) {
AmoroTable<?> table = loadTable(tableRuntime);
defaultTableRuntime.refresh(table);

evaluateCronTriggers(defaultTableRuntime, (MixedTable) table.originalTable());
MixedTable mixedTable = (MixedTable) table.originalTable();
// first, evaluate cron then update healthscore
evaluateCronTriggers(defaultTableRuntime, mixedTable);
updateHealthScore(defaultTableRuntime, mixedTable);
} catch (Throwable throwable) {
logger.error("Refreshing table {} failed.", tableRuntime.getTableIdentifier(), throwable);
}
Expand Down Expand Up @@ -165,6 +170,22 @@ private void evaluateCronTriggers(DefaultTableRuntime tableRuntime, MixedTable m
}
}

private void updateHealthScore(DefaultTableRuntime tableRuntime, MixedTable mixedTable) {
if (!tableRuntime.getOptimizingConfig().isEnabled()) {
return;
}
try {
AbstractOptimizingEvaluator evaluator =
IcebergTableUtil.createOptimizingEvaluator(
tableRuntime, mixedTable, maxPendingPartitions);
AbstractOptimizingEvaluator.PendingInput pendingInput = evaluator.getPendingInput();
tableRuntime.setTableSummary(pendingInput);
} catch (Throwable t) {
logger.warn(
"failed to evaluate health score for table {}", tableRuntime.getTableIdentifier(), t);
}
}

// ── helpers ─────────────────────────────────────────────────────────────────

/**
Expand Down
Loading