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

add InteractiveSession and SessionManager #2290

Merged

Conversation

penghuo
Copy link
Collaborator

@penghuo penghuo commented Oct 12, 2023

Description

  1. add InteractiveSession and SessionManager

Issues Resolved

Phase 3. #2089

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Merging #2290 (9693f31) into main (b654e43) will increase coverage by 0.00%.
Report is 2 commits behind head on main.
The diff coverage is 96.87%.

@@            Coverage Diff             @@
##               main    #2290    +/-   ##
==========================================
  Coverage     96.60%   96.61%            
- Complexity     4738     4777    +39     
==========================================
  Files           442      449     +7     
  Lines         12741    12907   +166     
  Branches        876      882     +6     
==========================================
+ Hits          12309    12470   +161     
- Misses          424      429     +5     
  Partials          8        8            
Flag Coverage Δ
sql-engine 96.61% <96.87%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ql/spark/execution/session/InteractiveSession.java 100.00% <100.00%> (ø)
...nsearch/sql/spark/execution/session/SessionId.java 100.00% <100.00%> (ø)
...ch/sql/spark/execution/session/SessionManager.java 100.00% <100.00%> (ø)
...arch/sql/spark/execution/session/SessionState.java 100.00% <100.00%> (ø)
...earch/sql/spark/execution/session/SessionType.java 100.00% <100.00%> (ø)
...arch/sql/spark/execution/session/SessionModel.java 98.48% <98.48%> (ø)
.../spark/execution/statestore/SessionStateStore.java 87.50% <87.50%> (ø)

... and 1 file with indirect coverage changes

@penghuo penghuo self-assigned this Oct 12, 2023
@Data
public class CreateSessionRequest {
private final StartJobRequest startJobRequest;
private final String datasourceName;
Copy link
Member

Choose a reason for hiding this comment

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

Do we require datasourceName in asyncQuery Request model?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

datasourceName is write to Session doc in flint.ql.sessions index. it is required for user perform doc level access control.

Copy link
Member

Choose a reason for hiding this comment

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

I am actually asking for this api _plugins/_async_query. I think we need it.
Should we perform datasource authorization in both the calls?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. for create session, _plugins/_async_query/sessions, require datasource, address it in separate PR.
  2. we need datasource authZ for both _plugins/_async_query/sessions and _plugins/_async_query API.

public enum SessionState {
NOT_STARTED("not_started"),
RUNNING("running"),
DEAD("dead"),
Copy link
Member

Choose a reason for hiding this comment

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

Whats the difference between DEAD and FAILED?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • CLOSE_SESSION event transit state to DEAD.

  • SPARK_APP FINISH SUCCESS event transit state to DEAD.

  • SPARK_APP FINISH FAILED event transit state to FAILED

@Data
@Builder
public class SessionModel implements ToXContentObject {
public static final String VERSION = "version";
Copy link
Member

@vmmusings vmmusings Oct 13, 2023

Choose a reason for hiding this comment

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

What is the usecase for version here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In case schema upgrade.

.sessionStateStore(stateStore)
.serverlessClient(emrServerlessClient)
.sessionModel(model.get())
.build();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it ok that the session's createSessionRequest is not set?

Copy link
Collaborator Author

@penghuo penghuo Oct 13, 2023

Choose a reason for hiding this comment

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

dai-chen
dai-chen previously approved these changes Oct 13, 2023
Signed-off-by: Peng Huo <[email protected]>
@penghuo
Copy link
Collaborator Author

penghuo commented Oct 13, 2023

test passed
bwc test failed, sql-2.12 not ready yet.

@penghuo penghuo merged commit f856cb3 into opensearch-project:main Oct 13, 2023
17 of 21 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 13, 2023
* add InteractiveSession and SessionManager

Signed-off-by: Peng Huo <[email protected]>

* address comments

Signed-off-by: Peng Huo <[email protected]>

---------

Signed-off-by: Peng Huo <[email protected]>
(cherry picked from commit f856cb3)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
penghuo pushed a commit that referenced this pull request Oct 13, 2023
* add InteractiveSession and SessionManager



* address comments



---------


(cherry picked from commit f856cb3)

Signed-off-by: Peng Huo <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 17, 2023
* add InteractiveSession and SessionManager

* address comments

---------

(cherry picked from commit f856cb3)

Signed-off-by: Peng Huo <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit 79031a4)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
penghuo pushed a commit that referenced this pull request Oct 17, 2023
* add InteractiveSession and SessionManager

* address comments

---------

(cherry picked from commit f856cb3)




(cherry picked from commit 79031a4)

Signed-off-by: Peng Huo <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
vmmusings added a commit that referenced this pull request Nov 13, 2023
* Revert "Add more metrics and handle emr exception message (#2422) (#2426)"

This reverts commit b57f7cc.

* Revert "Block settings in sql query settings API and add more unit tests (#2407) (#2412)"

This reverts commit 3024737.

* Revert "Added session, statement, emrjob metrics to sql stats api (#2398) (#2400)"

This reverts commit 6e17ae6.

* Revert "Redefine Drop Index as logical delete (#2386) (#2397)"

This reverts commit e939bb6.

* Revert "add concurrent limit on datasource and sessions (#2390) (#2395)"

This reverts commit deb3ccf.

* Revert "Add Flint Index Purging Logic (#2372) (#2389)"

This reverts commit dd48b9b.

* Revert "Refactoring for tags usage in test files and also added explicit denly list setting. (#2383) (#2385)"

This reverts commit 37e010f.

* Revert "Enable session by default (#2373) (#2375)"

This reverts commit 7d95e4c.

* Revert "Create new session if client provided session is invalid (#2368) (#2371)"

This reverts commit 5ab7858.

* Revert "Add where clause support in create statement (#2366) (#2370)"

This reverts commit b620a56.

* Revert "create new session if current session not ready (#2363) (#2365)"

This reverts commit 5d07281.

* Revert "Handle Describe,Refresh and Show Queries Properly (#2357) (#2362)"

This reverts commit 16e2f30.

* Revert "Add Session limitation (#2354) (#2359)"

This reverts commit 0f334f8.

* Revert "Bug Fix, support cancel query in running state (#2351) (#2353)"

This reverts commit 9a40591.

* Revert "Fix bug, using basic instead of basicauth (#2342) (#2355)"

This reverts commit e4827a5.

* Revert "Add missing tags and MV support (#2336) (#2346)"

This reverts commit 8791bb0.

* Revert "[Backport 2.x] deprecated job-metadata-index (#2340) (#2343)"

This reverts commit bea432c.

* Revert "Integration with REPL Spark job (#2327) (#2338)"

This reverts commit 58a5ae5.

* Revert "Implement patch API for datasources (#2273) (#2329)"

This reverts commit 4c151fe.

* Revert "Add sessionId parameters for create async query API (#2312) (#2324)"

This reverts commit 3d1a376.

* Revert "Add Statement (#2294) (#2318) (#2319)"

This reverts commit b3c2e94.

* Revert "Upgrade json (#2307) (#2314)"

This reverts commit 6c65bb4.

* Revert "Minor Refactoring (#2308) (#2317)"

This reverts commit 051cc4f.

* Revert "add InteractiveSession and SessionManager (#2290) (#2293) (#2315)"

This reverts commit 6ac197b.

---------

Co-authored-by: Vamsi Manohar <[email protected]>
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.

4 participants