NIFI-1572: Ensure that if an Exception is thrown when processing a bin, all sessions involved are rolled back or otherwise accounted for

This commit is contained in:
Mark Payne 2016-02-29 10:43:27 -05:00
parent 99c7fe3b44
commit 1149bc61cb
1 changed files with 8 additions and 0 deletions

View File

@ -230,6 +230,14 @@ public abstract class BinFiles extends AbstractSessionFactoryProcessor {
}
session.rollback();
return 1;
} catch (final Exception e) {
logger.error("Failed to process bundle of {} files due to {}; rolling back sessions", new Object[] {binCopy.size(), e});
for (final FlowFileSessionWrapper wrapper : binCopy) {
wrapper.getSession().rollback();
}
session.rollback();
return 1;
}
// we first commit the bundle's session before the originals' sessions because if we are restarted or crash