You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2023/03/23 10:11:20 UTC

[kyuubi] branch branch-1.7 updated: [KYUUBI #4584] Post the session exception to EventBus in time

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

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


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new b52d17a31 [KYUUBI #4584] Post the session exception to EventBus in time
b52d17a31 is described below

commit b52d17a31c487df5ea1c9ef6167c3ceb2e4cf8e3
Author: fwang12 <fw...@ebay.com>
AuthorDate: Thu Mar 23 18:11:03 2023 +0800

    [KYUUBI #4584] Post the session exception to EventBus in time
    
    ### _Why are the changes needed?_
    
    When session exception thrown, post it to event bus in time.
    
    ### _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.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4584 from turboFei/handle_post.
    
    Closes #4584
    
    920ee29a4 [fwang12] post exception in time
    
    Authored-by: fwang12 <fw...@ebay.com>
    Signed-off-by: fwang12 <fw...@ebay.com>
    (cherry picked from commit 351bab3676a77b919eacb33865744dd363643495)
    Signed-off-by: fwang12 <fw...@ebay.com>
---
 .../src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala
index 5b731e273..f2bc4f6bd 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala
@@ -20,7 +20,7 @@ import com.codahale.metrics.MetricRegistry
 import org.apache.hive.service.rpc.thrift.TProtocolVersion
 
 import org.apache.kyuubi.config.KyuubiReservedKeys.{KYUUBI_SESSION_CONNECTION_URL_KEY, KYUUBI_SESSION_REAL_USER_KEY}
-import org.apache.kyuubi.events.KyuubiSessionEvent
+import org.apache.kyuubi.events.{EventBus, KyuubiSessionEvent}
 import org.apache.kyuubi.metrics.MetricsConstants.{CONN_OPEN, CONN_TOTAL}
 import org.apache.kyuubi.metrics.MetricsSystem
 import org.apache.kyuubi.session.SessionType.SessionType
@@ -49,7 +49,10 @@ abstract class KyuubiSession(
       f
     } catch {
       case t: Throwable =>
-        getSessionEvent.foreach(_.exception = Some(t))
+        getSessionEvent.foreach { sessionEvent =>
+          sessionEvent.exception = Some(t)
+          EventBus.post(sessionEvent)
+        }
         throw t
     }
   }