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 inflights. So we will have assertion errors in SQL code without
this CAS.
--
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]