diff --git a/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java b/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java index 790e913731..fdab892c84 100644 --- a/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/optimizing/OptimizingQueue.java +++ b/amoro-ams/amoro-ams-server/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/amoro-ams-server/src/main/java/org/apache/amoro/server/table/TableRuntime.java b/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/table/TableRuntime.java index 3b8110c633..6e8e0c1d04 100644 --- a/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/table/TableRuntime.java +++ b/amoro-ams/amoro-ams-server/src/main/java/org/apache/amoro/server/table/TableRuntime.java @@ -178,13 +178,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) {