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 missing refactoring of Scroll to PIT API calls for Joins and Pagination query #2981

Merged
merged 6 commits into from
Sep 23, 2024

Conversation

manasvinibs
Copy link
Member

@manasvinibs manasvinibs commented Sep 4, 2024

Description

To-Do:

  • Currently task :opensearch:jacocoTestCoverageVerification is failing. Will add more tests to increase coverage

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

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.

@@ -182,7 +182,7 @@ public void validTotalResultWithAndWithoutPaginationOrderBy() throws IOException
String selectQuery =
StringUtils.format(
"SELECT firstname, state FROM %s ORDER BY balance DESC ", TEST_INDEX_ACCOUNT);
verifyWithAndWithoutPaginationResponse(selectQuery + " LIMIT 2000", selectQuery, 26, false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I forgot whether this class is the main IT for pagination? Is the new PIT logic enabled to test now?

Copy link
Member Author

Choose a reason for hiding this comment

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

This class is only responsible for legacy/v1 engine pagination queries. For v2 engine queries, there is a different base class. Currently, integ-test cluster does not set the feature flag settings and by default the cluster settings will have PIT feature flag enabled/set to true. Hence there are around 80+ tests testing new PIT changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not urgent but I think it would be helpful to get the IT run with PIT and Scroll both. In case we need to rollback to Scroll if anything wrong.

Copy link
Member Author

@manasvinibs manasvinibs Sep 23, 2024

Choose a reason for hiding this comment

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

Actually we are not disabling/removing Scroll implementation. There is a cluster level settings called SQL_PAGINATION_API_SEARCH_AFTER which is set to true to use PIT or false to default to Scroll API. So current IT tests run based on the setting of the above key and it covers both Scroll and PIT.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you mean the same IT set run 1 pass for PIT and another pass for Scroll?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh you meant running 2 passes of same set of tests for both PIT and Scroll? Ok I think that can be done by modifying the integ-test cluster settings as required. But currently we do not explicitly set the API settings in the test-cluster, so by default PIT changes are covered as part of IT tests and only 1 pass is run. I'll add this as part of the changes here - #2945

Signed-off-by: Manasvini B S <[email protected]>
Signed-off-by: Manasvini B S <[email protected]>
/** Indicate the search already done. */
private boolean searchDone = false;

private String pitId;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a new PIT request class instead? I think all the conditional check added make this class hard to maintain.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've captured this improvement as part of this issue -#2945

}
}

private OpenSearchRequest buildRequestWithPit(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This method seems a copy of the original buildRequestWithScroll? I think the only difference is at 119 and 134 which decides to create a Scroll request or PIT request (if you added a new class)

Copy link
Member Author

Choose a reason for hiding this comment

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

I've an issue created related to the improvements in branching strategy we have today for PIT and Scroll and its related implementation. This and the above comment can be addressed as part of this task: #2945
Let me know if you think this is a blocking comment. If not I would like to get this addressed as part of the other task to reduce duplicate effort.

@ykmr1224 ykmr1224 merged commit ce17d0a into opensearch-project:main Sep 23, 2024
13 of 15 checks passed
@manasvinibs manasvinibs added the v2.18.0 Issues targeting release v2.18.0 label Sep 23, 2024
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.x
# Create a new branch
git switch --create backport/backport-2981-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ce17d0a385d2d231f405fb8fcd8c27cf046cf2ac
# Push it to GitHub
git push --set-upstream origin backport/backport-2981-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-2981-to-2.x.

Swiddis pushed a commit to Swiddis/sql that referenced this pull request Oct 23, 2024
…nation query (opensearch-project#2981)

* Adding PIT for pagination queries in new SQL engine code paths

Signed-off-by: Manasvini B S <[email protected]>

* Fix legacy code using scroll API instead of PIT for batch physical operator

Signed-off-by: Manasvini B S <[email protected]>

* Fix local debugger issue

Signed-off-by: Manasvini B S <[email protected]>

* Refactor integ-tests data for PIT and fix unit tests

Signed-off-by: Manasvini B S <[email protected]>

* Address feedback comments

Signed-off-by: Manasvini B S <[email protected]>

* Adding test coverage

Signed-off-by: Manasvini B S <[email protected]>

---------

Signed-off-by: Manasvini B S <[email protected]>
Swiddis pushed a commit to Swiddis/sql that referenced this pull request Oct 23, 2024
…nation query (opensearch-project#2981)

* Adding PIT for pagination queries in new SQL engine code paths

Signed-off-by: Manasvini B S <[email protected]>

* Fix legacy code using scroll API instead of PIT for batch physical operator

Signed-off-by: Manasvini B S <[email protected]>

* Fix local debugger issue

Signed-off-by: Manasvini B S <[email protected]>

* Refactor integ-tests data for PIT and fix unit tests

Signed-off-by: Manasvini B S <[email protected]>

* Address feedback comments

Signed-off-by: Manasvini B S <[email protected]>

* Adding test coverage

Signed-off-by: Manasvini B S <[email protected]>

---------

Signed-off-by: Manasvini B S <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.18 failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/sql/backport-2.18 2.18
# Navigate to the new working tree
pushd ../.worktrees/sql/backport-2.18
# Create a new branch
git switch --create backport/backport-2981-to-2.18
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 ce17d0a385d2d231f405fb8fcd8c27cf046cf2ac
# Push it to GitHub
git push --set-upstream origin backport/backport-2981-to-2.18
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/sql/backport-2.18

Then, create a pull request where the base branch is 2.18 and the compare/head branch is backport/backport-2981-to-2.18.

Swiddis added a commit that referenced this pull request Oct 23, 2024
* Adding PIT for pagination queries in new SQL engine code paths



* Fix legacy code using scroll API instead of PIT for batch physical operator



* Fix local debugger issue



* Refactor integ-tests data for PIT and fix unit tests



* Address feedback comments



* Adding test coverage



---------

Signed-off-by: Manasvini B S <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Co-authored-by: Manasvini B Suryanarayana <[email protected]>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 23, 2024
* Adding PIT for pagination queries in new SQL engine code paths

* Fix legacy code using scroll API instead of PIT for batch physical operator

* Fix local debugger issue

* Refactor integ-tests data for PIT and fix unit tests

* Address feedback comments

* Adding test coverage

---------

Signed-off-by: Manasvini B S <[email protected]>
Signed-off-by: Simeon Widdis <[email protected]>
Co-authored-by: Manasvini B Suryanarayana <[email protected]>
(cherry picked from commit f6ca54c)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Swiddis pushed a commit that referenced this pull request Oct 23, 2024
* Adding PIT for pagination queries in new SQL engine code paths

* Fix legacy code using scroll API instead of PIT for batch physical operator

* Fix local debugger issue

* Refactor integ-tests data for PIT and fix unit tests

* Address feedback comments

* Adding test coverage

---------




(cherry picked from commit f6ca54c)

Signed-off-by: Manasvini B S <[email protected]>
Signed-off-by: Simeon Widdis <[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>
Co-authored-by: Manasvini B Suryanarayana <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x feature v2.18.0 Issues targeting release v2.18.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants