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

Async query get result bug fix #2443

Merged
merged 12 commits into from
Dec 1, 2023

Conversation

dai-chen
Copy link
Collaborator

@dai-chen dai-chen commented Nov 29, 2023

Description

Followed option 2 in #2436 (comment). Consider query statement complete and successful only if statement state is SUCCESS and query result is available (searchable). Please see more details in the issue comment.

Changes:

  1. Changed template workflow in abstract class AsyncQueryHandler and subclass as needed
  2. Moved mock index class in IndexQuerySpecTest up to parent class so new IT in this PR can use it.

Issues Resolved

#2436, #2439

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.

Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen added the bug Something isn't working label Nov 29, 2023
@dai-chen dai-chen self-assigned this Nov 29, 2023
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (2c230be) 95.39% compared to head (52499af) 95.40%.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2443   +/-   ##
=========================================
  Coverage     95.39%   95.40%           
- Complexity     4990     4992    +2     
=========================================
  Files           478      478           
  Lines         13910    13917    +7     
  Branches        932      933    +1     
=========================================
+ Hits          13270    13277    +7     
  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.

Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen changed the title Successful statement with NULL result bug fix Async query get result bug fix Nov 30, 2023
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen
Copy link
Collaborator Author

dai-chen commented Dec 1, 2023

The failed CI seems not relevant. It keeps failing on retry and failed in main branch as well.

Signed-off-by: Chen Dai <daichen@amazon.com>
// Consider statement still running if result doc created in submit() is not available yet
JSONObject result = new JSONObject();
result.put(STATUS_FIELD, StatementState.RUNNING.getState());
result.put(ERROR_FIELD, "");
Copy link
Member

Choose a reason for hiding this comment

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

is the error field mandatory even if there is no error ?

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 getAsyncQueryResults() API code, it always fetch status and error field from what is returned here. Although it uses optString, I thought it maybe more clear to pass it here.

Copy link
Member

@YANG-DB YANG-DB left a comment

Choose a reason for hiding this comment

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

see comments below

Signed-off-by: Chen Dai <daichen@amazon.com>
@dai-chen dai-chen requested review from penghuo and YANG-DB December 1, 2023 21:31
@dai-chen dai-chen merged commit 60058ce into opensearch-project:main Dec 1, 2023
20 of 22 checks passed
@dai-chen dai-chen deleted the get-query-result-bug-fix branch December 1, 2023 21:56
opensearch-trigger-bot bot pushed a commit that referenced this pull request Dec 1, 2023
* Add IT to reproduce the bug first

Signed-off-by: Chen Dai <daichen@amazon.com>

* Modify IT as temporary reproduce commit

Signed-off-by: Chen Dai <daichen@amazon.com>

* Fix issue by preferred option and modify IT

Signed-off-by: Chen Dai <daichen@amazon.com>

* Refactor IT with fluent assertion

Signed-off-by: Chen Dai <daichen@amazon.com>

* Add IT for batch query handler

Signed-off-by: Chen Dai <daichen@amazon.com>

* Add IT for streaming query handler

Signed-off-by: Chen Dai <daichen@amazon.com>

* Add more IT for normal case

Signed-off-by: Chen Dai <daichen@amazon.com>

* Add IT for drop index

Signed-off-by: Chen Dai <daichen@amazon.com>

* Consider drop statement running if result doc unavailable

Signed-off-by: Chen Dai <daichen@amazon.com>

* Fix broken UT

Signed-off-by: Chen Dai <daichen@amazon.com>

* Address PR comments

Signed-off-by: Chen Dai <daichen@amazon.com>

* Address PR comments

Signed-off-by: Chen Dai <daichen@amazon.com>

---------

Signed-off-by: Chen Dai <daichen@amazon.com>
(cherry picked from commit 60058ce)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
dai-chen pushed a commit that referenced this pull request Dec 1, 2023
* Add IT to reproduce the bug first



* Modify IT as temporary reproduce commit



* Fix issue by preferred option and modify IT



* Refactor IT with fluent assertion



* Add IT for batch query handler



* Add IT for streaming query handler



* Add more IT for normal case



* Add IT for drop index



* Consider drop statement running if result doc unavailable



* Fix broken UT



* Address PR comments



* Address PR comments



---------


(cherry picked from commit 60058ce)

Signed-off-by: Chen Dai <daichen@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
Labels
backport 2.x bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants