Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-17839

Improve semantics of implicit txn management for async transactions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-beta1
    • None
    • New API for async implicit transactions: runInTransactionAsync
    • Docs Required, Release Notes Required

    Description

      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);

      Attachments

        Issue Links

          Activity

            People

              ascherbakov Alexey Scherbakov
              ascherbakov Alexey Scherbakov
              Alexander Lapin Alexander Lapin
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h
                  2h