afterincomparableyum commented on code in PR #7777:
URL: https://github.com/apache/kyuubi/pull/7777#discussion_r4277640685
##########
kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/DiscoveryClientTests.scala:
##########
@@ -129,6 +130,55 @@ trait DiscoveryClientTests extends KyuubiFunSuite {
}
}
+ test("Stop gracefully without waiting on sessions of a stopped session
manager") {
Review Comment:
I can add this change
##########
kyuubi-ha/src/test/scala/org/apache/kyuubi/ha/client/DiscoveryClientTests.scala:
##########
@@ -129,6 +130,55 @@ trait DiscoveryClientTests extends KyuubiFunSuite {
}
}
+ test("Stop gracefully without waiting on sessions of a stopped session
manager") {
+ val namespace = "kyuubiengine-stopped-backend"
+
+ conf
+ .set(HA_ADDRESSES, getConnectString)
+ .set(HA_NAMESPACE, namespace)
+ .set(KyuubiConf.FRONTEND_THRIFT_BINARY_BIND_PORT, 0)
+
+ var discovery: ServiceDiscovery = null
+ val service: Serverable = new NoopTBinaryFrontendServer() {
+ override val frontendServices: Seq[NoopTBinaryFrontendService] = Seq(
+ new NoopTBinaryFrontendService(this) {
+ override val discoveryService: Option[Service] = {
+ discovery = new KyuubiServiceDiscovery(this)
+ Some(discovery)
+ }
+ })
+ }
+ service.initialize(conf)
+ service.start()
+
+ val basePath = s"/$namespace"
+ try {
+ val sessionManager = service.backendService.sessionManager
+ // simulate a session left open by a disconnected client
+ sessionManager.openSession(
+ TProtocolVersion.HIVE_CLI_SERVICE_PROTOCOL_V10,
+ "kyuubi",
+ "",
+ "localhost",
+ Map.empty)
+ sessionManager.stop()
+ assert(sessionManager.getActiveUserSessionCount === 1)
+
+ withDiscoveryClient(conf) { discoveryClient =>
+ discoveryClient.getChildren(basePath).foreach { child =>
+ discoveryClient.delete(s"$basePath/$child")
+ }
+ eventually(timeout(5.seconds), interval(100.millis)) {
+ assert(discovery.getServiceState === ServiceState.STOPPED)
+ assert(service.getServiceState === ServiceState.STOPPED)
+ }
+ }
+ } finally {
+ service.stop()
Review Comment:
change is applied. thank you!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]