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




sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HmsFollower.java
Lines 191-194 (patched)
<https://reviews.apache.org/r/59508/#comment255516>

    Based on a comment I left on the TestSentryHmsClient class, I think we can 
put the before/after ID check here.
    
    The below code keeping the HMS implementation on the SentryHmsClient, and 
what we want to do with the results on the caller.
    
        createFullSnapshot() {
          long idBeforeSnapshot = client.getNotificationId();
    
          PathsImage snapshot = client.getFullSnapshot();
          if (snapshot.isEmpty()) {
            return SentryStore.EMPTY_PATHS_SNAPSHOT_ID;
          }
    
          long idAfterSnapshot = client.getNotificationId();
          if (idBeforeSnapshot != idAfterSnapshot) {
             LOGGER.info("different notifications ids");
             return SentryStore.EMPTY_PATHS_SNAPSHOT_ID;
          }
    
         ...
        }



sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestSentryHmsClient.java
Lines 154-156 (patched)
<https://reviews.apache.org/r/59508/#comment255514>

    I still not convinced about this testing. This does not avoid that 
getFullSnapshot() may connect automatically to the HMS and get an empty 
snapshot or another kind of error ocurred.
    
    The call to getFullSnapshot() when a client is not connected, in my opinion 
should throw an error. This error should never happen from HmsFollower because 
we're making sure that the connection happens before, but a good class design 
should let users know about these errors.
    
    A better design would be to move the condition for before/after 
notification ID to the createFullSnapshot() method. This way we could test here 
that getFullSnapshot() would fail if no client is connected or the snapshot is 
empty or not when client.



sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestSentryHmsClient.java
Lines 165-169 (patched)
<https://reviews.apache.org/r/59508/#comment255515>

    Same comment as testSnapshotCreationWithOutclientConnected()


- Sergio Pena


On July 12, 2017, 5:44 p.m., kalyan kumar kalvagadda wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/59508/
> -----------------------------------------------------------
> 
> (Updated July 12, 2017, 5:44 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Brian Towles, Hao Hao, Na Li, 
> Sergio Pena, Vamsee Yarlagadda, and Vadim Spector.
> 
> 
> Bugs: SENTRY-1769
>     https://issues.apache.org/jira/browse/SENTRY-1769
> 
> 
> Repository: sentry
> 
> 
> Description
> -------
> 
> Things included in refactoring.
> 1. Moved the complete notification processing logic to notificationProcessor.
> 2. Added new class HMSFollowerHelper class which does
>      HMS Client creation
>      HMS Client closure
>      Creating and persisting the HMS snapshot
> 3. Misc cleanup
> 
> 
> Diffs
> -----
> 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/PathImageRetriever.java
>  2426b40 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
>  d6100de 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/SentryPolicyStorePlugin.java
>  5b8a572 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MAuthzPathsSnapshotId.java
>  d683c2c 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/model/MSentryHmsNotification.java
>  0d54548 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/PathsImage.java
>  4d852e6 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  350c922 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyStoreProcessor.java
>  ad23334 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HMSFollower.java
>  2d581f7 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/HmsFollower.java
>  PRE-CREATION 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/NotificationProcessor.java
>  6762de7 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryHmsClient.java
>  PRE-CREATION 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
>  322197b 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryServiceUtil.java
>  9c3e485 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/ServiceConstants.java
>  193c611 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java
>  395cba6 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestHMSFollower.java
>  66ad2a1 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestHmsFollower.java
>  PRE-CREATION 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestNotificationProcessor.java
>  PRE-CREATION 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/TestSentryHmsClient.java
>  PRE-CREATION 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDbPrivilegeCleanupOnDrop.java
>  b9330cc 
> 
> 
> Diff: https://reviews.apache.org/r/59508/diff/9/
> 
> 
> Testing
> -------
> 
> Made sure that all the tests around HMSFollower and SentryStore passed. Added 
> new classes to test new classes added.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>

Reply via email to