Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-21 Thread Sergio Pena via Review Board

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


Ship it!




Ship It!

- Sergio Pena


On Feb. 21, 2018, 6:45 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 21, 2018, 6:45 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
>  eae7861728f2bc11b4c1b44aa3b61b881a87740b 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
>  cf764eda1a006ce96f301e3ecb87749e05ba4a09 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
>  e7558370025c6acd83492615be093f2bd16a202b 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
>  96c6810baa4d554db2b7d3739a28e3ff7e8b33a0 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
>  4cd00e6672730773c74b9840247d1f4d5f7bdfe4 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationTogglingConf.java
>  PRE-CREATION 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
>  e64f5cd687bf59133d6475c912ebdd7930601151 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
>  91397061e78a6524410d35643dd3a33be8353ecc 
> 
> 
> Diff: https://reviews.apache.org/r/65533/diff/4/
> 
> 
> Testing
> ---
> 
> Made sure that all the tests passed.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-21 Thread kalyan kumar kalvagadda via Review Board

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

(Updated Feb. 21, 2018, 6:45 p.m.)


Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.


Changes
---

Lina,

It was my issue. I did not updated the patch properly.


Bugs: SENTRY-2115
https://issues.apache.org/jira/browse/SENTRY-2115


Repository: sentry


Description
---

**Scenario-1:** When HDFS sync is disabled, and sentry is started for the first 
time.
**Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
less than last event-d processed by sentry
**Scenario-3:** When HDFS sync is disabled, and first event-id in the 
subsequent pull is not greater than the last event-id processed by sentry by 1.
**New Behavior:** Full snapshots need not be taken in all
When Sentry detects out-of-sync situations, it should reset 
SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
HMS_NOTIFICATION_LOG from beginning.

**Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
and then HDFS sync is enabled and sentry service is restarted to get it to 
effect.
**New Behavior:** When Sentry detects out-of-sync situations, it should reset 
SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
HMS_NOTIFICATION_LOG from beginning.
To handle scenario explained in Scenario-4, sentry should reset the mapping 
information when ever HDFS sync is disabled. That way it can learn from scratch 
when the feature is enabled back. There is no value is holding stale data even 
when we know it will have issues when the feature is enabled back.


Diffs (updated)
-

  
sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
 eae7861728f2bc11b4c1b44aa3b61b881a87740b 
  
sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
 cf764eda1a006ce96f301e3ecb87749e05ba4a09 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
 2f2b98412e7dfdcc847ffe7975a70f452554e747 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
 e7558370025c6acd83492615be093f2bd16a202b 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
 edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
 96c6810baa4d554db2b7d3739a28e3ff7e8b33a0 
  
sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
 79030780c35e5bda432e3ec3f01328e627cb50a6 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
 4cd00e6672730773c74b9840247d1f4d5f7bdfe4 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationTogglingConf.java
 PRE-CREATION 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
 e64f5cd687bf59133d6475c912ebdd7930601151 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
 91397061e78a6524410d35643dd3a33be8353ecc 


Diff: https://reviews.apache.org/r/65533/diff/4/

Changes: https://reviews.apache.org/r/65533/diff/3-4/


Testing
---

Made sure that all the tests passed.


Thanks,

kalyan kumar kalvagadda



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-21 Thread Na Li via Review Board


> On Feb. 20, 2018, 8:28 p.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
> > Line 336 (original), 354 (patched)
> > 
> >
> > why do you comment out this line?

This is not fixed. Did you upload the latest patch?


> On Feb. 20, 2018, 8:28 p.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
> > Line 999 (original), 1161 (patched)
> > 
> >
> > if you don't need those lines, can you just remove them?

This is not fixed. Did you upload the latest patch?


- Na


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


On Feb. 15, 2018, 9 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 15, 2018, 9 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
>  eae7861728f2bc11b4c1b44aa3b61b881a87740b 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
>  cf764eda1a006ce96f301e3ecb87749e05ba4a09 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
>  e7558370025c6acd83492615be093f2bd16a202b 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
>  96c6810baa4d554db2b7d3739a28e3ff7e8b33a0 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
>  4cd00e6672730773c74b9840247d1f4d5f7bdfe4 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationTogglingConf.java
>  PRE-CREATION 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
>  e64f5cd687bf59133d6475c912ebdd7930601151 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
>  91397061e78a6524410d35643dd3a33be8353ecc 
> 
> 
> Diff: https://reviews.apache.org/r/65533/diff/3/
> 
> 
> Testing
> ---
> 
> Made sure that all the tests passed.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-20 Thread kalyan kumar kalvagadda via Review Board


> On Feb. 20, 2018, 9:13 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Line 261 (original), 279 (patched)
> > 
> >
> > isAuthzPathsSnapshotEmpty() checks if MAuthzPathsSnapshotId is empty, 
> > why did you change it to MAuthzPathsMapping?

MAuthzPathsMapping is nothing but snapshot. It just that naming of 
MAuthzPathsMapping class is confusing.


> On Feb. 20, 2018, 9:13 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
> > Lines 587-589 (patched)
> > 
> >
> > What about MAuthzPathsSnapshotId.class?

Data in MAuthzPathsSnapshotId.class is not cleared intentionally. This data 
will help sentry retain the history of snapshots taken before
and help in picking appropriate ID even when hdfs sync is enabled/disabled. I 
have added the same in the code.


> On Feb. 20, 2018, 9:13 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
> > Line 3115 (original), 3131 (patched)
> > 
> >
> > The name of the method and what is checks does not match. Why is it 
> > needed to check if the MAuthzPathsMapping is empty instead of the 
> > MAuthzPathsSnapshotId?

MAuthzPathsMapping is nothing but snapshot. It just that naming of 
MAuthzPathsMapping class is confusing.


> On Feb. 20, 2018, 9:13 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
> > Lines 1148-1152 (patched)
> > 
> >
> > What's wrong with /* */?

There is nothing wrong. I have updated the test case and have updated the java 
doc for the same. I just changed the way it is commented.


- kalyan kumar


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


On Feb. 15, 2018, 9 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 15, 2018, 9 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
>  eae7861728f2bc11b4c1b44aa3b61b881a87740b 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
>  cf764eda1a006ce96f301e3ecb87749e05ba4a09 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
>  e7558370025c6acd83492615be093f2bd16a202b 
>   
> 

Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-20 Thread Na Li via Review Board

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




sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
Lines 306 (patched)


should be "fullsnapshot should not have been fetched"



sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
Line 336 (original), 354 (patched)


why do you comment out this line?



sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
Line 999 (original), 1161 (patched)


if you don't need those lines, can you just remove them?


- Na Li


On Feb. 15, 2018, 9 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 15, 2018, 9 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
>  eae7861728f2bc11b4c1b44aa3b61b881a87740b 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
>  cf764eda1a006ce96f301e3ecb87749e05ba4a09 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
>  e7558370025c6acd83492615be093f2bd16a202b 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
>  96c6810baa4d554db2b7d3739a28e3ff7e8b33a0 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
>  4cd00e6672730773c74b9840247d1f4d5f7bdfe4 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationTogglingConf.java
>  PRE-CREATION 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
>  e64f5cd687bf59133d6475c912ebdd7930601151 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
>  91397061e78a6524410d35643dd3a33be8353ecc 
> 
> 
> Diff: https://reviews.apache.org/r/65533/diff/3/
> 
> 
> Testing
> ---
> 
> Made sure that all the tests passed.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-15 Thread kalyan kumar kalvagadda via Review Board


> On Feb. 7, 2018, 5:02 a.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Lines 125 (patched)
> > 
> >
> > Should you update the following condition for 
> > DBUpdateForwarder.getAllUpdatesFrom()?
> > 
> > Replace
> > if (seqNum > curSeqNum) {
> >   // No new notifications were processed.
> >   return Collections.emptyList();
> > }
> > 
> >  With
> >  if (seqNum > curSeqNum) {
> >  if(seqNum = curSeqNum + 1) {
> >   // No new notifications were processed.
> >   return Collections.emptyList();
> >   } else {
> >// perm change has been reset, get full permsnapshot 
> >ListfullImage = retrieveFullImage();
> > //Only log if we have received full image
> > if( !fullImage.isEmpty()) {
> >   LOGGER.info("({}) A newer full update with image number {} 
> > was found and being sent to HDFS",
> >   retrieverType, curImgNum);
> > }
> > return fullImage;
> >   }
> > }
> > 
> >  Once you clear the perm change, the seqNum from Name Node will be 
> > larger than curSeqNum. The correct behavior should be to send full snapshot 
> > of permission to Name Node after you clear the perm changes.
> 
> Na Li wrote:
> Another scenario to take care is that: 1) Name Node has synced with full 
> snapshot before HDFS sync is disabled and is asking for seqNum = 1 after HDFS 
> sync is enabled. A full snapshot should be sent to Name Node, but based on 
> above logic, when there is no perm changes, empty list is sent back.
> 
> kalyan kumar kalvagadda wrote:
> Enabling/disabling HDFS sync is done by changing an bunch of properties 
> both in sentry server and namnode. When even it happens both sentry and 
> namenode are restarted.
> 
> When ever namenode starts, it starts from fresh and the seqNum will be 0.
> 
> I'm dropping your comment. If you don't agree, plese re-open it with your 
> comment.
> 
> Na Li wrote:
> Sentry service has no control on Name Node service. When sentry 
> configuration changes, it is not guaranteed that Name Node service will be 
> restarted. I am OK if you 
> 1) add another jira to properly address the issue I mentioned above 
> (optional)
> 2) add comment in code for this assumption 
> 3) add the document in sentry for this assumption
> and finish this jira. 
> 
> It is a dangerous design to assume a behavior that is not guaranteed in 
> order for the feature to work properly.

This will not be an issue with the new patch


- kalyan kumar


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


On Feb. 15, 2018, 9 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 15, 2018, 9 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> 

Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-15 Thread kalyan kumar kalvagadda via Review Board

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

(Updated Feb. 15, 2018, 9 p.m.)


Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.


Changes
---

Addressed comments from sergio and lina.


Bugs: SENTRY-2115
https://issues.apache.org/jira/browse/SENTRY-2115


Repository: sentry


Description
---

**Scenario-1:** When HDFS sync is disabled, and sentry is started for the first 
time.
**Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
less than last event-d processed by sentry
**Scenario-3:** When HDFS sync is disabled, and first event-id in the 
subsequent pull is not greater than the last event-id processed by sentry by 1.
**New Behavior:** Full snapshots need not be taken in all
When Sentry detects out-of-sync situations, it should reset 
SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
HMS_NOTIFICATION_LOG from beginning.

**Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
and then HDFS sync is enabled and sentry service is restarted to get it to 
effect.
**New Behavior:** When Sentry detects out-of-sync situations, it should reset 
SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
HMS_NOTIFICATION_LOG from beginning.
To handle scenario explained in Scenario-4, sentry should reset the mapping 
information when ever HDFS sync is disabled. That way it can learn from scratch 
when the feature is enabled back. There is no value is holding stale data even 
when we know it will have issues when the feature is enabled back.


Diffs (updated)
-

  
sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
 eae7861728f2bc11b4c1b44aa3b61b881a87740b 
  
sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
 cf764eda1a006ce96f301e3ecb87749e05ba4a09 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
 2f2b98412e7dfdcc847ffe7975a70f452554e747 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
 e7558370025c6acd83492615be093f2bd16a202b 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
 edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
 96c6810baa4d554db2b7d3739a28e3ff7e8b33a0 
  
sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
 79030780c35e5bda432e3ec3f01328e627cb50a6 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
 4cd00e6672730773c74b9840247d1f4d5f7bdfe4 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationTogglingConf.java
 PRE-CREATION 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
 e64f5cd687bf59133d6475c912ebdd7930601151 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
 91397061e78a6524410d35643dd3a33be8353ecc 


Diff: https://reviews.apache.org/r/65533/diff/3/

Changes: https://reviews.apache.org/r/65533/diff/2-3/


Testing
---

Made sure that all the tests passed.


Thanks,

kalyan kumar kalvagadda



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-14 Thread kalyan kumar kalvagadda via Review Board


> On Feb. 14, 2018, 10:04 p.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Line 256 (original), 280 (patched)
> > 
> >
> > the comment needs to be changed "Create Full HMS snapshot" to "Need to 
> > re-sync"

will fix.


> On Feb. 14, 2018, 10:04 p.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Line 264 (original), 288 (patched)
> > 
> >
> > same thing here

will fix.


> On Feb. 14, 2018, 10:04 p.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
> > Line 3110 (original), 3126 (patched)
> > 
> >
> > the name of the function does not match what it is doing. Can you 
> > change the function name to "isAuthzPathsMappingEmpty"?

The name of the table where we store the snapshot information is named as 
MAuthzPathsMapping. I think changing it to isAuthzPathsMappingEmpty would be 
confusing.


- kalyan kumar


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


On Feb. 14, 2018, 2:53 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 14, 2018, 2:53 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
>  eae7861728f2bc11b4c1b44aa3b61b881a87740b 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
>  cf764eda1a006ce96f301e3ecb87749e05ba4a09 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
>  e7558370025c6acd83492615be093f2bd16a202b 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
>  96c6810baa4d554db2b7d3739a28e3ff7e8b33a0 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
>  4cd00e6672730773c74b9840247d1f4d5f7bdfe4 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationTogglingConf.java
>  PRE-CREATION 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
>  e64f5cd687bf59133d6475c912ebdd7930601151 
>   
> 

Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-14 Thread Na Li via Review Board

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




sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
Line 256 (original), 280 (patched)


the comment needs to be changed "Create Full HMS snapshot" to "Need to 
re-sync"



sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
Line 264 (original), 288 (patched)


same thing here



sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
Line 3110 (original), 3126 (patched)


the name of the function does not match what it is doing. Can you change 
the function name to "isAuthzPathsMappingEmpty"?


- Na Li


On Feb. 14, 2018, 2:53 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 14, 2018, 2:53 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
>  eae7861728f2bc11b4c1b44aa3b61b881a87740b 
>   
> sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
>  cf764eda1a006ce96f301e3ecb87749e05ba4a09 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
>  e7558370025c6acd83492615be093f2bd16a202b 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
>  96c6810baa4d554db2b7d3739a28e3ff7e8b33a0 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
>  4cd00e6672730773c74b9840247d1f4d5f7bdfe4 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationTogglingConf.java
>  PRE-CREATION 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
>  e64f5cd687bf59133d6475c912ebdd7930601151 
>   
> sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
>  91397061e78a6524410d35643dd3a33be8353ecc 
> 
> 
> Diff: https://reviews.apache.org/r/65533/diff/2/
> 
> 
> Testing
> ---
> 
> Made sure that all the tests passed.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-14 Thread kalyan kumar kalvagadda via Review Board

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

(Updated Feb. 14, 2018, 2:53 p.m.)


Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.


Changes
---

Addressed comments and also added e2e tests to test the behavior.


Bugs: SENTRY-2115
https://issues.apache.org/jira/browse/SENTRY-2115


Repository: sentry


Description
---

**Scenario-1:** When HDFS sync is disabled, and sentry is started for the first 
time.
**Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
less than last event-d processed by sentry
**Scenario-3:** When HDFS sync is disabled, and first event-id in the 
subsequent pull is not greater than the last event-id processed by sentry by 1.
**New Behavior:** Full snapshots need not be taken in all
When Sentry detects out-of-sync situations, it should reset 
SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
HMS_NOTIFICATION_LOG from beginning.

**Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
and then HDFS sync is enabled and sentry service is restarted to get it to 
effect.
**New Behavior:** When Sentry detects out-of-sync situations, it should reset 
SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
HMS_NOTIFICATION_LOG from beginning.
To handle scenario explained in Scenario-4, sentry should reset the mapping 
information when ever HDFS sync is disabled. That way it can learn from scratch 
when the feature is enabled back. There is no value is holding stale data even 
when we know it will have issues when the feature is enabled back.


Diffs (updated)
-

  
sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/DBUpdateForwarder.java
 eae7861728f2bc11b4c1b44aa3b61b881a87740b 
  
sentry-hdfs/sentry-hdfs-service/src/main/java/org/apache/sentry/hdfs/SentryPlugin.java
 cf764eda1a006ce96f301e3ecb87749e05ba4a09 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
 2f2b98412e7dfdcc847ffe7975a70f452554e747 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/NotificationProcessor.java
 e7558370025c6acd83492615be093f2bd16a202b 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
 edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
  
sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
 96c6810baa4d554db2b7d3739a28e3ff7e8b33a0 
  
sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
 79030780c35e5bda432e3ec3f01328e627cb50a6 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationBase.java
 4cd00e6672730773c74b9840247d1f4d5f7bdfe4 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/hdfs/TestHDFSIntegrationTogglingConf.java
 PRE-CREATION 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/InternalSentrySrv.java
 e64f5cd687bf59133d6475c912ebdd7930601151 
  
sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/minisentry/SentrySrv.java
 91397061e78a6524410d35643dd3a33be8353ecc 


Diff: https://reviews.apache.org/r/65533/diff/2/

Changes: https://reviews.apache.org/r/65533/diff/1-2/


Testing
---

Made sure that all the tests passed.


Thanks,

kalyan kumar kalvagadda



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-12 Thread Xinran Tinney

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




sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
Lines 451 (patched)


2 empty lines



sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
Lines 487 (patched)


can this string be created as a string variable so no need to hard coded


- Xinran Tinney


On Feb. 6, 2018, 7:06 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 6, 2018, 7:06 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
> 
> 
> Diff: https://reviews.apache.org/r/65533/diff/1/
> 
> 
> Testing
> ---
> 
> Made sure that all the tests passed.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-08 Thread Sergio Pena via Review Board


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Line 205 (original), 212-213 (patched)
> > 
> >
> > Isn't the new method name more confusing than before? 
> > isFullSnapshotRequired() means Sentry requires a full HMS snapshot while 
> > isReSyncRequired() sounds like Sentry requires to sync with HDFS, but the 
> > hdfsSyncEnable after this contradicts the name, isn't it?
> 
> kalyan kumar kalvagadda wrote:
> synching in HMSFollower meaning synchornizing with HMS. Defination of 
> being synchronized with HMS differs when HDFS sync feature is enabled OR 
> disable.

I think we should keep the isFullSnapshotRequired() name as the meaning makes 
more sense for what it does 'see if a full HMS snapshot is required'. 
isReSyncRequired() could conflict with HDFS sync meaning which they're 
different.


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Lines 217-220 (patched)
> > 
> >
> > This needs a better explanation. I'm trying to understand the reason of 
> > these lines. A re-sync with HDFS needed? But HDFS is disabled, right?
> 
> kalyan kumar kalvagadda wrote:
> re-synching in HMSFollower meaning synchornizing with HMS. 
> Let's hdfs sync is disabled and sentry detects that it is out of sync, it 
> should set the last processed eventid as 0 and process all the notification 
> event in HMS NOTIFICATION_LOG table.

I see that there is an if (hdfsSyncEnabled) inside the createFullSnapshot() 
method. Can we put this block inside the createFullSnapshot() method instead?


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Line 254 (original), 274 (patched)
> > 
> >
> > Why do we need a method change? Is this resync meant for hdfs or hms 
> > full snapshot?
> 
> kalyan kumar kalvagadda wrote:
> Idea of this patch is to avaoid getting full snapshot when hdfs sync is 
> not enabled.
> 
> method isFullSnapshotRequired, tells us if sentry is out-of-sync with 
> HMS. 
> 
> isFullSnapshotRequired is not correct. Please suggest if 
> "isReSyncRequired" is not reasonable.

isFullSnapshopt() is more reasonable. isReSyncRequired() conflicts with 
areNotificationOutOfSync() and Hdfs Sync.


- Sergio


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


On Feb. 6, 2018, 7:06 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 6, 2018, 7:06 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  

Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-07 Thread Na Li via Review Board


> On Feb. 7, 2018, 5:02 a.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Lines 125 (patched)
> > 
> >
> > Should you update the following condition for 
> > DBUpdateForwarder.getAllUpdatesFrom()?
> > 
> > Replace
> > if (seqNum > curSeqNum) {
> >   // No new notifications were processed.
> >   return Collections.emptyList();
> > }
> > 
> >  With
> >  if (seqNum > curSeqNum) {
> >  if(seqNum = curSeqNum + 1) {
> >   // No new notifications were processed.
> >   return Collections.emptyList();
> >   } else {
> >// perm change has been reset, get full permsnapshot 
> >ListfullImage = retrieveFullImage();
> > //Only log if we have received full image
> > if( !fullImage.isEmpty()) {
> >   LOGGER.info("({}) A newer full update with image number {} 
> > was found and being sent to HDFS",
> >   retrieverType, curImgNum);
> > }
> > return fullImage;
> >   }
> > }
> > 
> >  Once you clear the perm change, the seqNum from Name Node will be 
> > larger than curSeqNum. The correct behavior should be to send full snapshot 
> > of permission to Name Node after you clear the perm changes.
> 
> Na Li wrote:
> Another scenario to take care is that: 1) Name Node has synced with full 
> snapshot before HDFS sync is disabled and is asking for seqNum = 1 after HDFS 
> sync is enabled. A full snapshot should be sent to Name Node, but based on 
> above logic, when there is no perm changes, empty list is sent back.
> 
> kalyan kumar kalvagadda wrote:
> Enabling/disabling HDFS sync is done by changing an bunch of properties 
> both in sentry server and namnode. When even it happens both sentry and 
> namenode are restarted.
> 
> When ever namenode starts, it starts from fresh and the seqNum will be 0.
> 
> I'm dropping your comment. If you don't agree, plese re-open it with your 
> comment.

Sentry service has no control on Name Node service. When sentry configuration 
changes, it is not guaranteed that Name Node service will be restarted. I am OK 
if you 
1) add another jira to properly address the issue I mentioned above (optional)
2) add comment in code for this assumption 
3) add the document in sentry for this assumption
and finish this jira. 

It is a dangerous design to assume a behavior that is not guaranteed in order 
for the feature to work properly.


- Na


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


On Feb. 6, 2018, 7:06 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 6, 2018, 7:06 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> 

Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-07 Thread kalyan kumar kalvagadda via Review Board


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Line 205 (original), 212-213 (patched)
> > 
> >
> > Isn't the new method name more confusing than before? 
> > isFullSnapshotRequired() means Sentry requires a full HMS snapshot while 
> > isReSyncRequired() sounds like Sentry requires to sync with HDFS, but the 
> > hdfsSyncEnable after this contradicts the name, isn't it?

synching in HMSFollower meaning synchornizing with HMS. Defination of being 
synchronized with HMS differs when HDFS sync feature is enabled OR disable.


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Lines 217-220 (patched)
> > 
> >
> > This needs a better explanation. I'm trying to understand the reason of 
> > these lines. A re-sync with HDFS needed? But HDFS is disabled, right?

re-synching in HMSFollower meaning synchornizing with HMS. 
Let's hdfs sync is disabled and sentry detects that it is out of sync, it 
should set the last processed eventid as 0 and process all the notification 
event in HMS NOTIFICATION_LOG table.


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Lines 235 (patched)
> > 
> >
> > Doesn't this required notificationId = ... like the previous 
> > isResyncRequired call?

nope. in previous case, notificationId is used to fetch the notifications but 
in this case control will would return. In the subsequent run the 
notificationId is fetched from the database again.


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Line 254 (original), 274 (patched)
> > 
> >
> > Why do we need a method change? Is this resync meant for hdfs or hms 
> > full snapshot?

Idea of this patch is to avaoid getting full snapshot when hdfs sync is not 
enabled.

method isFullSnapshotRequired, tells us if sentry is out-of-sync with HMS. 

isFullSnapshotRequired is not correct. Please suggest if "isReSyncRequired" is 
not reasonable.


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
> > Line 62 (original), 62 (patched)
> > 
> >
> > Avoid using the * when importing packages.

will change.


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
> > Lines 354 (patched)
> > 
> >
> > 'i stead' should be 'instead'

will change.


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
> > Lines 355 (patched)
> > 
> >
> > What will it prevent?

will update.


> On Feb. 7, 2018, 10:14 p.m., Sergio Pena wrote:
> > sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
> > Lines 486-488 (patched)
> > 
> >
> > I see this block repeated several times, can we create a method for it?

will change


- kalyan kumar


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


On Feb. 6, 2018, 7:06 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 6, 2018, 7:06 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and 

Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-07 Thread kalyan kumar kalvagadda via Review Board


> On Feb. 7, 2018, 5:02 a.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Lines 125 (patched)
> > 
> >
> > Should you update the following condition for 
> > DBUpdateForwarder.getAllUpdatesFrom()?
> > 
> > Replace
> > if (seqNum > curSeqNum) {
> >   // No new notifications were processed.
> >   return Collections.emptyList();
> > }
> > 
> >  With
> >  if (seqNum > curSeqNum) {
> >  if(seqNum = curSeqNum + 1) {
> >   // No new notifications were processed.
> >   return Collections.emptyList();
> >   } else {
> >// perm change has been reset, get full permsnapshot 
> >ListfullImage = retrieveFullImage();
> > //Only log if we have received full image
> > if( !fullImage.isEmpty()) {
> >   LOGGER.info("({}) A newer full update with image number {} 
> > was found and being sent to HDFS",
> >   retrieverType, curImgNum);
> > }
> > return fullImage;
> >   }
> > }
> > 
> >  Once you clear the perm change, the seqNum from Name Node will be 
> > larger than curSeqNum. The correct behavior should be to send full snapshot 
> > of permission to Name Node after you clear the perm changes.
> 
> Na Li wrote:
> Another scenario to take care is that: 1) Name Node has synced with full 
> snapshot before HDFS sync is disabled and is asking for seqNum = 1 after HDFS 
> sync is enabled. A full snapshot should be sent to Name Node, but based on 
> above logic, when there is no perm changes, empty list is sent back.

Enabling/disabling HDFS sync is done by changing an bunch of properties both in 
sentry server and namnode. When even it happens both sentry and namenode are 
restarted.

When ever namenode starts, it starts from fresh and the seqNum will be 0.

I'm dropping your comment. If you don't agree, plese re-open it with your 
comment.


- kalyan kumar


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


On Feb. 6, 2018, 7:06 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 6, 2018, 7:06 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
> 
> 
> Diff: https://reviews.apache.org/r/65533/diff/1/
> 
> 
> Testing
> ---
> 
> Made sure that all the tests passed.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-07 Thread Na Li via Review Board


> On Feb. 7, 2018, 5:02 a.m., Na Li wrote:
> > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
> > Lines 125 (patched)
> > 
> >
> > Should you update the following condition for 
> > DBUpdateForwarder.getAllUpdatesFrom()?
> > 
> > Replace
> > if (seqNum > curSeqNum) {
> >   // No new notifications were processed.
> >   return Collections.emptyList();
> > }
> > 
> >  With
> >  if (seqNum > curSeqNum) {
> >  if(seqNum = curSeqNum + 1) {
> >   // No new notifications were processed.
> >   return Collections.emptyList();
> >   } else {
> >// perm change has been reset, get full permsnapshot 
> >ListfullImage = retrieveFullImage();
> > //Only log if we have received full image
> > if( !fullImage.isEmpty()) {
> >   LOGGER.info("({}) A newer full update with image number {} 
> > was found and being sent to HDFS",
> >   retrieverType, curImgNum);
> > }
> > return fullImage;
> >   }
> > }
> > 
> >  Once you clear the perm change, the seqNum from Name Node will be 
> > larger than curSeqNum. The correct behavior should be to send full snapshot 
> > of permission to Name Node after you clear the perm changes.

Another scenario to take care is that: 1) Name Node has synced with full 
snapshot before HDFS sync is disabled and is asking for seqNum = 1 after HDFS 
sync is enabled. A full snapshot should be sent to Name Node, but based on 
above logic, when there is no perm changes, empty list is sent back.


- Na


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


On Feb. 6, 2018, 7:06 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 6, 2018, 7:06 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
> 
> 
> Diff: https://reviews.apache.org/r/65533/diff/1/
> 
> 
> Testing
> ---
> 
> Made sure that all the tests passed.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>



Re: Review Request 65533: SENTRY-2115: Incorrect behavior of HMsFollower when HDFSSync feature is disabled.

2018-02-06 Thread Na Li via Review Board

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




sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
Lines 125 (patched)


Should you update the following condition for 
DBUpdateForwarder.getAllUpdatesFrom()?

Replace
if (seqNum > curSeqNum) {
  // No new notifications were processed.
  return Collections.emptyList();
}

 With
 if (seqNum > curSeqNum) {
 if(seqNum = curSeqNum + 1) {
  // No new notifications were processed.
  return Collections.emptyList();
  } else {
   // perm change has been reset, get full permsnapshot 
   ListfullImage = retrieveFullImage();
//Only log if we have received full image
if( !fullImage.isEmpty()) {
  LOGGER.info("({}) A newer full update with image number {} was 
found and being sent to HDFS",
  retrieverType, curImgNum);
}
return fullImage;
  }
}

 Once you clear the perm change, the seqNum from Name Node will be larger 
than curSeqNum. The correct behavior should be to send full snapshot of 
permission to Name Node after you clear the perm changes.



sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
Lines 596 (patched)


This method is not just for test, called in HMSFollower line 122. Why do 
you have this comment "the method only for test"?



sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
Lines 615 (patched)


it is called in HMSFollower, why comments "the method only for test"?


- Na Li


On Feb. 6, 2018, 7:06 p.m., kalyan kumar kalvagadda wrote:
> 
> ---
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65533/
> ---
> 
> (Updated Feb. 6, 2018, 7:06 p.m.)
> 
> 
> Review request for sentry, Alexander Kolbasov, Na Li, and Sergio Pena.
> 
> 
> Bugs: SENTRY-2115
> https://issues.apache.org/jira/browse/SENTRY-2115
> 
> 
> Repository: sentry
> 
> 
> Description
> ---
> 
> **Scenario-1:** When HDFS sync is disabled, and sentry is started for the 
> first time.
> **Scenario-2:** When HDFS sync is disabled, and current event-id from HMS is 
> less than last event-d processed by sentry
> **Scenario-3:** When HDFS sync is disabled, and first event-id in the 
> subsequent pull is not greater than the last event-id processed by sentry by 
> 1.
> **New Behavior:** Full snapshots need not be taken in all
> When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> 
> **Scenario-4:** Initially HDFS sync was enabled and later disabled for while 
> and then HDFS sync is enabled and sentry service is restarted to get it to 
> effect.
> **New Behavior:** When Sentry detects out-of-sync situations, it should reset 
> SENTRY_HMS_NOTIFICATION_ID table and start processing the event in 
> HMS_NOTIFICATION_LOG from beginning.
> To handle scenario explained in Scenario-4, sentry should reset the mapping 
> information when ever HDFS sync is disabled. That way it can learn from 
> scratch when the feature is enabled back. There is no value is holding stale 
> data even when we know it will have issues when the feature is enabled back.
> 
> 
> Diffs
> -
> 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/HMSFollower.java
>  2f2b98412e7dfdcc847ffe7975a70f452554e747 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java
>  edea5b64d8f98c93aafc1fe43fa97e00c2ce2948 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestHMSFollower.java
>  79030780c35e5bda432e3ec3f01328e627cb50a6 
> 
> 
> Diff: https://reviews.apache.org/r/65533/diff/1/
> 
> 
> Testing
> ---
> 
> Made sure that all the tests passed.
> 
> 
> Thanks,
> 
> kalyan kumar kalvagadda
> 
>