> On May 17, 2017, 2:52 p.m., Na Li wrote: > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > > Line 2393 (original), 2394 (patched) > > <https://reviews.apache.org/r/59330/diff/1/?file=1722651#file1722651line2394> > > > > should we close the query to avoid memory leak? > > > > --------------------- > > based on > > http://www.datanucleus.org/products/datanucleus/jdo/troubleshooting.html > > > > leak > > > > The query results are kept in memory until the PersistenceManager or > > Query are closed. To avoid memory leaks caused by queries in memory, it's > > capital to explicitly close the query as soon as possible. The following > > snippet shows how to do it. > > > > Query query = pm.newQuery("SELECT FROM > > org.datanucleus.samples.store.Product WHERE price < :limit"); > > List results = (List)query.execute(new Double(200.0)); > > //... > > //... > > //closes the query > > query.closeAll();
The query is closed as part of the persistence manager close() which is closed at the end of each transaction. > On May 17, 2017, 2:52 p.m., Na Li wrote: > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > > Line 2406 (original), 2408 (patched) > > <https://reviews.apache.org/r/59330/diff/1/?file=1722651#file1722651line2408> > > > > When do we need to detach the objects? If we use the query result, > > should it be detached? We need to detach it if we use the object after transaction commit > On May 17, 2017, 2:52 p.m., Na Li wrote: > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > > Line 2882 (original), 2892 (patched) > > <https://reviews.apache.org/r/59330/diff/1/?file=1722651#file1722651line2893> > > > > Set is a collection that contains no duplicate elements. Can we use > > collection that allows duplicate elements? In this code we are just walking it. Callers actually create it and they create a set. - Alexander ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/59330/#review175250 ----------------------------------------------------------- On May 17, 2017, 7:37 a.m., Alexander Kolbasov wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/59330/ > ----------------------------------------------------------- > > (Updated May 17, 2017, 7:37 a.m.) > > > Review request for sentry, Brian Towles, Hao Hao, kalyan kumar kalvagadda, Na > Li, Sergio Pena, and Vamsee Yarlagadda. > > > Bugs: SENTRY-1768 > https://issues.apache.org/jira/browse/SENTRY-1768 > > > Repository: sentry > > > Description > ------- > > SENTRY-1768 Avoid detaching object on transaction exit when it isn't needed > > > Diffs > ----- > > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/DeltaTransactionBlock.java > f590a5296c047e1acedd39a4f2e4f1de98008d32 > > sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/persistent/SentryStore.java > ef6786537e9c5f7730bc86d44e8b4a168c20677e > > > Diff: https://reviews.apache.org/r/59330/diff/1/ > > > Testing > ------- > > > Thanks, > > Alexander Kolbasov > >