korlov42 commented on code in PR #2965:
URL: https://github.com/apache/ignite-3/pull/2965#discussion_r1434108405
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java:
##########
@@ -835,7 +851,42 @@ CompletableFuture<AsyncSqlCursor<InternalSqlRow>>
processNext() {
// Try to rollback script managed transaction, if any.
txCtx.rollbackUncommitted();
} else {
- taskExecutor.execute(this::processNext);
+ CompletableFuture<Void> triggerFuture;
+ ScriptStatement nextStatement = statements.peek();
+
+ if (txWrapper == null) {
+ // tx is started already, no need to wait
+ triggerFuture = nullCompletedFuture();
+ } else if (txWrapper.implicit()) {
+ if (cursor.queryType() != SqlQueryType.QUERY) {
+ // any query apart from type of QUERY returns
at most a single row, so
+ // it should be safe to commit transaction
prematurely after receiving
+ // `firstPageReady` signal, since all sources
have been processed
+ triggerFuture =
cursor.onFirstPageReady().thenCompose(none -> txWrapper.commitImplicit());
Review Comment:
make sense, thanks! I've also added assertion to be 100% sure a first page
is ready
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]