Github user parthchandra commented on a diff in the pull request:
https://github.com/apache/drill/pull/493#discussion_r69666595
--- Diff: contrib/native/client/src/clientlib/drillClientImpl.cpp ---
@@ -469,34 +471,50 @@ DrillClientQueryResult*
DrillClientImpl::SubmitQuery(::exec::shared::QueryType t
uint64_t coordId;
DrillClientQueryResult* pQuery=NULL;
+ connectionStatus_t cStatus=CONN_SUCCESS;
{
boost::lock_guard<boost::mutex> prLock(this->m_prMutex);
boost::lock_guard<boost::mutex> dcLock(this->m_dcMutex);
coordId = this->getNextCoordinationId();
OutBoundRpcMessage out_msg(exec::rpc::REQUEST,
exec::user::RUN_QUERY, coordId, &query);
- sendSync(out_msg);
+ // Create the result object and register the listener before we
send the query
+ // because sometimes the caller is not checking the status of the
submitQuery call.
+ // This way, the broadcast error call will cause the results
listener to be called
+ // with a COMM_ERROR status.
pQuery = new DrillClientQueryResult(this, coordId, plan);
pQuery->registerListener(l, lCtx);
- bool sendRequest=false;
this->m_queryIds[coordId]=pQuery;
- DRILL_MT_LOG(DRILL_LOG(LOG_DEBUG) << "Sent query request. " <<
"[" << m_connectedHost << "]" << "Coordination id = " << coordId << std::endl;)
- DRILL_MT_LOG(DRILL_LOG(LOG_DEBUG) << "Sent query " <<
"Coordination id = " << coordId << " query: " << plan << std::endl;)
+ connectionStatus_t cStatus=sendSync(out_msg);
+ if(cStatus == CONN_SUCCESS){
+ bool sendRequest=false;
- if(m_pendingRequests++==0){
- sendRequest=true;
- }else{
- DRILL_MT_LOG(DRILL_LOG(LOG_DEBUG) << "Queueing query request
to server" << std::endl;)
- DRILL_MT_LOG(DRILL_LOG(LOG_DEBUG) << "Number of pending
requests = " << m_pendingRequests << std::endl;)
- }
- if(sendRequest){
- DRILL_MT_LOG(DRILL_LOG(LOG_DEBUG) << "Sending query request.
Number of pending requests = "
- << m_pendingRequests << std::endl;)
- getNextResult(); // async wait for results
+ DRILL_MT_LOG(DRILL_LOG(LOG_DEBUG) << "Sent query request. "
<< "[" << m_connectedHost << "]" << "Coordination id = " << coordId <<
std::endl;)
+ DRILL_MT_LOG(DRILL_LOG(LOG_DEBUG) << "Sent query " <<
"Coordination id = " << coordId << " query: " << plan << std::endl;)
--- End diff --
Hmm. Vim's code formatter got confused by the fact that the previous line
of code had no terminal semi-colon.
Fixed it manually.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---