diff --git a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingProcess.java b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingProcess.java index d8e0f58a4f..ff8e7c710f 100644 --- a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingProcess.java +++ b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingProcess.java @@ -45,11 +45,4 @@ public interface OptimizingProcess { void commit(); MetricsSummary getSummary(); - - enum Status { - RUNNING, - CLOSED, - SUCCESS, - FAILED - } } diff --git a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingProcessMeta.java b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingProcessMeta.java index b123e25af9..25b547eff1 100644 --- a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingProcessMeta.java +++ b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingProcessMeta.java @@ -18,6 +18,8 @@ package org.apache.amoro.server.optimizing; +import org.apache.amoro.process.ProcessStatus; + import java.util.Map; /** Meta of optimizing process. */ @@ -30,7 +32,7 @@ public class OptimizingProcessMeta { private String tableName; private Long targetSnapshotId; private Long targetChangeSnapshotId; - private OptimizingProcess.Status status; + private ProcessStatus processStatus; private OptimizingType optimizingType; private long planTime; private long endTime; @@ -89,12 +91,12 @@ public void setTargetSnapshotId(Long targetSnapshotId) { this.targetSnapshotId = targetSnapshotId; } - public OptimizingProcess.Status getStatus() { - return status; + public ProcessStatus getStatus() { + return processStatus; } - public void setStatus(OptimizingProcess.Status status) { - this.status = status; + public void setStatus(ProcessStatus processStatus) { + this.processStatus = processStatus; } public OptimizingType getOptimizingType() { diff --git a/amoro-ams/src/main/java/org/apache/amoro/server/persistence/TableRuntimeMeta.java b/amoro-ams/src/main/java/org/apache/amoro/server/persistence/TableRuntimeMeta.java index d94db0a25d..c2cb80c59c 100644 --- a/amoro-ams/src/main/java/org/apache/amoro/server/persistence/TableRuntimeMeta.java +++ b/amoro-ams/src/main/java/org/apache/amoro/server/persistence/TableRuntimeMeta.java @@ -20,7 +20,7 @@ import org.apache.amoro.TableFormat; import org.apache.amoro.config.TableConfiguration; -import org.apache.amoro.server.optimizing.OptimizingProcess; +import org.apache.amoro.process.ProcessStatus; import org.apache.amoro.server.optimizing.OptimizingStatus; import org.apache.amoro.server.optimizing.OptimizingType; import org.apache.amoro.server.optimizing.plan.OptimizingEvaluator; @@ -48,7 +48,7 @@ public class TableRuntimeMeta { private OptimizingEvaluator.PendingInput pendingInput; private OptimizingEvaluator.PendingInput tableSummary; private long optimizingProcessId = 0; - private OptimizingProcess.Status processStatus; + private ProcessStatus processStatus; private OptimizingType optimizingType; private long targetSnapshotId; private long targetChangeSnapshotId; @@ -141,7 +141,7 @@ public long getOptimizingProcessId() { return optimizingProcessId; } - public OptimizingProcess.Status getProcessStatus() { + public ProcessStatus getProcessStatus() { return processStatus; } @@ -257,7 +257,7 @@ public void setOptimizingProcessId(long optimizingProcessId) { this.optimizingProcessId = optimizingProcessId; } - public void setProcessStatus(OptimizingProcess.Status processStatus) { + public void setProcessStatus(ProcessStatus processStatus) { this.processStatus = processStatus; } diff --git a/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/BaseOptimizingChecker.java b/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/BaseOptimizingChecker.java index f4acb99137..2b862fc30a 100644 --- a/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/BaseOptimizingChecker.java +++ b/amoro-ams/src/test/java/org/apache/amoro/server/optimizing/BaseOptimizingChecker.java @@ -18,6 +18,7 @@ package org.apache.amoro.server.optimizing; +import org.apache.amoro.process.ProcessStatus; import org.apache.amoro.server.persistence.PersistentBase; import org.apache.amoro.server.persistence.mapper.OptimizingMapper; import org.apache.amoro.shade.guava32.com.google.common.collect.Sets; @@ -128,7 +129,7 @@ protected OptimizingProcessMeta waitOptimizeResult() { Optional any = tableOptimizingProcesses.stream() .filter(p -> p.getProcessId() > lastProcessId) - .filter(p -> p.getStatus().equals(OptimizingProcess.Status.SUCCESS)) + .filter(p -> p.getStatus().equals(ProcessStatus.SUCCESS)) .findAny(); if (any.isPresent()) { @@ -164,7 +165,7 @@ protected OptimizingProcessMeta waitOptimizeResult() { Integer.MAX_VALUE)) .stream() .filter(p -> p.getProcessId() > lastProcessId) - .filter(p -> p.getStatus().equals(OptimizingProcess.Status.SUCCESS)) + .filter(p -> p.getStatus().equals(ProcessStatus.SUCCESS)) .collect(Collectors.toList()); if (result.size() == 1) { this.lastProcessId = result.get(0).getProcessId();