Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BATCH] Batch session recovery should start after HTTP server getting started #5310

Conversation

zwangsheng
Copy link
Contributor

@zwangsheng zwangsheng commented Sep 19, 2023

Why are the changes needed?

In rare cases, when JettyServer is not fully started, we start the recovery task, will get the wrong port.

As a result, we cannot get the task that is not properly submitted by the current kyuubi server instance correctly.

Like :

mysql> select identifier, kyuubi_instance  from metadata where kyuubi_instance like '%:-1';
+--------------------------------------+----------------------+
| identifier                           | kyuubi_instance      |
+--------------------------------------+----------------------+
| b6e88262-fddb-3ccd-abdf-95ef206e612b | XXXX:-1              |
| 6a02b526-ed10-3b76-ba36-d61fbaf6b28d | XXXX:-1              |
| 70a0446e-d3d0-3b13-9d34-4cc90369c2d9 | XXXX:-1              |
| d290ee2e-b8cd-3bc4-b6c6-72f5b5dfcb9b | XXXX:-1              |
| 9bb10f4-24b4-3eec-b13b-7932b310cb5cd | XXXX:-1              |

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

  • Run test locally before make a pull request

In local env, start kyuubi server with this PR, kyuubi server start as excpeted.

And i remove start server and runInternal, kyuubi server will wait here.

Was this patch authored or co-authored using generative AI tooling?

No

@@ -183,7 +191,14 @@ class KyuubiRestFrontendService(override val serverable: Serverable)
if (!isStarted.get) {
try {
server.start()
recoverBatchSessions()
Copy link
Member

@pan3793 pan3793 Sep 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will moving it behind startInternal() solve the issue?

@pan3793 pan3793 changed the title [REST] RestService should wait jetty server started then start to recovery batch session [BATCH] Batch session recovery should start after HTTP server getting started Sep 19, 2023
@pan3793
Copy link
Member

pan3793 commented Sep 19, 2023

Also cc @turboFei

@codecov-commenter
Copy link

Codecov Report

Merging #5310 (15282c6) into master (2abceea) will not change coverage.
The diff coverage is 0.00%.

@@          Coverage Diff           @@
##           master   #5310   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         590     590           
  Lines       33372   33376    +4     
  Branches     4415    4416    +1     
======================================
- Misses      33372   33376    +4     
Files Changed Coverage Δ
...ache/kyuubi/server/KyuubiRestFrontendService.scala 0.00% <0.00%> (ø)
...cala/org/apache/kyuubi/server/ui/JettyServer.scala 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pan3793 pan3793 added this to the v1.8.0 milestone Sep 20, 2023
@pan3793 pan3793 closed this in 18d043f Sep 20, 2023
pan3793 added a commit that referenced this pull request Sep 20, 2023
… server getting started

### _Why are the changes needed?_

In rare cases, when JettyServer is not fully started, we start the recovery task, will get the wrong port.

As a result, we cannot get the task that is not properly submitted by the current kyuubi server instance correctly.

Like :
```
mysql> select identifier, kyuubi_instance  from metadata where kyuubi_instance like '%:-1';
+--------------------------------------+----------------------+
| identifier                           | kyuubi_instance      |
+--------------------------------------+----------------------+
| b6e88262-fddb-3ccd-abdf-95ef206e612b | XXXX:-1              |
| 6a02b526-ed10-3b76-ba36-d61fbaf6b28d | XXXX:-1              |
| 70a0446e-d3d0-3b13-9d34-4cc90369c2d9 | XXXX:-1              |
| d290ee2e-b8cd-3bc4-b6c6-72f5b5dfcb9b | XXXX:-1              |
| 9bb10f4-24b4-3eec-b13b-7932b310cb5cd | XXXX:-1              |
```

### _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/contributing/code/testing.html#running-tests) locally before make a pull request

In local env, start kyuubi server with this PR, kyuubi server start as excpeted.

And i remove start server and runInternal, kyuubi server will wait here.

### _Was this patch authored or co-authored using generative AI tooling?_

No

Closes #5310 from zwangsheng/rest_client/wait_server_start_start_recovery.

Closes #5310

15282c6 [Cheng Pan] Update kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiRestFrontendService.scala
d51476b [Cheng Pan] Update kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiRestFrontendService.scala
a276e39 [zwangsheng] remove useless thread
2f91f4c [zwangsheng] fix comment
a73fa45 [zwangsheng] [REST] RestService should wait jetty server started then start to recovery batch session

Lead-authored-by: zwangsheng <binjieyang@apache.org>
Co-authored-by: Cheng Pan <pan3793@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
(cherry picked from commit 18d043f)
Signed-off-by: Cheng Pan <chengpan@apache.org>
@pan3793
Copy link
Member

pan3793 commented Sep 20, 2023

Thanks, merged to master/1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants