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

Workflow fails if it uses a FileSet (or other dataset that is not tx-aware)

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.1
    • Fix Version/s: 3.2.2
    • Component/s: Datasets, Workflow
    • Labels:
    • Release Notes:
      Fixed a problem that caused a Workflow to fail if datasets were used in custom actions.
    • Rank:
      1|hzz3bz:

      Description

      The workflow driver creates a transaction context from all the datasets it has declared. However, it should not add datasets that are no TransactionAware, such as FileSet. It causes this exception:

      Exception in thread "WorkflowDriver" java.lang.ClassCastException: co.cask.cdap.data2.dataset2.lib.file.FileSetDataset cannot be cast to co.cask.tephra.TransactionAware
      at co.cask.cdap.internal.app.runtime.workflow.WorkflowDriver.getTransactionContextFromContext(WorkflowDriver.java:295)
      at co.cask.cdap.internal.app.runtime.workflow.WorkflowDriver.initializeInTransaction(WorkflowDriver.java:327)
      at co.cask.cdap.internal.app.runtime.workflow.WorkflowDriver.initialize(WorkflowDriver.java:508)
      at co.cask.cdap.internal.app.runtime.workflow.WorkflowDriver.executeAction(WorkflowDriver.java:234)
      at co.cask.cdap.internal.app.runtime.workflow.WorkflowDriver.executeNode(WorkflowDriver.java:397)
      2015-11-17 09:43:35,561 - INFO  [WorkflowDriver:c.c.c.i.a.r.w.WorkflowProgramController$1@98] - Workflow service failed from RUNNING. Un-registering service 
      

      The fix is easy: line 495 of WorkflowDriver:

        private TransactionContext getTransactionContextFromContext(WorkflowContext context) {
          TransactionContext transactionContext = new TransactionContext(txClient);
          Collection<Dataset> datasets = ((BasicWorkflowContext) context).getDatasets().values();
          for (Dataset ds : datasets) {
            transactionContext.addTransactionAware((TransactionAware) ds);
          }
          return transactionContext;
        }
      

      add a check for (ds instanceof TransactionAware).

      I believe that this is fixed in develop as part of CDAP-961, but in the current released version 3.2.1, it fails the workflow.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                andreas Andreas Neumann
                Reporter:
                andreas Andreas Neumann
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: