Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
We have several cases where Processor implement logic in `onPropertyModified` so that if a Property of interest has its value changed, we set a flag that indicates that state must be cleared. Then, in an `@OnScheduled` method, we clear the state as appropriate. This is problematic for a couple of reasons:
- It's easy to get the logic incorrect. If this is on in `onTrigger` for instance, it can result in state being inadvertently cleared when Primary Node changes.
- It's been implemented a few different times across different components, which means that clearing of the state may be a good feature to implement at the framework level.
- NIFI-2592 aims to address the fact that we call `@OnScheduled` method on nodes that are not the Primary Node. If this changes, the current algorithm will start to cause state to be inadvertently cleared.
So, I recommend adding a new method to the `PropertyDescriptor.Builder`:
Builder clearStateOnChange(Scope... scope);
Then, a component can simply indicate in the Property Descriptor that any changes to the property value requires that the component's state be cleared. The given argument for `Scope` indicates whether LOCAL state, CLUSTER state, both, or neither should be cleared, defaulting to neither (an empty array).
Attachments
Issue Links
- is related to
-
NIFI-2592 Processor still runs @OnScheduled method when it's running on a non-primary node
- Open