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

Revert commits back to after 2.11 release #2427

Merged
merged 24 commits into from
Nov 13, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7e2d764
Revert "Add more metrics and handle emr exception message (#2422) (#2…
vmmusings Nov 13, 2023
9318c6c
Revert "Block settings in sql query settings API and add more unit te…
vmmusings Nov 13, 2023
aba6b88
Revert "Added session, statement, emrjob metrics to sql stats api (#2…
vmmusings Nov 13, 2023
728eed2
Revert "Redefine Drop Index as logical delete (#2386) (#2397)"
vmmusings Nov 13, 2023
7675008
Revert "add concurrent limit on datasource and sessions (#2390) (#2395)"
vmmusings Nov 13, 2023
6f7dd96
Revert "Add Flint Index Purging Logic (#2372) (#2389)"
vmmusings Nov 13, 2023
02abfa7
Revert "Refactoring for tags usage in test files and also added expli…
vmmusings Nov 13, 2023
17a1b0f
Revert "Enable session by default (#2373) (#2375)"
vmmusings Nov 13, 2023
13da524
Revert "Create new session if client provided session is invalid (#23…
vmmusings Nov 13, 2023
d049134
Revert "Add where clause support in create statement (#2366) (#2370)"
vmmusings Nov 13, 2023
719934e
Revert "create new session if current session not ready (#2363) (#2365)"
vmmusings Nov 13, 2023
2fad890
Revert "Handle Describe,Refresh and Show Queries Properly (#2357) (#2…
vmmusings Nov 13, 2023
d420e73
Revert "Add Session limitation (#2354) (#2359)"
vmmusings Nov 13, 2023
4a1566d
Revert "Bug Fix, support cancel query in running state (#2351) (#2353)"
vmmusings Nov 13, 2023
11d351f
Revert "Fix bug, using basic instead of basicauth (#2342) (#2355)"
vmmusings Nov 13, 2023
268b08d
Revert "Add missing tags and MV support (#2336) (#2346)"
vmmusings Nov 13, 2023
a20d458
Revert "[Backport 2.x] deprecated job-metadata-index (#2340) (#2343)"
vmmusings Nov 13, 2023
a0114f4
Revert "Integration with REPL Spark job (#2327) (#2338)"
vmmusings Nov 13, 2023
ab12221
Revert "Implement patch API for datasources (#2273) (#2329)"
vmmusings Nov 13, 2023
b9e8910
Revert "Add sessionId parameters for create async query API (#2312) (…
vmmusings Nov 13, 2023
77af17c
Revert "Add Statement (#2294) (#2318) (#2319)"
vmmusings Nov 13, 2023
3ca6a9a
Revert "Upgrade json (#2307) (#2314)"
vmmusings Nov 13, 2023
da7f82e
Revert "Minor Refactoring (#2308) (#2317)"
vmmusings Nov 13, 2023
e6eac9b
Revert "add InteractiveSession and SessionManager (#2290) (#2293) (#2…
vmmusings Nov 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Create new session if client provided session is invalid (#2368
…) (#2371)"

This reverts commit 5ab7858.
vmmusings committed Nov 13, 2023
commit 13da52495f10ea2d1ed9ac5ac1a91d838eeef09f
Original file line number Diff line number Diff line change
@@ -219,9 +219,10 @@ private DispatchQueryResponse handleNonIndexQuery(DispatchQueryRequest dispatchQ
// get session from request
SessionId sessionId = new SessionId(dispatchQueryRequest.getSessionId());
Optional<Session> createdSession = sessionManager.getSession(sessionId);
if (createdSession.isPresent()) {
session = createdSession.get();
if (createdSession.isEmpty()) {
throw new IllegalArgumentException("no session found. " + sessionId);
}
session = createdSession.get();
}
if (session == null || !session.isReady()) {
// create session if not exist or session dead/fail
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ public class StatementModel extends StateModel {
public static final String QUERY_ID = "queryId";
public static final String SUBMIT_TIME = "submitTime";
public static final String ERROR = "error";
public static final String UNKNOWN = "";
public static final String UNKNOWN = "unknown";
public static final String STATEMENT_DOC_TYPE = "statement";

private final String version;
Original file line number Diff line number Diff line change
@@ -45,7 +45,6 @@
import org.opensearch.common.settings.ClusterSettings;
import org.opensearch.common.settings.Setting;
import org.opensearch.common.settings.Settings;
import org.opensearch.core.common.Strings;
import org.opensearch.index.query.QueryBuilder;
import org.opensearch.index.query.QueryBuilders;
import org.opensearch.plugins.Plugin;
@@ -228,7 +227,6 @@ public void withSessionCreateAsyncQueryThenGetResultThenCancel() {
// 2. fetch async query result.
AsyncQueryExecutionResponse asyncQueryResults =
asyncQueryExecutorService.getAsyncQueryResults(response.getQueryId());
assertTrue(Strings.isEmpty(asyncQueryResults.getError()));
assertEquals(StatementState.WAITING.getState(), asyncQueryResults.getStatus());

// 3. cancel async query.
@@ -462,22 +460,24 @@ public void recreateSessionIfNotReady() {
}

@Test
public void submitQueryInInvalidSessionWillCreateNewSession() {
public void submitQueryInInvalidSessionThrowException() {
LocalEMRSClient emrsClient = new LocalEMRSClient();
AsyncQueryExecutorService asyncQueryExecutorService =
createAsyncQueryExecutorService(emrsClient);

// enable session
enableSession(true);

// 1. create async query with invalid sessionId
SessionId invalidSessionId = SessionId.newSessionId(DATASOURCE);
CreateAsyncQueryResponse asyncQuery =
asyncQueryExecutorService.createAsyncQuery(
new CreateAsyncQueryRequest(
"select 1", DATASOURCE, LangType.SQL, invalidSessionId.getSessionId()));
assertNotNull(asyncQuery.getSessionId());
assertNotEquals(invalidSessionId.getSessionId(), asyncQuery.getSessionId());
// 1. create async query.
SessionId sessionId = SessionId.newSessionId(DATASOURCE);
IllegalArgumentException exception =
assertThrows(
IllegalArgumentException.class,
() ->
asyncQueryExecutorService.createAsyncQuery(
new CreateAsyncQueryRequest(
"select 1", DATASOURCE, LangType.SQL, sessionId.getSessionId())));
assertEquals("no session found. " + sessionId, exception.getMessage());
}

private DataSourceServiceImpl createDataSourceService() {
Original file line number Diff line number Diff line change
@@ -327,6 +327,26 @@ void testDispatchSelectQueryReuseSession() {
Assertions.assertEquals(MOCK_SESSION_ID, dispatchQueryResponse.getSessionId());
}

@Test
void testDispatchSelectQueryInvalidSession() {
String query = "select * from my_glue.default.http_logs";
DispatchQueryRequest queryRequest = dispatchQueryRequestWithSessionId(query, "invalid");

doReturn(true).when(sessionManager).isEnabled();
doReturn(Optional.empty()).when(sessionManager).getSession(any());
DataSourceMetadata dataSourceMetadata = constructMyGlueDataSourceMetadata();
when(dataSourceService.getRawDataSourceMetadata("my_glue")).thenReturn(dataSourceMetadata);
doNothing().when(dataSourceUserAuthorizationHelper).authorizeDataSource(dataSourceMetadata);
IllegalArgumentException exception =
Assertions.assertThrows(
IllegalArgumentException.class, () -> sparkQueryDispatcher.dispatch(queryRequest));

verifyNoInteractions(emrServerlessClient);
verify(sessionManager, never()).createSession(any());
Assertions.assertEquals(
"no session found. " + new SessionId("invalid"), exception.getMessage());
}

@Test
void testDispatchSelectQueryFailedCreateSession() {
String query = "select * from my_glue.default.http_logs";