[
https://issues.apache.org/jira/browse/LENS-925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15133569#comment-15133569
]
Puneet Gupta commented on LENS-925:
-----------------------------------
*Fixed along with Lens-901*
Specifically the changes made to method
org.apache.lens.server.query.QueryExecutionServiceImpl.executeTimeoutInternal(LensSessionHandle,
QueryContext, long, Configuration) should resolve this
{noformat}
// Until timeOutTime, give this query a chance to reach FINISHED status if not
already there.
queryCtx = getUpdatedQueryContext(sessionHandle, handle);
while (!queryCtx.finished() && System.currentTimeMillis() < timeOutTime) {
queryCtx = getUpdatedQueryContext(sessionHandle, handle);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// Ignore
}
}
{noformat}
*Test case is also updated as part of Lens-901*
Check org.apache.lens.server.query.TestQueryService.DeferredFileSerdeFormatter
used in
TestQueryService.testExecuteWithTimeoutAndPreFetechAndServerPersistence(long,
int, boolean, long)
> Execute With Timeout logic is not correct when server persistence is enabled.
> ------------------------------------------------------------------------------
>
> Key: LENS-925
> URL: https://issues.apache.org/jira/browse/LENS-925
> Project: Apache Lens
> Issue Type: Bug
> Reporter: Puneet Gupta
> Assignee: Puneet Gupta
>
> QueryExecutionServiceImpl.executeTimeoutInternal(LensSessionHandle,
> QueryContext, long, Configuration) waits for driver to complete query
> execution via LensDriver.registerForCompletionNotification() and then checks
> whether query status is finished via QueryContext.finished() before returning
> the results to the client.
> Even though the driver finishes query execution but the Query Status is set
> to finhised(SUCCESSFUL/FAILED/CANCELLED) in two cases
> 1. Asynchronously via LensDriver.updateStatus(QueryContext) which is
> called in Thread QueryExecutionServiceImpl.StatusPoller.run()
> OR
> 2. whenever
> QueryExecutionServiceImpl.getQueryContext(LensSessionHandle, QueryHandle) is
> called.
> It is possible that when server persistence is enabled and even though driver
> has finished execution successfully, the QueryContext.finished() is still
> fasle, since server level persistence is still not over. In this case even
> though the executeTimeoutInternal() may have enough time to spare until
> timeout, it ll still return a null result.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)