[
https://issues.apache.org/jira/browse/NIFI-6420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904143#comment-16904143
]
ASF subversion and git services commented on NIFI-6420:
-------------------------------------------------------
Commit 35d79eaf0fbd2361b3950a8417cb5f5b82d8cd44 in nifi's branch
refs/heads/master from Alessandro D'Armiento
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=35d79ea ]
NIFI-6420 Controller Service references not properly tracked if multiple
references from same component
<h1>Changes</h1>
- Instead of keeping a Set of referencing `ComponentNode`, keep instead a Map
which stores, for each referencing component, also the name of the property for
which the service is referenced
- This is done to keep the `addReference()` idempotent
- `StandardControllerService.referencingComponents` changed from HashSet to
HashMap
- `Key` is the combination of `ComponentNode.hashCode()` and property name
- `Value` is the referencing `ComponentNode`
- `ControllerServiceNode.addReference()` now requires a tuple (referring
`ComponentNode`, property name)
- `ControllerServiceNode.removeReference()` now requires a tuple (referring
`ComponentNode`, property name)
- `ControllerServiceNode.getReferences()` signature is left untouched, when
it's called, the values of the `referencingComponents` map are turned into a
Set, meaning a referencing component will keep being returned by this method
until at least one of its properties still reference the `ControllerService`
- `StandardSchedulingContext.leaseControllerService()` uses a dedicated constant
- `FrameworkIntegrationTest` has a test which create a processor with two
optional controller service properties and then verifies that having them
referencing and dereferencing the same controller service doesn't cause the
reported bug anymore
Removed SchedulingContext from ClojureScriptEngineConfigurator
Co-Authored-By: Marco Gaido <[email protected]>
Signed-off-by: Mark Payne <[email protected]>
This closes #3600.
> Controller Service references not properly tracked if multiple references
> from same component
> ---------------------------------------------------------------------------------------------
>
> Key: NIFI-6420
> URL: https://issues.apache.org/jira/browse/NIFI-6420
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Reporter: Mark Payne
> Priority: Major
> Labels: cleanup, codesmell, refactor
> Time Spent: 3.5h
> Remaining Estimate: 0h
>
> The StandardControllerServiceNode keeps track of any references to it via
> `addReference` and `removeReference` methods. However, if a Processor (or
> another Controller Service) has two different properties that reference the
> service, then the references can become incorrect.
> This is due to the fact that when Properties are set for a component, we
> determine that Property A previously referenced Service 123 but no longer
> does and call `removeReference` on Service 123. However, if Property B also
> is referencing Service 123, we have a condition where the Processor is
> referencing Service 123, but Service 123 does not know about it, because of
> the call to `removeReference`.
> We should either be storing references as a `List` in
> `StandardControllerServiceNode` or else should determine whether or not all
> references have been removed before calling `removeReference`. I suspect that
> the latter is less error-prone, given that calls to `addReference` currently
> are idempotent and changing the data structure to a `List` would mean that
> the method is no longer idempotent.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)