----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/27846/#review61328 -----------------------------------------------------------
Ship it! Ship It! sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java <https://reviews.apache.org/r/27846/#comment103370> It would probably be good to add a configuration option that allows disabling this functionality in case we find it causes problems in some scenarios. sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java <https://reviews.apache.org/r/27846/#comment103372> This lock also needs to be in a try/finally sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java <https://reviews.apache.org/r/27846/#comment103371> nit: I don't believe that you actually will get this exception in the case of a spurious wakeup. I believe this exception is only thrown when another thread "interrupts" this thread. That's why usually this is implemented using a pattern like: lock.lock(); try { while(condition) { cond.await() } // Do some stuff now that condition is met and // you hold the lock. } finally { lock.unlock(); } You might want two loops a while(true) to keep the thread running and then this loop. sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java <https://reviews.apache.org/r/27846/#comment103373> Do you need to (re)lock here? Instead could you just be optimistic and set this to 0 before executing removeOrphanPrivs. - Lenni Kuff On Nov. 14, 2014, 7:44 p.m., Mike Yoder wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/27846/ > ----------------------------------------------------------- > > (Updated Nov. 14, 2014, 7:44 p.m.) > > > Review request for sentry. > > > Bugs: SENTRY-140 > https://issues.apache.org/jira/browse/SENTRY-140 > > > Repository: sentry > > > Description > ------- > > Due to the M-to-N relationship of roles to privileges, when a role is removed > from a privilege (or vice versa) that privilege is not deleted from the > database. > > This fix introduces a thread that periodically (currently, once every 10 > times a role and a privilege are disassociated) runs a SQL query that > searches for all orphaned privileges and deletes them. > > > Diffs > ----- > > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > f6699d2 > > sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/persistent/TestSentryStore.java > 2e829d6 > > Diff: https://reviews.apache.org/r/27846/diff/ > > > Testing > ------- > > Wrote a test case; local testing. > > > Thanks, > > Mike Yoder > >
