You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Sarath Subramanian <sa...@apache.org> on 2020/02/03 06:38:58 UTC

Re: Review Request 72060: ATLAS-3601 No LABEL_DELETE event is audited when last label is deleted.


> On Jan. 30, 2020, 2:48 p.m., Sarath Subramanian wrote:
> > repository/src/main/java/org/apache/atlas/repository/audit/AbstractStorageBasedAuditRepository.java
> > Line 161 (original), 161 (patched)
> > <https://reviews.apache.org/r/72060/diff/1/?file=2210004#file2210004line161>
> >
> >     how does adding a new field to hbase rowkey fix the issue? We are changing the rowkey format here. Will this be backward compatible? will older rows be retrieved using the new key format? Please review.
> 
> Pinal Shah wrote:
>     **Issue-2: When we add label and delete label from multiple label present, simultaneously, Only LABEL_ADD is audited**
>     
>     *how does adding a new field to hbase rowkey fix the issue?*
>     => As row_key(hbase) of both the audits were same, hbase couldnt insert both the audits, for this we need unique row_key for each audit,so whenever getKey() of AbstractStorageBasedAuditRepository class is called, it will assure to return unique Key
>     https://github.com/apache/atlas/blob/master/repository/src/main/java/org/apache/atlas/repository/audit/AbstractStorageBasedAuditRepository.java#L158
>     
>     *We are changing the rowkey format here*
>     => Yes old row_key = <entityID>:<timestamp>:<index(of_forloop)>
>     	   new row_key = <entityID>:<timestamp>:<index(of_forloop)>:<randomString>       https://github.com/apache/atlas/blob/master/repository/src/main/java/org/apache/atlas/repository/audit/AbstractStorageBasedAuditRepository.java#L158
>     
>     *Will this be backward compatible? will older rows be retrieved using the new key format?*
>     => Yes it will be backward compatible and will retrieve older rows.
>     => For retrieval, we make use of entityId and from the result, we extract only entityId and timestamp from row_key
>        below is the snippet.
>     			String[] parts = key.split(FIELD_SEPARATOR);
>                 event.setEntityId(parts[0]);
>                 event.setTimestamp(Long.valueOf(parts[1]));
>        https://github.com/apache/atlas/blob/master/repository/src/main/java/org/apache/atlas/repository/audit/HBaseBasedAuditRepository.java#L464

Thanks for the detailed explanation Pinal.


- Sarath


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


On Jan. 30, 2020, 4:10 a.m., Pinal Shah wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72060/
> -----------------------------------------------------------
> 
> (Updated Jan. 30, 2020, 4:10 a.m.)
> 
> 
> Review request for atlas, Madhan Neethiraj, Nixon Rodrigues, and Sarath Subramanian.
> 
> 
> Bugs: ATLAS-3601
>     https://issues.apache.org/jira/browse/ATLAS-3601
> 
> 
> Repository: atlas
> 
> 
> Description
> -------
> 
> 1) When 1 label among multiple labels is removed , LABEL_DELETE is audited. But when all labels are deleted or the last label is deleted , no LABEL_DELETE is audited.
> 2)When we add label and delete label from multiple label present, simultaneously, Only LABEL_ADD is audited
> 
> 
> Diffs
> -----
> 
>   repository/src/main/java/org/apache/atlas/repository/audit/AbstractStorageBasedAuditRepository.java f6b741b5e 
>   repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphMapper.java e427a59e7 
> 
> 
> Diff: https://reviews.apache.org/r/72060/diff/1/
> 
> 
> Testing
> -------
> 
> 1) Added one label - one audit for LABEL_ADD
> 2) Added multiple labels simultaneously - one audit for LABEL_ADD,with multiple label names in Details
> 3) Deleted one of the label - one audit for LABEL_DELETE
> 4) Deleted multiple labels simultaneously - one audit for LABEL_DELETE,with multiple label names in Details
> 5) deleled last label left - one audit for LABEL_DELETE
> 6) Added one label and deleted two labels simultaneously -two audits, one audit for LABEL_ADD and second for LABEL_DELETE ,with multiple label names in Details
> 
> 
> Thanks,
> 
> Pinal Shah
> 
>