Skip to content

Commit

Permalink
Revert "Enable session by default (opensearch-project#2373) (opensear…
Browse files Browse the repository at this point in the history
…ch-project#2375)"

This reverts commit 7d95e4c.
  • Loading branch information
vamsi-amazon committed Nov 13, 2023
1 parent 02abfa7 commit 17a1b0f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 48 deletions.
8 changes: 4 additions & 4 deletions docs/user/admin/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ plugins.query.executionengine.spark.session.enabled
Description
-----------

By default, execution engine is executed in session mode. You can disable session mode by this setting.
By default, execution engine is executed in job mode. You can enable session mode by this setting.

1. The default value is true.
1. The default value is false.
2. This setting is node scope.
3. This setting can be updated dynamically.

Expand All @@ -328,7 +328,7 @@ You can update the setting with a new value like this.
SQL query::

sh$ curl -sS -H 'Content-Type: application/json' -X PUT localhost:9200/_plugins/_query/settings \
... -d '{"transient":{"plugins.query.executionengine.spark.session.enabled":"false"}}'
... -d '{"transient":{"plugins.query.executionengine.spark.session.enabled":"true"}}'
{
"acknowledged": true,
"persistent": {},
Expand All @@ -338,7 +338,7 @@ SQL query::
"executionengine": {
"spark": {
"session": {
"enabled": "false"
"enabled": "true"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public class OpenSearchSettings extends Settings {
public static final Setting<?> SPARK_EXECUTION_SESSION_ENABLED_SETTING =
Setting.boolSetting(
Key.SPARK_EXECUTION_SESSION_ENABLED.getKeyValue(),
true,
false,
Setting.Property.NodeScope,
Setting.Property.Dynamic);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ public class StateStore {
public static String SETTINGS_FILE_NAME = "query_execution_request_settings.yml";
public static String MAPPING_FILE_NAME = "query_execution_request_mapping.yml";
public static Function<String, String> DATASOURCE_TO_REQUEST_INDEX =
datasourceName ->
String.format(
"%s_%s", SPARK_REQUEST_BUFFER_INDEX_NAME, datasourceName.toLowerCase(Locale.ROOT));
datasourceName -> String.format("%s_%s", SPARK_REQUEST_BUFFER_INDEX_NAME, datasourceName);

private static final Logger LOG = LogManager.getLogger();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import lombok.Getter;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.opensearch.action.search.SearchRequest;
import org.opensearch.action.search.SearchResponse;
Expand Down Expand Up @@ -213,6 +212,9 @@ public void withSessionCreateAsyncQueryThenGetResultThenCancel() {
AsyncQueryExecutorService asyncQueryExecutorService =
createAsyncQueryExecutorService(emrsClient);

// enable session
enableSession(true);

// 1. create async query.
CreateAsyncQueryResponse response =
asyncQueryExecutorService.createAsyncQuery(
Expand Down Expand Up @@ -313,9 +315,6 @@ public void interactiveQueryNoTimeout() {
assertEquals(0L, (long) emrsClient.getJobRequest().executionTimeout());
}

@Ignore(
"flaky test, java.lang.IllegalArgumentException: Right now only AES/GCM/NoPadding is"
+ " supported")
@Test
public void datasourceWithBasicAuth() {
Map<String, String> properties = new HashMap<>();
Expand Down Expand Up @@ -481,42 +480,6 @@ public void submitQueryInInvalidSessionWillCreateNewSession() {
assertNotEquals(invalidSessionId.getSessionId(), asyncQuery.getSessionId());
}

@Test
public void datasourceNameIncludeUppercase() {
dataSourceService.createDataSource(
new DataSourceMetadata(
"TESTS3",
DataSourceType.S3GLUE,
ImmutableList.of(),
ImmutableMap.of(
"glue.auth.type",
"iam_role",
"glue.auth.role_arn",
"arn:aws:iam::924196221507:role/FlintOpensearchServiceRole",
"glue.indexstore.opensearch.uri",
"http://localhost:9200",
"glue.indexstore.opensearch.auth",
"noauth"),
null));

LocalEMRSClient emrsClient = new LocalEMRSClient();
AsyncQueryExecutorService asyncQueryExecutorService =
createAsyncQueryExecutorService(emrsClient);

// enable session
enableSession(true);

CreateAsyncQueryResponse response =
asyncQueryExecutorService.createAsyncQuery(
new CreateAsyncQueryRequest("select 1", "TESTS3", LangType.SQL, null));
String params = emrsClient.getJobRequest().getSparkSubmitParams();

assertNotNull(response.getSessionId());
assertTrue(
params.contains(
"--conf spark.sql.catalog.TESTS3=org.opensearch.sql.FlintDelegatingSessionCatalog"));
}

private DataSourceServiceImpl createDataSourceService() {
String masterKey = "a57d991d9b573f75b9bba1df";
DataSourceMetadataStorage dataSourceMetadataStorage =
Expand Down

0 comments on commit 17a1b0f

Please sign in to comment.