Uploaded image for project: 'CDAP'
  1. CDAP
  2. CDAP-14858

TransactionRunner error handling is difficult

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 6.2.0
    • Component/s: Datasets
    • Labels:
      None
    • Rank:
      1|i00ktj:

      Description

      The TransactionRunner only throws a TransactionException.

      However, the StructuredTableContext used inside the TransactionRunner.run() method throws a bunch of different types of checked exceptions, such as IOException, TableNotFoundException, etc.

      If the caller wants to react to specific types of exceptions by the TxRunnable, it needs to catch the TransactionException, check if the cause is null, check the type of the cause, then react accordingly. In order to handle things properly, callers basically have to use the TransactionRunners helper class. Just calling run() basically means you're not handling errors correctly.

      It seems like it makes sense to either:

      1. Move TransactionRunners into the storage-spi module, or
      2. Move the helper methods directly into the TransactionRunner API.

        Attachments

          Activity

            People

            • Assignee:
              trishka Trishka
              Reporter:
              ashau Albert Shau
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: