-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: Deprecate index_include_frozen request parameter and
FROZEN
ke…
…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
- Loading branch information
Lukas Wegmann
authored
Feb 23, 2022
1 parent
472a5ed
commit cabb749
Showing
10 changed files
with
201 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
pr: 83943 | ||
summary: Deprecate `index_include_frozen` request parameter | ||
area: SQL | ||
type: deprecation | ||
issues: | ||
- 81939 | ||
deprecation: | ||
title: Deprecate `index_include_frozen` request parameter in `_sql` API | ||
area: REST API | ||
details: |- | ||
Following the deprecation of frozen indices, the `index_include_frozen` | ||
parameter and `FROZEN` syntax is now also deprecated. | ||
impact: |- | ||
You should unfreeze frozen indices using the | ||
{ref}/unfreeze-index-api.html[unfreeze index API] and stop using the | ||
`index_include_frozen` parameter or the `FROZEN` keyword in SQL | ||
queries. For some use cases, the frozen tier may be a suitable | ||
replacement for frozen indices. See {ref}/data-tiers.html[data tiers] | ||
for more information. |
34 changes: 34 additions & 0 deletions
34
...c/security/src/test/java/org/elasticsearch/xpack/sql/qa/jdbc/security/JdbcWarningsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.sql.qa.jdbc.security; | ||
|
||
import org.elasticsearch.common.settings.Settings; | ||
import org.elasticsearch.xpack.sql.qa.jdbc.JdbcWarningsTestCase; | ||
|
||
import java.util.Properties; | ||
|
||
public class JdbcWarningsIT extends JdbcWarningsTestCase { | ||
|
||
@Override | ||
protected Settings restClientSettings() { | ||
return JdbcConnectionIT.securitySettings(); | ||
} | ||
|
||
@Override | ||
protected String getProtocol() { | ||
return JdbcConnectionIT.SSL_ENABLED ? "https" : "http"; | ||
} | ||
|
||
@Override | ||
protected Properties connectionProperties() { | ||
Properties properties = super.connectionProperties(); | ||
properties.putAll(JdbcSecurityUtils.adminProperties()); | ||
return properties; | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...le-node/src/test/java/org/elasticsearch/xpack/sql/qa/jdbc/single_node/JdbcWarningsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.sql.qa.jdbc.single_node; | ||
|
||
import org.elasticsearch.xpack.sql.qa.jdbc.JdbcWarningsTestCase; | ||
|
||
public class JdbcWarningsIT extends JdbcWarningsTestCase {} |
25 changes: 25 additions & 0 deletions
25
...n/sql/qa/jdbc/src/main/java/org/elasticsearch/xpack/sql/qa/jdbc/JdbcWarningsTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.sql.qa.jdbc; | ||
|
||
import java.sql.Connection; | ||
import java.sql.ResultSet; | ||
import java.sql.Statement; | ||
|
||
public abstract class JdbcWarningsTestCase extends JdbcIntegrationTestCase { | ||
|
||
public void testDeprecationWarningsDoNotReachJdbcDriver() throws Exception { | ||
index("test_data", b -> b.field("foo", 1)); | ||
|
||
try (Connection connection = esJdbc(); Statement statement = connection.createStatement()) { | ||
ResultSet rs = statement.executeQuery("SELECT * FROM FROZEN \"test_*\""); | ||
assertNull(rs.getWarnings()); | ||
} | ||
} | ||
|
||
} |
63 changes: 63 additions & 0 deletions
63
...e-node/src/test/java/org/elasticsearch/xpack/sql/qa/single_node/RestSqlDeprecationIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.sql.qa.single_node; | ||
|
||
import org.apache.http.entity.ContentType; | ||
import org.apache.http.entity.StringEntity; | ||
import org.elasticsearch.client.Request; | ||
import org.elasticsearch.xpack.sql.qa.rest.BaseRestSqlTestCase; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.elasticsearch.xpack.sql.qa.rest.RestSqlTestCase.SQL_QUERY_REST_ENDPOINT; | ||
|
||
public class RestSqlDeprecationIT extends BaseRestSqlTestCase { | ||
|
||
public void testIndexIncludeParameterIsDeprecated() throws IOException { | ||
testDeprecationWarning( | ||
query("SELECT * FROM test").mode(randomMode()).indexIncludeFrozen(randomBoolean()), | ||
"[index_include_frozen] parameter is deprecated because frozen indices have been deprecated. Consider cold or frozen tiers " | ||
+ "in place of frozen indices." | ||
); | ||
} | ||
|
||
public void testIncludeFrozenSyntaxIsDeprecatedInShowTables() throws IOException { | ||
testFrozenSyntaxIsDeprecated("SHOW TABLES INCLUDE FROZEN", "INCLUDE FROZEN"); | ||
} | ||
|
||
public void testIncludeFrozenSyntaxIsDeprecatedInShowColumns() throws IOException { | ||
testFrozenSyntaxIsDeprecated("SHOW COLUMNS INCLUDE FROZEN IN test", "INCLUDE FROZEN"); | ||
} | ||
|
||
public void testIncludeFrozenSyntaxIsDeprecatedInDescribeTable() throws IOException { | ||
testFrozenSyntaxIsDeprecated("DESCRIBE INCLUDE FROZEN test", "INCLUDE FROZEN"); | ||
} | ||
|
||
public void testFrozenSyntaxIsDeprecatedInFromClause() throws IOException { | ||
testFrozenSyntaxIsDeprecated("SELECT * FROM FROZEN test", "FROZEN"); | ||
} | ||
|
||
private void testFrozenSyntaxIsDeprecated(String query, String syntax) throws IOException { | ||
testDeprecationWarning( | ||
query(query).mode(randomMode()), | ||
"[" | ||
+ syntax | ||
+ "] syntax is deprecated because frozen indices have been deprecated. " | ||
+ "Consider cold or frozen tiers in place of frozen indices." | ||
); | ||
} | ||
|
||
private void testDeprecationWarning(RequestObjectBuilder query, String warning) throws IOException { | ||
index("{\"foo\": 1}"); | ||
|
||
Request request = new Request("POST", SQL_QUERY_REST_ENDPOINT); | ||
request.setEntity(new StringEntity(query.toString(), ContentType.APPLICATION_JSON)); | ||
request.setOptions(expectWarnings(warning)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters