mirror of https://github.com/apache/nifi.git
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:
parent
99c7fe3b44
commit
1149bc61cb
|
@ -230,6 +230,14 @@ public abstract class BinFiles extends AbstractSessionFactoryProcessor {
|
||||||
}
|
}
|
||||||
session.rollback();
|
session.rollback();
|
||||||
return 1;
|
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
|
// we first commit the bundle's session before the originals' sessions because if we are restarted or crash
|
||||||
|
|
Loading…
Reference in New Issue