> On 一月 9, 2015, 8:02 a.m., Lenni Kuff wrote:
> > This change looks fine to me, assuming the 90s startup time is unrelated. 
> > Let me know and I will +1 it.
> 
> Dapeng Sun wrote:
>     Hi Lenni, about the change of 90s: when we stop thrift server, the 
> **serve()** of TThreadPoolServer also will wait 60s for 
> **executorService.awaitTermination()**, we can find the code here 
> https://github.com/apache/thrift/blob/5b0296064845240006a66e94037c90c0a6aad87f/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java#L219
>     Thanks again for your review.
> 
> Lenni Kuff wrote:
>     Sorry, but I don't understand how that is applicable here. That code 
> hasn't changed, why do we now need to wait for 90s?
> 
> Dapeng Sun wrote:
>     Hi, Lenni, we know 
> [newSingleThreadExecutor](https://github.com/apache/incubator-sentry/blob/2ad16d05577ccef77b509da75c77bf040ba9b234/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java#L135)
>  can run only one thread. In general, the thread [public String call() throws 
> Exception](https://github.com/apache/incubator-sentry/blob/2ad16d05577ccef77b509da75c77bf040ba9b234/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java#L149)
>  will be hang at 
> [runServer()](https://github.com/apache/incubator-sentry/blob/2ad16d05577ccef77b509da75c77bf040ba9b234/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java#L157)
>  cause by 
> [thriftServer.serve()](https://github.com/apache/incubator-sentry/blob/2ad16d05577ccef77b509da75c77bf040ba9b234/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java#L223),
>  **serve()** 
 will block the current thread, and new thrift server will not start until 
**serve()** finish. We can see [the serve()]( 
https://github.com/apache/thrift/blob/5b0296064845240006a66e94037c90c0a6aad87f/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java#L219)
 of **TThreadPoolServer**  will wait 60s for 
**executorService.awaitTermination()** if there is any active client 
connection, so when we execute **stop()**, the thrift server might wait 60s 
here.
>     
>     If we wait 60s in Unit Test, the sentry server might just finish the 
> **stop()**, so it's better to wait 90s here.

Hi Lenni, the method **thriftServer.serve()** occupy the thread of 
**newSingleThreadExecutor**, and we can see **thriftServer.serve()** will wait 
60s when we call  **thriftServer.stop()**, so when we execute 
**stopSentryServer(); startSentryServer()**, it must cost greater than 60s. If 
you have any thought about it, please feel free to let me know.

Reference link: 
https://github.com/apache/incubator-sentry/blob/2ad16d05577ccef77b509da75c77bf040ba9b234/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java#L223


- Dapeng


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


On 十二月 24, 2014, 4:55 p.m., Dapeng Sun wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/29393/
> -----------------------------------------------------------
> 
> (Updated 十二月 24, 2014, 4:55 p.m.)
> 
> 
> Review request for sentry, Xiaomeng Huang, Arun Suresh, Colin Ma, shen 
> guoquan, Lenni Kuff, Prasad Mujumdar, and Sravya Tirukkovalur.
> 
> 
> Bugs: SENTRY-599
>     https://issues.apache.org/jira/browse/SENTRY-599
> 
> 
> Repository: sentry
> 
> 
> Description
> -------
> 
> The patch is fixing a issue that, when sentry service is restarting using 
> same configuration and context. ** server.isRunning()** will report incorrect 
> status.
> The root cause is **finally** may run after **future = 
> serviceExecutor.submit(this);**, the status will be **NOT_STARTED** even the 
> thrift server is started
> 
> 
> Diffs
> -----
> 
>   
> sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/service/thrift/SentryService.java
>  6d96565 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java
>  4a6cac9 
>   
> sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/service/thrift/SentryServiceIntegrationBase.java
>  be14afd 
> 
> Diff: https://reviews.apache.org/r/29393/diff/
> 
> 
> Testing
> -------
> 
> Unit Tests passed in apache jenkins
> 
> 
> Thanks,
> 
> Dapeng Sun
> 
>

Reply via email to