From 93727f9af12abf50d9038312ebf0796b6347e3fb Mon Sep 17 00:00:00 2001 From: fwang12 Date: Mon, 20 Nov 2023 18:03:26 +0800 Subject: [PATCH] [KYUUBI #5210][FOLLOWUP] Close batch operation log even batch is in cancel state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description Followup for #5210 For batch operation, it has similar issue. https://github.com/apache/kyuubi/issues/5210#issuecomment-1818499090 ## Issue References ๐Ÿ”— This pull request fixes # ## Describe Your Solution ๐Ÿ”ง Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ## Types of changes :bookmark: - [x] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช #### Behavior Without This Pull Request :coffin: #### Behavior With This Pull Request :tada: #### Related Unit Tests --- # Checklists ## ๐Ÿ“ Author Self Checklist - [x] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project - [ ] I have performed a self-review - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) ## ๐Ÿ“ Committer Pre-Merge Checklist - [x] Pull request title is okay. - [x] No license issues. - [ ] Milestone correctly set? - [ ] Test coverage is ok - [ ] Assignees are selected. - [ ] Minimum number of approvals - [ ] No changes are requested **Be nice. Be informative.** Closes #5733 from turboFei/batch_log_close. Closes #5210 e2b72b476 [fwang12] Close batch log even batch is in cancel state Authored-by: fwang12 Signed-off-by: fwang12 (cherry picked from commit 24fbd573fb5a5e6e01bce4d76d22f46e1db38f9d) Signed-off-by: fwang12 --- .../apache/kyuubi/operation/BatchJobSubmission.scala | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala index f48cd0fcf4e..ba11dcb277e 100644 --- a/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala +++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/BatchJobSubmission.scala @@ -338,12 +338,6 @@ class BatchJobSubmission( override def close(): Unit = withLockRequired { if (!isClosedOrCanceled) { - try { - getOperationLog.foreach(_.close()) - } catch { - case e: IOException => error(e.getMessage, e) - } - MetricsSystem.tracing(_.decCount(MetricRegistry.name(OPERATION_OPEN, opType))) // fast fail @@ -379,6 +373,12 @@ class BatchJobSubmission( } } } + + try { + getOperationLog.foreach(_.close()) + } catch { + case e: IOException => error(e.getMessage, e) + } } override def cancel(): Unit = {