> On Aug. 20, 2017, 6:56 p.m., Madhan Neethiraj wrote:
> > repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
> > Lines 742 (patched)
> > <https://reviews.apache.org/r/61526/diff/2/?file=1800434#file1800434line742>
> >
> >     Ensure that references are resolved when typeRegistry updates are made. 
> > Whenever *NoRefResolve() methods are used to update the registry, ensure to 
> > run typeRegistry.resolveReferences() at the end of updates. You can see 
> > references in number of methods in AtlasTransientTypeRegistry - like 
> > addTypes(), updateTypes().
> >     
> >     Calling resolveReferences() outside of AtlasTransientTypeRegistry is 
> > asking for trouble, as the would modify the type instance which might be 
> > used in other threads.
> >     
> >     @Sarath - it might be worth removing "public" access to 
> > AtlasType.resolveReferences() to avoid possible misuse like here.
> 
> David Radley wrote:
>     This was existing code, in this case we get the classificationtype by 
> name, but because it is cached in the registry without resolve references 
> being run then I cannot interrogate entitytypes. The only other way I can see 
> to avoid running the resolve references here is to cache the 
> classificationtype having already run resolve references ( i.e. by running 
> the other AtlasclassificationType constructor); as there is quite a lot of 
> code effected here - please let me know if this is what you are suggesting or 
> you are thinking of something else.
> 
> David Radley wrote:
>     It would be really useful for me to know under what circumstances we 
> should cache ClassificationDefs without running resolve references; as I do 
> not what to compomise any existing logic with my change or do unnecessary 
> resolve references in those cases.
> 
> Madhan Neethiraj wrote:
>     >> It would be really useful for me to know under what circumstances we 
> should cache ClassificationDefs without running resolve references
>     
>     Any change to type registry *must* not be treated complete without 
> running resolveReferences. AtlasTypeRegistry and all types/typeDefs contained 
> within it must be treated as *read-only*. Changes should be done only via 
> methods in AtlasTransientTypeRegistry. It will be useful to look into 
> existing methods that modify the type registry. In anycase, it is never a 
> good idea to run AtlasType.resolveReferences() out side of 
> AtlasTransientTypeRegistry methods.
> 
> David Radley wrote:
>     Hi Madhan,
>     Thanks - I am not very familiar with this part of the Atlas architecture; 
> I am not finding it easy to work out the design I need from the existing 
> code. In the addClassification case, I only want to interrogate the 
> classificationtype for validation reasons; I am not looking to update it. I 
> see AtlasTransientTypeRegistry used as part of the update of Defs - this is 
> not my case. The AtlasEntityStoreV1 does not currently use 
> AtlasTransientTypeRegistry. As far as I can see the entity updates use 
> EntityGraphDiscovery. I am looking for more detailed direction from you to 
> ensure my changes are consistent with the Atlas architecture. It looks like 
> the AtlasClassificationType constructor that passes a registry is only used 
> by test methods and is not appropriate to add to the cache. I am missing 
> something in my understanding - can you point me in the right direction :-),  
>  David.

Hi Madhan, 
I think I have worked out what I need to do, no need to respond to my last 
update,  David.


- David


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61526/#review183296
-----------------------------------------------------------


On Sept. 1, 2017, 9:50 a.m., David Radley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/61526/
> -----------------------------------------------------------
> 
> (Updated Sept. 1, 2017, 9:50 a.m.)
> 
> 
> Review request for atlas, Graham Wallis, Madhan Neethiraj, and Sarath 
> Subramanian.
> 
> 
> Repository: atlas
> 
> 
> Description
> -------
> 
> ATLAS-2029: Restrict entities, classifications can be applied to
> 
> 
> Diffs
> -----
> 
>   intg/src/main/java/org/apache/atlas/AtlasErrorCode.java 
> 2503d8ef203cf4efbe15b440257b1da2252b6153 
>   
> intg/src/main/java/org/apache/atlas/model/typedef/AtlasClassificationDef.java 
> eeaf71413a56c08db8170fd3323b8e8245ae44fe 
>   intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java 
> cc3e45ed2f059ad0c5731dc1da7e592d139c3e7a 
>   intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java 
> 28215fd2aa33ec8011f6900b68c672b685053e7a 
>   intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java 
> ab063e23e355f74668af389b97f7da03b2a8f90f 
>   intg/src/test/java/org/apache/atlas/TestUtilsV2.java 
> fc65af057255b4c17378080ee4fb7cbfc780c3fe 
>   intg/src/test/java/org/apache/atlas/type/TestAtlasClassificationType.java 
> aaf4a6ac0a978e5eb6de41279cae1b1c82373374 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
>  e3aa4e0b2317bec47426a914f6feae68b17851dd 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1.java
>  1c168b4cff0d105c7a0d4a9fbdb50871388c917e 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasGraphUtilsV1.java
>  227f7cd12a9b23c3bbc1cfdc40d06616ea775ca4 
>   
> repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasTypeDefGraphStoreV1.java
>  f639ea56e6188837e069a5fcba953d9d196af0e5 
>   
> repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStoreTest.java
>  8638a7f17e8a17d3a6e0bfb94879b5c5406be1a3 
>   
> repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1Test.java
>  62fad5b02a7229d9bc3083690980eb063756bc29 
> 
> 
> Diff: https://reviews.apache.org/r/61526/diff/3/
> 
> 
> Testing
> -------
> 
> Testing
> performed unit tests
> 
> Using postman
> 1) create an entityDef  aaa
> 2) create a classificationDef with an entitytype  aaaa - checked that it is 
> in the response
> 3) Create a entity instance of aaa
> 4) add the classification to it
> 5) Create an entity instance with a different type bbbb
> 6) Attempt to add the classification to bbbb. this fails with an informative 
> message
> 7) Attempt to update the ClassificationDef to remove the entity type - this 
> fails with an informative message
> 8) Attempt to update the classificationdef to add bbbb. this update works. 
> 9) Attempt to add an entity type that does not exist to the 
> ClassificationDef. this should fail.  
> 10) Attempt to update an entity type that does not exist to the 
> ClassificationDef. this should fail.
> 
> 
> Thanks,
> 
> David Radley
> 
>

Reply via email to