-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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: Replace the scroll with PIT for data batching #62488
Conversation
This commit migrates the ScrollCursor and CompositeAggCursor cursors and their dependencies away from using the scroll API to using the new PIT feature.
REST-closing a cursor after resultset exhaustion no longer needs to be done "manually", this is taken care by the cursor implementation.
Implicit grouping queries are one-shot requests, no pagination every needed, so don't start a PIT for them.
PIT won't (can't) keep the state of last served document when paginating with search_after. In order to correctly paginate also in cases when the sorting order is not done by a strictly monotone criterion (missing or repeating values, script-sorting), we need to have the _doc part of the (returned/reused) sorting key.
Fix test after upstream merge.
Rework ResultCursor class to correct the tracking of the "after" map for comp. aggs.
PIT doesn't seem to bind the user, as the scroll does -- disable the test supposed to fail on user A employing the PIT generated by user B.
@elasticmachine update branch |
s/@Ignore/@AwaitsFix
- further translation tests fixes. - remove PIT keep_alive value from first SQL request PIT object.
The resuming of an order request needs to take into account the _index as well for the case the queried "table" is an alias.
@elasticmachine update branch |
Update translation tests with new sorting source, _index.
Unlike the scroll, the PIT can be shared by multiple users, so this test becomes obsolete.
@elasticmachine update branch |
Pinging @elastic/es-ql (:Query Languages/SQL) |
Map<String, Object> response = runSql( | ||
new StringEntity(cursor(cursor).toString(), ContentType.APPLICATION_JSON), | ||
"/close", | ||
Mode.PLAIN.toString() | ||
); | ||
assertEquals(true, response.get("succeeded")); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer required, the SearchHit cursor wasn't properly auto-closed on result set exhaustion, but it is now.
@@ -49,7 +49,7 @@ static int remainingData(boolean hasNextPage, int size, int limit) { | |||
if (hasNextPage == false) { | |||
return 0; | |||
} else { | |||
int remainingLimit = (limit == -1) ? limit : ((limit - size) >= 0 ? (limit - size) : 0); | |||
int remainingLimit = limit == -1 ? limit : Math.max(limit - size, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change done to compact the expression and match the similar construct in the constructor (above).
PointInTimeBuilder is now a stand-alone class.
Hi @bpintea, I've created a changelog YAML for you. |
This PR will replace usage of the scroll API in the SQL module with the new point-in-time API.
Closes #61873