denis-chudov commented on code in PR #3511: URL: https://github.com/apache/ignite-3/pull/3511#discussion_r1631109543
########## modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/tx/QueryTransactionWrapperImpl.java: ########## @@ -42,6 +56,10 @@ public InternalTransaction unwrap() { @Override public CompletableFuture<Void> commitImplicit() { + if (transaction.isReadOnly() && committedImplicit.compareAndSet(false, true)) { Review Comment: `getOrStartImplicit` and `commitImplicit` are called inside of SQL code every time when cursor is opened/closed respectively. `getOrStartImplicit` may use an existing txn or start a new one. `commitImplicit` is always used only to commit the explicit transaction on cursor close. It is no-op for explicit txns, but anyway it's called every time when cursor is closed. Unfortunately `commitImplicit` is idempotent and SQL code relies on this fact, `removeInflight` is not - it throws assertion if there are no more inflights. So we would have assertion errors in SQL code without this CAS. Also, `commitImplicit` is not no-op for explicit txns now: it should remove inflights on cursor close for both explicit and implicit RO txns. -- 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org