You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by olegz <gi...@git.apache.org> on 2016/07/08 02:15:42 UTC

[GitHub] nifi issue #617: NIFI-826 Added deterministic template support

Github user olegz commented on the issue:

    https://github.com/apache/nifi/pull/617
  
    Quick design notes:
    
    The implementation is primarily based on utilizing time-based (Type-1) UUID since NiFi and all of its components has already embraced UUID as identifier.
    It is also based on recognizing that UUID is a 128-bits two-part value (_lsb_ and _msb_ - see UUID javadoc for more details) essentially able to hold (with a bit of an effort) two fairly unique identifiers allowing it to hold
    - inception ID - immutable ID of the component regardless how many times it was re-created
    - instance ID - unique identifier of a component instance.
    
    When component is created for the first time the _inception ID_ (i.e., time) is created from the current time while _instance ID_ remain random. The combination of two will result in the typical UUID ```c81f6810-0155-1000-0000-c4af042cb1559```. The _msb_  ```c81f6810-0155-1000-0000``` represents the time the component was created while the _lsb_ ```c4af042cb1559``` represents the instance id.
    
    The above essentially addresses the original discussion in the JIRA about having two IDs. 
    However, in addition and given that this new ID is Type 1 UUID (time-based), the components are now deterministically sortable based on their IDs.
    
    Last but not least, when components are persisted to the template, the _instance ID_ is removed while _inception ID_ remains essentially preserving all the connectivity between the components while elimination the ID changes to the same component every time it is saved. Using the above example, the serialized ID of the above component will be ```c81f6810-0155-1000-0000-0000000000000```
    
    @mcgilman  - As you and I discussed there were an issue with imported templates honoring the original coordinates of the components. The way I fixed it is by removing some of the code (see https://github.com/apache/nifi/pull/617/commits/a52092513b15f2e3ea860ba909f8e59d4bf96be1#diff-a5bebdfe7bb8de673ac07570539e68e3R82), but I'm not sure if it's right, so would be nice to have your eyes on it.
    
    To validate simply export multiple templates from the same flow with/without changes and execute 'diff\u2019 on it. You should only see what was changed.
    
    I\u2019ll be adding few tests as well.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---