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

Validate session with flint datasource passed in async job request #2448

Merged
merged 3 commits into from
Dec 6, 2023

Conversation

kaituo
Copy link
Contributor

@kaituo kaituo commented Dec 1, 2023

Description

Currently, if there's a session running with Datasource1 and the user makes a request to the async API with the same session but a different catalog Datasource2 then SQL plugin doesn't return a new session for Datasource2. This PR creates a new session when there’s a mismatch between datasource and session_id.

Testing done:

  1. manual testing
  2. added IT.

Issues Resolved

#2432

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.

Copy link

codecov bot commented Dec 1, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (60058ce) 95.40% compared to head (3b15f84) 95.40%.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2448   +/-   ##
=========================================
  Coverage     95.40%   95.40%           
- Complexity     4992     5000    +8     
=========================================
  Files           478      479    +1     
  Lines         13917    13939   +22     
  Branches        933      937    +4     
=========================================
+ Hits          13277    13299   +22     
  Misses          618      618           
  Partials         22       22           
Flag Coverage Δ
sql-engine 95.40% <100.00%> (+<0.01%) ⬆️

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

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

Currently, if there's a session running with Datasource1 and the user makes a request to the async API with the same session but a different catalog Datasource2 then SQL plugin doesn't return a new session for Datasource2. This PR creates a new session when there’s a mismatch between datasource and session_id.

Testing done:
1. manual testing
2. added IT.

Signed-off-by: Kaituo Li <kaituo@amazon.com>
ps48
ps48 previously approved these changes Dec 2, 2023
* @return An Optional containing the session associated with the provided session ID. If no
* session is found that matches the session ID, an empty Optional is returned.
*/
public Optional<Session> getSession(SessionId sid) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

it is only for testing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

if yes, add an annotation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is used by other src code. Not only for testing.

Signed-off-by: Kaituo Li <kaituo@amazon.com>
penghuo
penghuo previously approved these changes Dec 5, 2023
@penghuo
Copy link
Collaborator

penghuo commented Dec 5, 2023

Signed-off-by: Kaituo Li <kaituo@amazon.com>
@kaituo
Copy link
Contributor Author

kaituo commented Dec 5, 2023

@penghuo penghuo merged commit 0176525 into opensearch-project:main Dec 6, 2023
21 of 23 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 6, 2023
…2448)

* Validate session with flint datasource passed in async job request

Currently, if there's a session running with Datasource1 and the user makes a request to the async API with the same session but a different catalog Datasource2 then SQL plugin doesn't return a new session for Datasource2. This PR creates a new session when there’s a mismatch between datasource and session_id.

Testing done:
1. manual testing
2. added IT.

Signed-off-by: Kaituo Li <kaituo@amazon.com>

* address comments

Signed-off-by: Kaituo Li <kaituo@amazon.com>

* add doc

Signed-off-by: Kaituo Li <kaituo@amazon.com>

---------

Signed-off-by: Kaituo Li <kaituo@amazon.com>
(cherry picked from commit 0176525)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
penghuo pushed a commit that referenced this pull request Dec 6, 2023
…2448) (#2450)

* Validate session with flint datasource passed in async job request

Currently, if there's a session running with Datasource1 and the user makes a request to the async API with the same session but a different catalog Datasource2 then SQL plugin doesn't return a new session for Datasource2. This PR creates a new session when there’s a mismatch between datasource and session_id.

Testing done:
1. manual testing
2. added IT.



* address comments



* add doc



---------


(cherry picked from commit 0176525)

Signed-off-by: Kaituo Li <kaituo@amazon.com>
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>
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.

3 participants