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

SQL: Deprecate index_include_frozen request parameter and FROZEN keyword #83943

Merged
merged 11 commits into from
Feb 23, 2022

Conversation

Luegg
Copy link
Contributor

@Luegg Luegg commented Feb 15, 2022

Resolves #81939 (part of #70192)

Deprecates the index_include_frozen REST parameter in the /_sql endpoint and all the syntax including the FROZEN keyword.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-ql (Team:QL)

@elasticsearchmachine
Copy link
Collaborator

Hi @Luegg, I've created a changelog YAML for you. Note that since this PR is labelled >deprecation, you need to update the changelog YAML to fill out the extended information sections.

@Luegg Luegg marked this pull request as draft February 15, 2022 13:53
@Luegg
Copy link
Contributor Author

Luegg commented Feb 16, 2022

@elasticmachine run elasticsearch-ci/part-2

@Luegg Luegg removed the v7.17.1 label Feb 16, 2022
@Luegg Luegg changed the title SQL: Deprecate index_include_frozen request parameter SQL: Deprecate index_include_frozen request parameter and FROZEN keyword Feb 16, 2022
@elasticsearchmachine
Copy link
Collaborator

Hi @Luegg, I've updated the changelog YAML for you. Note that since this PR is labelled >deprecation, you need to update the changelog YAML to fill out the extended information sections.

Copy link
Member

@costin costin left a comment

Choose a reason for hiding this comment

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

Could you please add a test (to assert that the warning doesn't reach the driver)?
There needs to be a follow-up to plug the warnings to both JDBC and ODBC since said mechanism is not in place (and likely that might affect the communication protocol).

LGTM.

@costin
Copy link
Member

costin commented Feb 17, 2022

Worth checking and doing a similar PR for EQL.

@Luegg
Copy link
Contributor Author

Luegg commented Feb 21, 2022

Could you please add a test (to assert that the warning doesn't reach the driver)?

Do you mean to assert that the Warning header is not set for request using JDBC/ODBC/CLI mode? Or just asserting it's not passed through as a warning to the JDBC interface?

@Luegg
Copy link
Contributor Author

Luegg commented Feb 21, 2022

Worth checking and doing a similar PR for EQL.

As far as I can tell, EQL does not support frozen indices.

@Luegg
Copy link
Contributor Author

Luegg commented Feb 23, 2022

@elasticmachine run elasticsearch-ci/part-2

Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

Looks good. Left some comments.

import java.sql.ResultSet;
import java.sql.Statement;

public class JdbcWarningsIT extends JdbcIntegrationTestCase {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for having this test only in single_node scenario? With regards to multi_node it's probably not worth considering it, but how about the security tests suite?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 I also saw that this test is better put to the JDBC test cases in org.elasticsearch.xpack.sql.qa.jdbc instead of org.elasticsearch.xpack.sql.qa

testFrozenSyntaxIsDeprecated("SELECT * FROM FROZEN test", "FROZEN");
}

public void testFrozenSyntaxIsDeprecated(String query, String syntax) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

private?

);
}

public void testDeprecationWarning(RequestObjectBuilder query, String warning) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

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

private?

private static final String FROZEN_DEPRECATION_WARNING = "[{}] syntax is deprecated because frozen indices have been deprecated. "
+ "Consider cold or frozen tiers in place of frozen indices.";

protected void warnDeprecatedFrozenSyntax(boolean includeFrozen, String syntax) {
Copy link
Contributor

Choose a reason for hiding this comment

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

A better name for this method is maybeWarnDeprecatedFrozenSyntax since the logic on issuing the message depends on the value of the parameter. Or, keep the same name, but move the if (includeFrozen) decision to the calling code.

@Luegg Luegg requested a review from astefan February 23, 2022 12:27
Copy link
Contributor

@astefan astefan left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you

@Luegg Luegg added auto-backport-and-merge Automatically create backport pull requests and merge when ready auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Feb 23, 2022
@elasticsearchmachine elasticsearchmachine merged commit 7900a0b into elastic:master Feb 23, 2022
@Luegg Luegg deleted the deprecate/frozen branch February 23, 2022 13:43
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

The backport operation could not be completed due to the following error:
An unexpected error occurred when attempting to backport this PR.

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 83943

Luegg pushed a commit to Luegg/elasticsearch that referenced this pull request Feb 23, 2022
…yword (elastic#83943)

Resolves elastic#81939 (part of
elastic#70192)

Deprecates the `index_include_frozen` REST parameter in the `/_sql`
endpoint and all the syntax including the `FROZEN` keyword.
# Conflicts:
#	x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/LogicalPlanBuilder.java
elasticsearchmachine pushed a commit that referenced this pull request Feb 23, 2022
…yword (#83943) (#84298)

Resolves #81939 (part of
#70192)

Deprecates the `index_include_frozen` REST parameter in the `/_sql`
endpoint and all the syntax including the `FROZEN` keyword.
# Conflicts:
#	x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/parser/LogicalPlanBuilder.java
probakowski pushed a commit to probakowski/elasticsearch that referenced this pull request Feb 23, 2022
…yword (elastic#83943)

Resolves elastic#81939 (part of
elastic#70192)

Deprecates the `index_include_frozen` REST parameter in the `/_sql`
endpoint and all the syntax including the `FROZEN` keyword.
elasticsearchmachine pushed a commit that referenced this pull request Mar 15, 2022
Follow up on #83943 to
ensure that users of the JDBC drivers also can act on the warnings.

The change ensures that warnings in the response headers from the `_sql`
API are available in `JdbcResultSet.getWarnings()`.
Luegg pushed a commit to Luegg/elasticsearch that referenced this pull request Mar 15, 2022
Follow up on elastic#83943 to
ensure that users of the JDBC drivers also can act on the warnings.

The change ensures that warnings in the response headers from the `_sql`
API are available in `JdbcResultSet.getWarnings()`.
elasticsearchmachine pushed a commit that referenced this pull request Mar 15, 2022
* SQL: forward warning headers to JDBC driver (#84499)

Follow up on #83943 to
ensure that users of the JDBC drivers also can act on the warnings.

The change ensures that warnings in the response headers from the `_sql`
API are available in `JdbcResultSet.getWarnings()`.

* fix version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/SQL SQL querying auto-backport-and-merge Automatically create backport pull requests and merge when ready auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >deprecation Team:QL (Deprecated) Meta label for query languages team v8.1.1 v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL: Deprecation warning when querying a frozen index or listing frozen indices
6 participants