[jira] [Commented] (DRILL-1697) C++ Client. Use the object io_service::work to prevent io_service running out of work.

2015-02-11 Thread Parth Chandra (JIRA)

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

Parth Chandra commented on DRILL-1697:
--

I drillClientImpl
{code}
if(this->m_pQueryId!=NULL){
DRILL_LOG(LOG_TRACE) << "Clearing state for Query Id - " << 
debugPrintQid(*this->m_pQueryId) << std::endl;
}
{code}
fixes the crash the above example illustrates. However, it does illustrate the 
problem that the listener might exit without getting all the results. 

> C++ Client. Use the object  io_service::work to prevent io_service running 
> out of work.
> ---
>
> Key: DRILL-1697
> URL: https://issues.apache.org/jira/browse/DRILL-1697
> Project: Apache Drill
>  Issue Type: Bug
>Reporter: Xiao Meng
>Assignee: Xiao Meng
> Fix For: 0.8.0
>
> Attachments: DRILL-1697-2.patch, DRILL-1697.1.patch, 
> ThreeQueriesTraceOn.txt, ThreeQueriesTraceonWithSleep10Seconds5.txt, 
> querySubmitterCrashes.GIF
>
>
> In C++ Client async API, the io_service may stop working because of there is 
> a long enough time lag between two consecutive queries.
> References:
> http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/io_service.html#boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-1697) C++ Client. Use the object io_service::work to prevent io_service running out of work.

2015-02-10 Thread Xiao Meng (JIRA)

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

Xiao Meng commented on DRILL-1697:
--

[~parthc] Here is the reference from boost asio document:
http://www.boost.org/doc/libs/1_57_0/doc/html/boost_asio/reference/io_service.html#boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work

> C++ Client. Use the object  io_service::work to prevent io_service running 
> out of work.
> ---
>
> Key: DRILL-1697
> URL: https://issues.apache.org/jira/browse/DRILL-1697
> Project: Apache Drill
>  Issue Type: Bug
>Reporter: Xiao Meng
>Assignee: Xiao Meng
> Fix For: 0.8.0
>
> Attachments: DRILL-1697.1.patch, ThreeQueriesTraceOn.txt, 
> ThreeQueriesTraceonWithSleep10Seconds5.txt, querySubmitterCrashes.GIF
>
>
> In C++ Client async API, the io_service may stop working because of there is 
> a long enough time lag between two consecutive queries.
> References:
> http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/io_service.html#boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (DRILL-1697) C++ Client. Use the object io_service::work to prevent io_service running out of work.

2015-02-10 Thread Alexander Zarei (JIRA)

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

Alexander Zarei commented on DRILL-1697:


[~parthc]

So the main difference between the ODBC driver and the querySubmitter regarding 
boost asio io_service is that querySubmitter submits all queries in a for loop; 
This means there is little to no delay between submitting queries. 

However, in the ODBC driver queries arrive as the application is submitting 
them. This means it is highly probable that there is a delay between queries 
and this makes io_service die prematurely. 

In order to reproduce this scenario, we changed the querySubmitter slightly to 
cause delays between query submissions. We added a sleep statement

{code}
boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
{code}

in the following block of the code

{code:title=querySubmitter.cpp|borderStyle=solid}

// inside the async api query submission loop 
for(queryInpIter = queryInputs.begin(); queryInpIter != 
queryInputs.end(); queryInpIter++) {
Drill::QueryHandle_t* qryHandle = new Drill::QueryHandle_t;
client.submitQuery(type, *queryInpIter, QueryResultsListener, 
NULL, qryHandle);
client.registerSchemaChangeListener(qryHandle, SchemaListener);
queryHandles.push_back(qryHandle);
printf(" \n Sleeping for 10 seconds...\n");

boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
printf(" \nback to life after 10 seconds...\n");
   }
 {code}

This results in the main thread going into sleep for 10 seconds after each 
query submission;

Three queries were executed and the output was attached in the respective files 
with and without the sleep statement.
 

The command to invoke the query submitter was:

{code}
querySubmitter query="select * from INFORMATION_SCHEMA.SCHEMATA;SELECT 
CAST(row_key as VARCHAR(255)) Row_Key, CAST(`onecf`['name'] AS Varchar(32)) 
name FROM `hbase`.`voter`;SELECT * FROM `hive43`.`default`.`orders` limit 
5" type=sql connectStr=local=192.168.39.44:31010 api=async logLevel=trace > 
ThreeQueriesTraceonWithSleep10Seconds5.txt

{code}
The modified querySubmitter crashes after the first query results are received 
because the listener service is not alive serving the next two queries.

I was wondering if you could look into this and let me know if the changes I 
made to query submitter were acceptable as a use case for drillclient and also 
if it is acceptable, would you like to work together on fixing it. We already 
created a workaround for it.

Thanks,
Alex

> C++ Client. Use the object  io_service::work to prevent io_service running 
> out of work.
> ---
>
> Key: DRILL-1697
> URL: https://issues.apache.org/jira/browse/DRILL-1697
> Project: Apache Drill
>  Issue Type: Bug
>Reporter: Xiao Meng
>Assignee: Xiao Meng
> Fix For: 0.8.0
>
> Attachments: DRILL-1697.1.patch
>
>
> In C++ Client async API, the io_service may stop working because of there is 
> a long enough time lag between two consecutive queries.
> References:
> http://www.boost.org/doc/libs/1_55_0/doc/html/boost_asio/reference/io_service.html#boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)