[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2023-03-21 Thread Nissim Shiman (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17703273#comment-17703273
 ] 

Nissim Shiman commented on NIFI-7123:
-

Thank you [~markap14] for the background information and the best practices 
pattern to deal with situation.

At this point this is looking like maybe a tweak to the api document just to 
clarify that it is meant to always run on startup.

Thank you for your comment!

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2023-03-20 Thread Mark Payne (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17702906#comment-17702906
 ] 

Mark Payne commented on NIFI-7123:
--

[~Nissim Shiman] I believe this has been encountered before. But we did not 
change the way that it works, because we didn't want to break backward 
compatibility. Often, the logic assumes that the {{onPropertyModified}} will be 
called on startup. So, typically, the pattern that is followed is something 
like this:
{code:java}
private volatile configurationRestored = false;

@OnConfigurationRestored
public void onConfigurationRestored() {
  this.configurationRestored = true;
}

public void onPropertyModified(PropertyDescriptor descriptor, String oldValue, 
String newValue) {
  if (!configurationRestored) {
return;
  }
}{code}
So effectively, ignore the call to {{onPropertyModified}} until the 
configuration has been restored on startup.

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2020-02-12 Thread Nissim Shiman (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17035736#comment-17035736
 ] 

Nissim Shiman commented on NIFI-7123:
-

More details as to where this is biting us:

Currently on startup  controller services are getting NullPointerException when 
this code is run through at nifi startup.

These are custom controller services, whose properties still have the default 
values, that are overriding/implementing the onPropertyModified()  

The issue is, that on startup, when onPropertyModified() is run, the oldValue 
[1] is null, even when using default Values

Left as is, the only option is to do a notNull check for the oldValue in each 
of the onPropertyModified()'s to avoid the exception


[1] 
https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Assignee: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2020-02-11 Thread Nissim Shiman (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17034740#comment-17034740
 ] 

Nissim Shiman commented on NIFI-7123:
-

If this is considered an issue, it won't be  big deal to fix (i.e. minimal 
touching of core code)

It will just need the following around the onPropertyModified() [1]  :
 if (!(descriptor.getDefaultValue().equals(effectiveValue) && oldValue == 
null)) {}


[1]https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java#L366

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Assignee: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2020-02-10 Thread Nissim Shiman (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17034032#comment-17034032
 ] 

Nissim Shiman commented on NIFI-7123:
-

Sounds good

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Assignee: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2020-02-10 Thread Joe Witt (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17034031#comment-17034031
 ] 

Joe Witt commented on NIFI-7123:


Lets leave it open and see what others think too.  You have a point either way

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Assignee: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2020-02-10 Thread Nissim Shiman (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17034027#comment-17034027
 ] 

Nissim Shiman commented on NIFI-7123:
-

We were seeing the onPropertyModified() being run when we hadn't changed any 
properties, so I thought it was an issue.

I guess it can be a feature as opposed to a bug, though.

Maybe the doc could be updated to reflect this :
[https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L55]
  (i.e. take out the part where it is called for "each property that is not set 
to the default value" as it is called even when the property is still the 
default value)

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Assignee: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2020-02-10 Thread Joe Witt (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17034014#comment-17034014
 ] 

Joe Witt commented on NIFI-7123:


it isnt clear we should consider this a bug.  can you describe what is 
happening as a result of this that leads you to want it changed?

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Assignee: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (NIFI-7123) onPropertyModified() is called on nifi start up even when properties have never been modified

2020-02-10 Thread Nissim Shiman (Jira)


[ 
https://issues.apache.org/jira/browse/NIFI-7123?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17034011#comment-17034011
 ] 

Nissim Shiman commented on NIFI-7123:
-

Most controller services/processors don't override this method so there is no 
issues in those cases.

> onPropertyModified() is called on nifi start up even when properties have 
> never been modified
> -
>
> Key: NIFI-7123
> URL: https://issues.apache.org/jira/browse/NIFI-7123
> Project: Apache NiFi
>  Issue Type: Bug
>Affects Versions: 1.11.0
>Reporter: Nissim Shiman
>Assignee: Nissim Shiman
>Priority: Major
>
> Processors and Controller Services inherit the onPropertyModified() method 
> from ConfigurableComponent. java [1]
> This method is called when nifi starts for all processors and controller 
> services, even for properties that are set to their defaults (i.e. have never 
> been modified).
> [1]  
> https://github.com/apache/nifi/blob/master/nifi-api/src/main/java/org/apache/nifi/components/ConfigurableComponent.java#L68



--
This message was sent by Atlassian Jira
(v8.3.4#803005)