> On Feb. 27, 2014, 11:08 p.m., Thejas Nair wrote:
> > ql/src/java/org/apache/hadoop/hive/ql/DriverContext.java, line 110
> > <https://reviews.apache.org/r/15873/diff/3/?file=478815#file478815line110>
> >
> >     When pollFinished is running, this shutdown() function will not be able 
> > to make progress. Which means that the query cancellation will happen only 
> > after a task (could be an MR task) is complete.
> >     
> >     It seems synchronizing around shutdown should be sufficient, either by 
> > making it volatile or having synchronized methods around it.
> >     
> >     Since thread safe concurrent collection classes are being used here, I 
> > don't see other concurrency issues that would make it necessary to make all 
> > these functions synchronized. 
> >     
> >     
> >
> 
> Navis Ryu wrote:
>     It just only polls status of running tasks and goes into wait state quite 
> quickly, so it would not hinder shutdown process. Furthermore, two threads, 
> polling and shutdown, has a race condition on both collections, runnable and 
> running, so those should be guarded by shared something.
> 
> Thejas Nair wrote:
>     Yes, it will go into the wait state quickly. But I haven't understood how 
> the wait helps here. There is no notify in this code, so the wait will always 
> wait for 2 seconds. It will be no different from a sleep(2000) .
>     So it looks like the polling outside loop will continue until all the 
> currently running jobs are complete.
>

In javadoc, Object.wait()

The current thread must own this object's monitor. The thread 
releases ownership of this monitor and waits until another thread 
notifies threads waiting on this object's monitor

In wait state, any other thread can take the monitor (in sleep, it's not 
possible). So shutdown thread does not need to wait for 2 seconds. Polling 
thread might notice 2 seconds after shutdown as you said because it's not 
notified. But I think it's not a big deal. Isn't it? 


- Navis


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


On March 4, 2014, 8:02 a.m., Navis Ryu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/15873/
> -----------------------------------------------------------
> 
> (Updated March 4, 2014, 8:02 a.m.)
> 
> 
> Review request for hive.
> 
> 
> Bugs: HIVE-5901
>     https://issues.apache.org/jira/browse/HIVE-5901
> 
> 
> Repository: hive-git
> 
> 
> Description
> -------
> 
> Currently, query canceling does not stop running MR job immediately.
> 
> 
> Diffs
> -----
> 
>   ql/src/java/org/apache/hadoop/hive/ql/Driver.java 332cadb 
>   ql/src/java/org/apache/hadoop/hive/ql/DriverContext.java c51a9c8 
>   ql/src/java/org/apache/hadoop/hive/ql/exec/ConditionalTask.java 854cd52 
>   ql/src/java/org/apache/hadoop/hive/ql/exec/TaskRunner.java ead7b59 
> 
> Diff: https://reviews.apache.org/r/15873/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Navis Ryu
> 
>

Reply via email to