Skip to content

Conversation

@beryllw
Copy link
Contributor

@beryllw beryllw commented Dec 18, 2023

🔍 Description

Issue References 🔗

This pull request fixes #5797

Describe Your Solution 🔧

Support to describe and register/de-register engine with command in current session

Types of changes 🔖

  • 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 ⚰️

Behavior With This Pull Request 🎉

user can use sql KYUUBI DEREGISTER ENGINE to stop spark engine, KYUUBI REGISTER ENGINE to restart spark engine, and KYUUBI DESCRIBE[DESC] ENGINE to show spark engine info.

Related Unit Tests


Checklists

📝 Author Self Checklist

  • My code follows the style guidelines 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

📝 Committer Pre-Merge Checklist

  • Pull request title is okay.
  • 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.

@pan3793 pan3793 changed the title [kyuubi #5797]Support to describe and register/de-register engine wit… [KYUUBI #5797] Support to describe engine and de-register engine with command in current session Dec 19, 2023
@codecov-commenter
Copy link

codecov-commenter commented Dec 19, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (c290dae) 61.57% compared to head (651bf5f) 61.58%.
Report is 8 commits behind head on master.

❗ Current head 651bf5f differs from pull request most recent head 9c40671. Consider uploading reports for the commit 9c40671 to get more accurate results

Files Patch % Lines
...pache/kyuubi/sql/plan/command/DescribeEngine.scala 94.11% 1 Missing ⚠️
...apache/kyuubi/sql/plan/command/RestartEngine.scala 94.44% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #5871      +/-   ##
============================================
+ Coverage     61.57%   61.58%   +0.01%     
  Complexity       23       23              
============================================
  Files           616      618       +2     
  Lines         36386    36441      +55     
  Branches       4978     4978              
============================================
+ Hits          22404    22442      +38     
- Misses        11570    11576       +6     
- Partials       2412     2423      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@beryllw
Copy link
Contributor Author

beryllw commented Dec 22, 2023

@turboFei @pan3793 cc

engineLaunched = false
launchEngineOp = sessionManager.operationManager
.newLaunchEngineOperation(this, shouldRunAsync = false)
runOperation(launchEngineOp)
Copy link
Member

@wForget wForget Dec 22, 2023

Choose a reason for hiding this comment

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

This will re-execute openEngineSession and we need to consider whether some states are as expected.

  • openedTime will be reset: sessionEvent.openedTime = System.currentTimeMillis()
  • do we need to update engineLastAlive?
  • EngineRef#builder is changed, volatile required?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed engineLastAlive , EngineRef#builder.
I think openedTime means engine openedTime, so we don't need to update openedTime.And i changed the org.apache.kyuubi.events.KyuubiSessionEvent#openedTime comment.

Copy link
Member

Choose a reason for hiding this comment

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

You shall need to wrap this method with _client.withLockAcquired.

Copy link
Member

Choose a reason for hiding this comment

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

in case that other operations access the _client during restarting engine.

Copy link
Member

Choose a reason for hiding this comment

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

We may not be able to use the lock of _client because _client will be assigned a new object after this method.

Copy link
Member

Choose a reason for hiding this comment

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

in case that other operations access the _client during restarting engine.

This seems difficult to avoid

Copy link
Member

Choose a reason for hiding this comment

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

Or we need to add ReadWriteLock for the client method of KyuubiSessionImpl.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or we need to add ReadWriteLock for the client method of KyuubiSessionImpl.

submit Operation from multiple threads will meet problem , I will fix it.

@beryllw beryllw closed this Dec 24, 2023
@beryllw beryllw deleted the kyuubi_5797 branch December 24, 2023 01:15
@beryllw beryllw restored the kyuubi_5797 branch December 24, 2023 01:16
@beryllw beryllw reopened this Dec 24, 2023
@turboFei
Copy link
Member

please rebase your code.

@beryllw
Copy link
Contributor Author

beryllw commented Dec 24, 2023

please rebase your code.

OK

@bowenliang123
Copy link
Contributor

I have some concerns and suggestions,

  1. separate two features in each PR, which are not coupled with each other.
  2. clarify the gap between description and implementation , as the title and description says de-register engine while it implements re-start engine
  3. describe the design and reason why we have to have restarting engine, which is not that reasonable to me
  4. is that reslaunching engine a sync operation, and what happen if the restaring engine breaks the timeouts for either launching or session
  5. authorization first. What happens if the current engine is used by other sessions even after deregisted. In what case and combination situation allows one to restart the engine?

@beryllw beryllw requested a review from wForget December 25, 2023 09:18
@wForget
Copy link
Member

wForget commented Dec 25, 2023

  1. describe the design and reason why we have to have restarting engine, which is not that reasonable to me

There are some related discussions in #5797 (comment)

is that reslaunching engine a sync operation

I think we should aim to make this a synchronous operation

and what happen if the restaring engine breaks the timeouts for either launching or session

I think it's similar to the error that occurs when opening a session

  1. authorization first. What happens if the current engine is used by other sessions even after deregisted. In what case and combination situation allows one to restart the engine?

The engine will go offline gracefully without affecting other sessions.

@beryllw beryllw changed the title [KYUUBI #5797] Support to describe engine and de-register engine with command in current session [KYUUBI #5797] Support to describe engine and restart engine with command in current session Dec 25, 2023
@beryllw
Copy link
Contributor Author

beryllw commented Dec 25, 2023

clarify the gap between description and implementation , as the title and description says de-register engine while it implements re-start engine

fixed

separate two features in each PR, which are not coupled with each other.

desc engine is simple, seems no need to separate

@beryllw beryllw requested a review from wForget December 25, 2023 09:56
@beryllw
Copy link
Contributor Author

beryllw commented Dec 26, 2023

Some errors occurred in the BatchesResource test, try to understand the relevant code to solve it.

@beryllw
Copy link
Contributor Author

beryllw commented Dec 29, 2023

  1. separate two features in each PR, which are not coupled with each other.

For restart engine not simple, i will separate two features in each PR.Support desc engine in #5931

When multi-threads use a session to submit operations, restart engine will close the current KyuubiSyncThriftClient session, and this will cause other operations of the client to fail.

The temporary purpose and requirements are #5797 (comment). I will design and implement in later. Are there any other supplementary scenarios and requirements?

@beryllw beryllw closed this Jan 11, 2024
@beryllw beryllw deleted the kyuubi_5797 branch April 30, 2024 05:51
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.

[FEATURE] Support to describe engine engine with command in current session

6 participants