diff --git a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java index 47a3f401e8..bd1e5023a0 100644 --- a/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java +++ b/amoro-ams/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java @@ -225,6 +225,9 @@ private void triggerAsyncPlanning( CompletableFuture.supplyAsync(() -> planInternal(tableRuntime), planExecutor) .whenComplete( (process, throwable) -> { + if (throwable != null) { + LOG.error("Failed to plan table {}", tableRuntime.getTableIdentifier(), throwable); + } long currentTime = System.currentTimeMillis(); scheduleLock.lock(); try { diff --git a/amoro-ams/src/main/java/org/apache/amoro/server/table/TableRuntime.java b/amoro-ams/src/main/java/org/apache/amoro/server/table/TableRuntime.java index e70adfa80b..475ab28f1d 100644 --- a/amoro-ams/src/main/java/org/apache/amoro/server/table/TableRuntime.java +++ b/amoro-ams/src/main/java/org/apache/amoro/server/table/TableRuntime.java @@ -188,13 +188,21 @@ public void beginPlanning() { } public void planFailed() { - invokeConsistency( - () -> { - OptimizingStatus originalStatus = optimizingStatus; - updateOptimizingStatus(OptimizingStatus.PENDING); - persistUpdatingRuntime(); - tableHandler.handleTableChanged(this, originalStatus); - }); + try { + invokeConsistency( + () -> { + OptimizingStatus originalStatus = optimizingStatus; + updateOptimizingStatus(OptimizingStatus.PENDING); + persistUpdatingRuntime(); + tableHandler.handleTableChanged(this, originalStatus); + }); + } catch (Exception e) { + OptimizingStatus originalStatus = optimizingStatus; + updateOptimizingStatus(OptimizingStatus.PENDING); + LOG.warn( + "Persistent database failed, only the optimizing state in the memory was changed.", e); + tableHandler.handleTableChanged(this, originalStatus); + } } public void beginProcess(OptimizingProcess optimizingProcess) {