Skip to content

Add new setting to ignore pagination where it is unsupported in V2.#318

Merged
Yury-Fridlyand merged 4 commits intointeg-ignore-pagination-switchfrom
dev-ignore-pagination-switch
Aug 18, 2023
Merged

Add new setting to ignore pagination where it is unsupported in V2.#318
Yury-Fridlyand merged 4 commits intointeg-ignore-pagination-switchfrom
dev-ignore-pagination-switch

Conversation

@Yury-Fridlyand
Copy link
Copy Markdown

@Yury-Fridlyand Yury-Fridlyand commented Aug 1, 2023

Description

Changes how pagination requests with unsupported/incompatible [with pagination] queries are handled.
Adds new setting plugins.query.ignore_unsupported_pagination:

  1. true by default
  2. when true such requests are performed without pagination
  3. when false such requests fall back to legacy engine

Misc changes:

  1. Minor logging improvements
  2. Minor doc grooming
  3. Use pagination in correctness test
curl -X PUT localhost:9200/_cluster/settings?pretty -H "Content-Type: application/json" -d '{ "transient": { "plugins.query.ignore_unsupported_pagination": true } }'

Issues Resolved

opensearch-project#1765, opensearch-project#78

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
Copy Markdown

codecov bot commented Aug 1, 2023

Codecov Report

❗ No coverage uploaded for pull request base (integ-ignore-pagination-switch@bb3c340). Click here to learn what that means.
The diff coverage is n/a.

@@                        Coverage Diff                        @@
##             integ-ignore-pagination-switch     #318   +/-   ##
=================================================================
  Coverage                                  ?   97.52%           
  Complexity                                ?     4656           
=================================================================
  Files                                     ?      408           
  Lines                                     ?    11963           
  Branches                                  ?      830           
=================================================================
  Hits                                      ?    11667           
  Misses                                    ?      289           
  Partials                                  ?        7           
Flag Coverage Δ
sql-engine 97.52% <0.00%> (?)

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

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@matthewryanwells
Copy link
Copy Markdown

Maybe update the PR description to include an example showing how you change/set the new setting. Also I noticed how the setting can be changed when making an opensearch request but how would I change the setting if I wanted to make it through the opensearchsql plugin?

@Yury-Fridlyand
Copy link
Copy Markdown
Author

Updated

QUERY_SIZE_LIMIT("plugins.query.size_limit"),
ENCYRPTION_MASTER_KEY("plugins.query.datasources.encryption.masterkey"),
DATASOURCES_URI_ALLOWHOSTS("plugins.query.datasources.uri.allowhosts"),
IGNORE_UNSUPPORTED_PAGINATION("plugins.query.ignore_unsupported_pagination"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

does this only affect sql request? Maybe plugins.sql.ignore_unsupported_pagination or plugins.sql.cursor.ignore_unsupported?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It affects all pagination requests, but we support pagination in SQL only for now.
I can easily rename the setting.

Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
@Yury-Fridlyand Yury-Fridlyand force-pushed the dev-ignore-pagination-switch branch from 2d33f53 to 9ba8341 Compare August 17, 2023 23:49
Signed-off-by: Yury-Fridlyand <yury.fridlyand@improving.com>
}

protected static JSONObject updateClusterSettings(ClusterSetting setting) throws IOException {
public static JSONObject updateClusterSettings(ClusterSetting setting) throws IOException {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why does this need to be made public? It's being called by ITs that extend this class.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I use it in correctness test, which does not inherit this class.

}

protected static class ClusterSetting {
public static class ClusterSetting {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ditto

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I use it in correctness test, which does not inherit this class.

l -> l.endsWith("Request is not supported and falling back to old SQL engine")));
logSize = lines.size();

updateClusterSettings(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

feels like these should be two different tests

@Override
protected void init() throws Exception {
super.init();
updateClusterSettings(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is this needed? I feel like this is unnecessary for the tests to pass.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It it true by default, but previous test may set it to false.

}
LOG.info("[{}] Request {} is not supported and falling back to old SQL engine",
QueryContext.getRequestId(), newSqlRequest);
LOG.info("[{}] Request is not supported and falling back to old SQL engine",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It was dumping non anonymized query

===============================

OpenSearch SQL enables you to extract insights out of OpenSearch using the familiar SQL query syntax. Please refer to the `technical documentation <https://docs-beta.opensearch.org/>`_ for detailed information on installing and configuring opendistro-elasticsearch-sql plugin. In this user reference manual, you can find many information for your reference. In each part, we try to make it clear by adding work example along with detailed description. Here is table of contents of the documentation:
OpenSearch SQL enables you to extract insights out of OpenSearch using the familiar SQL query syntax. Please refer to the `technical documentation <https://opensearch.org/docs/latest/install-and-configure/plugins/>`_ for detailed information on installing and configuring SQL plugin. In this user reference manual, you can find many information for your reference. In each part, we try to make it clear by adding work example along with detailed description. Here is table of contents of the documentation:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

❤️

@Yury-Fridlyand Yury-Fridlyand merged commit 1bb815b into integ-ignore-pagination-switch Aug 18, 2023
@Yury-Fridlyand Yury-Fridlyand deleted the dev-ignore-pagination-switch branch August 18, 2023 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants