Open dmcassel opened 3 years ago
Based on ticket 91 in marklogic/nifi, my understanding is that an FF gets "stuck" in a queue at least in the scenario where a call is made to session.commit() without first setting a destination relationship on the incoming FF.
FF's don't get a relationship in PutML until onBatchSuccess or onBatchFailure is called by WriteBatcher. I don't know what NiFi does when a user stops a processor that is processing FFs. I'm guessing that the session perhaps becomes invalid, such that PutML isn't able to transfer the incoming FFs to a destination, and thus they become stuck.
PutML does have a completeWriteBatcherJob method with annotations of OnStopped and OnShutdown, which will flush the WriteBatcher, which then leads to onBatchSuccess being called. But still, not clear what the state of the NiFi session is at that point.
There are times when I've had to terminate a MarkLogic processor (definitely PutMarkLogic and I believe ExecuteScriptMarkLogic as well). This happens when I've told the processor to Stop, but it doesn't. Any flow files that the processor has pulled from the upstream queue but not yet routed somewhere become ghost flow files. That is, they will be included in the count in the upstream queue, but otherwise NiFi does not acknowledge them. They won't show up when looking at the list of flow files in the queue and emptying the queue won't affect them. The only way to remedy this situation is to restart NiFi.
I'm not sure what happens in a processor when it gets sent a terminate signal, so I'm unsure about the solution to this. It's a little tricky to reproduce. Filing in the hopes that others can add more detail.