[ 
https://issues.apache.org/jira/browse/KYLIN-5526?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17716130#comment-17716130
 ] 

Yaguang Jia commented on KYLIN-5526:
------------------------------------

h2. Root Cause

The previous logic goes like this: determine whether the number of asynchronous 
job reaches the limit-"if not, a new asynchronous thread executes the 
asynchronous query, and count-1 after the end of the count+1,job
Check here that count and count+1 are not atomic, and there will be problems in 
concurrency, resulting in more job running than the setting

 

之前的逻辑是这样:判断异步job数目是否达到限制-》没有则新起一个异步线程执行异步查询,count+1,job结束后count-1

这里检查count和count+1 不是原子的,在并发的时候会出现问题,导致运行的job数目超过设置

 
h2. Fix Design

The logic is changed to check the job count when the request comes in. If the 
limit count+1 is not reached, an exception is thrown when the limit is reached. 
Here, it is encapsulated as an atomic operation, and then a new asynchronous 
query is created to execute the query, and the asynchronous thread finally 
count-1.

 

逻辑换成 请求进来的时候检查job 
count,若没有达到限制这count+1,达到限制就抛异常,这里封装成原子操作,然后新起一个异步查询来执行查询,异步线程finally count-1。

>  After setting the upper limit of concurrent asynchronous queries, submitting 
> multiple asynchronous queries at the same time may cause the number of 
> asynchronous queries to be greater than the set upper limit
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: KYLIN-5526
>                 URL: https://issues.apache.org/jira/browse/KYLIN-5526
>             Project: Kylin
>          Issue Type: Bug
>          Components: Query Engine
>    Affects Versions: 5.0-alpha
>            Reporter: Yaguang Jia
>            Assignee: Yaguang Jia
>            Priority: Major
>             Fix For: 5.0-beta
>
>
> When encountering a large number of concurrent asynchronous query requests, 
> the number of asynchronous query jobs will exceed the parameter limit, which 
> needs to be fixed
>  
> 在遇到并发异步查询请求大的时候,异步查询job的数目会大于参数限制,需要修复



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to