From a238e4520b3e26cf0533d55e2506cef6687a81e1 Mon Sep 17 00:00:00 2001 From: Binjie Yang Date: Wed, 25 Oct 2023 14:44:44 +0800 Subject: [PATCH] Update kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala Co-authored-by: Cheng Pan --- .../org/apache/kyuubi/server/api/v1/BatchesResource.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala index 25796bad349..6321c765198 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/api/v1/BatchesResource.scala @@ -478,9 +478,8 @@ private[v1] class BatchesResource extends ApiRequestContext with Logging { if (OperationState.isTerminal(OperationState.withName(metadata.state))) { new CloseBatchResponse(false, s"The batch[$metadata] has been terminated.") } else if (batchV2Enabled(metadata.requestConf) && metadata.state == "INITIALIZED" && - // Since this code does not retrieve metadata to check, - // the metadata may be outdated, which means that the cancelUnscheduledBatch function - // here will not necessarily succeed + // there is a chance that metadata is outdated, then `cancelUnscheduledBatch` fails + // and returns false batchService.get.cancelUnscheduledBatch(batchId)) { new CloseBatchResponse(true, s"Unscheduled batch $batchId is canceled.") } else if (metadata.kyuubiInstance == null) {