You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Alexey Scherbakov (Jira)" <ji...@apache.org> on 2022/10/06 15:34:00 UTC

[jira] [Created] (IGNITE-17839) Improve semantics of implicit txn management for async transactions

Alexey Scherbakov created IGNITE-17839:
------------------------------------------

             Summary: Improve semantics of implicit txn management for async transactions
                 Key: IGNITE-17839
                 URL: https://issues.apache.org/jira/browse/IGNITE-17839
             Project: Ignite
          Issue Type: Improvement
            Reporter: Alexey Scherbakov
             Fix For: 3.0


There is a usability issue for transaction implicit management API.

For async transaction tx.commit must be called after all async ops are enlisted to the transaction. This is a responsibility of a user in case of explicit management.

But, for implicit management, tx.commit must be called automatically. This is not generally not possible for async flows, because by the end of a closure some operations are not yet started.

The example:

runInTransactionAsync(tx -> {
    return opAsync().thenComposeAsync(res -> otherOpAsync());
})

We can fix this by introducing async context for implicit management and require a user to return last completion stage in the chain, like:

<T> CompletableFuture<T> runInTransactionAsync(Function<Transaction, CompletableFuture<T>> clo);



--
This message was sent by Atlassian Jira
(v8.20.10#820010)