BTM
  1. BTM
  2. BTM-69

Prepare LRCXaResource although one of other resource prepare have failed.

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3.3
    • Fix Version/s: 2.0.0
    • Labels:
      None
    • Number of attachments :
      2

      Description

      Hello,

      I use LRCXADatasource for a non XADatasource in my project, but when I commit, if one of the other XADatasource fails in prepare phase, the prepare (so the commit) is still execute on the LRCXAResource : so I can't rollback it, because this resource was committed during prepare.

      Does I use it properly or is it a bug ?

      I thinks it's a bug because I see in AbstractPhaseEngine class, you run the prepare phase on all the resources (even LRC) before looking for errors :

      while (it.hasNext())

      { Object positionKey = it.next(); ... List resources; ... JobsExecutionReport report = runJobsForPosition(resources); ... }

      ... and then looking for errors, but it's too late.

      I'll propose to add a break in executePhase method of AbstractPhaseEngine class, like this :

      Iterator it = positions.iterator();
      while (it.hasNext()) {
      Object positionKey = it.next();

      List resources;
      if (reverse)

      { resources = resourceManager.getReverseOrderResourcesForPosition(positionKey); }

      else

      { resources = resourceManager.getNaturalOrderResourcesForPosition(positionKey); }

      if (log.isDebugEnabled()) log.debug("running " + resources.size() + " job(s) for position '" + positionKey + "'");
      JobsExecutionReport report = runJobsForPosition(resources);
      if (report.getExceptions().size() > 0)

      { if (log.isDebugEnabled()) log.debug(report.getExceptions().size() + " error(s) happened during execution of position '" + positionKey + "'"); positionErrorReports.add(report); break; }

      if (log.isDebugEnabled()) log.debug("ran " + resources.size() + " job(s) for position '" + positionKey + "'");
      }

      Is this correct ?

      Quentin.

      1. BTM-69.patch
        0.7 kB
        Quentin Devriendt
      2. BTM-69-test.patch
        6 kB
        Quentin Devriendt

        Activity

        Hide
        Quentin Devriendt added a comment -

        Adds JUnit Test case.

        Show
        Quentin Devriendt added a comment - Adds JUnit Test case.
        Hide
        Ludovic Orban added a comment -

        Patch reviewed and applied, thanks!

        Show
        Ludovic Orban added a comment - Patch reviewed and applied, thanks!

          People

          • Assignee:
            Ludovic Orban
            Reporter:
            Quentin Devriendt
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: