Is there a possibility that data structures will be corrupted, if a thread is 
interrupted in the middle of an operation?

Supposing that we allow resume, is it possible to safely resume after an 
interrupt?

Supposing that we do not allow resume, and instead call close on the root 
Enumerable, is it possible to guarantee each Enumerator cleans up after itself?

Is there a period during the lifecycle of a tree of Enumerable objects (e.g. 
initialization, tear down) where we do not allow interrupts?

How would we test this?

Julian
 

> On Oct 8, 2019, at 10:48 AM, Haisheng Yuan <h.y...@alibaba-inc.com> wrote:
> 
> Make sense and quite reasonable.
> 
> - Haisheng
> 
> ------------------------------------------------------------------
> 发件人:Stamatis Zampetakis<zabe...@gmail.com>
> 日 期:2019年10月08日 18:04:17
> 收件人:<dev@calcite.apache.org>
> 主 题:[DISCUSS] Make Enumerable operators responsive to interrupts
> 
> Hello,
> 
> There are many use-cases which require stopping/cancelling the execution of
> a query for various reasons. Currently, this can be done by launching the
> query in a separate thread and then setting
> DataContext.Variable.CANCEL_FLAG [1] accordingly.
> 
> However if the tread executing the query gets interrupted through the usual
> Thread.interrupt() mechanism the query execution will not stop since the
> operators are not responsive to interruption.
> 
> How do you feel about making Enumerable operators responsive to interrupts?
> 
> Best,
> Stamatis
> 
> [1]
> https://github.com/apache/calcite/blob/3f54108b7dcd4d2b89fc42faab145e2f82883791/core/src/main/java/org/apache/calcite/DataContext.java#L87
> 

Reply via email to