You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ul...@apache.org on 2023/01/04 01:40:08 UTC

[kyuubi] branch branch-1.6 updated: [KYUUBI #4067] Reset the operation log before fetching new one

This is an automated email from the ASF dual-hosted git repository.

ulyssesyou pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.6 by this push:
     new 120ba4126 [KYUUBI #4067] Reset the operation log before fetching new one
120ba4126 is described below

commit 120ba412678e5edde7b3ae99802d2998ed13b2e7
Author: fwang12 <fw...@ebay.com>
AuthorDate: Wed Jan 4 09:39:42 2023 +0800

    [KYUUBI #4067] Reset the operation log before fetching new one
    
    ### _Why are the changes needed?_
    
    https://github.com/apache/kyuubi/blob/9342a29284234e21c73f96024a740c6e93e7cb33/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala#L134-L141
    
    We need to reset the operation log before fetching new operation log, otherwise, we might meet corner case.
    
    - The last operation log is not empty
    - we meet log not found exception
    - we can not terminate the loop because the `shouldFinishLog` is always false
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4067 from turboFei/check_status.
    
    Closes #4067
    
    b61e14f6 [fwang12] style
    5787ad97 [fwang12] do not fetch again
    6dc479d1 [fwang12] refactor
    37a91909 [fwang12] reset the log before fetch log
    
    Authored-by: fwang12 <fw...@ebay.com>
    Signed-off-by: ulysses-you <ul...@apache.org>
    (cherry picked from commit 2c6f17daf13c94d8b0644e59cd48b9c0a93478c7)
    Signed-off-by: ulysses-you <ul...@apache.org>
---
 .../main/scala/org/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala
index 164523d71..f395b8ef2 100644
--- a/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala
+++ b/kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala
@@ -48,7 +48,6 @@ class LogBatchCommand(
       var from = math.max(normalizedCliConfig.batchOpts.from, 0)
       val size = normalizedCliConfig.batchOpts.size
 
-      var log: OperationLog = null
       var done = false
       var batch = this.batch.getOrElse(batchRestApi.getBatchById(batchId))
       val kyuubiInstance = batch.getKyuubiInstance
@@ -64,6 +63,7 @@ class LogBatchCommand(
         }
 
         while (!done) {
+          var log: OperationLog = null
           try {
             log = retrieveOperationLog()
             val (latestBatch, shouldFinishLog) =
@@ -103,7 +103,9 @@ class LogBatchCommand(
                 hasRemainingLogs = false
               }
             } catch {
-              case e: Exception => error(s"Error fetching batch logs: ${e.getMessage}")
+              case e: Exception =>
+                error(s"Error fetching batch logs: ${e.getMessage}")
+                hasRemainingLogs = false
             }
           }
           if (hasRemainingLogs) {