Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contrib/native/client/src/clientlib/drillClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ DrillClientError* DrillClientError::getErrorObject(const exec::shared::DrillPBEr

DrillClientInitializer::DrillClientInitializer(){
GOOGLE_PROTOBUF_VERIFY_VERSION;
srand(time(NULL));
}

DrillClientInitializer::~DrillClientInitializer(){
Expand Down
18 changes: 12 additions & 6 deletions contrib/native/client/src/clientlib/drillClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
namespace Drill{

static std::map<exec::shared::QueryResult_QueryState, status_t> QUERYSTATE_TO_STATUS_MAP = boost::assign::map_list_of
(exec::shared::QueryResult_QueryState_PENDING, QRY_PENDING)
(exec::shared::QueryResult_QueryState_STARTING, QRY_PENDING)
(exec::shared::QueryResult_QueryState_RUNNING, QRY_RUNNING)
(exec::shared::QueryResult_QueryState_COMPLETED, QRY_COMPLETED)
(exec::shared::QueryResult_QueryState_CANCELED, QRY_CANCELED)
Expand Down Expand Up @@ -647,7 +647,7 @@ status_t DrillClientImpl::processQueryResult(AllocatedBufferPtr allocatedBuffer

if (qr.has_query_state() &&
qr.query_state() != exec::shared::QueryResult_QueryState_RUNNING &&
qr.query_state() != exec::shared::QueryResult_QueryState_PENDING) {
qr.query_state() != exec::shared::QueryResult_QueryState_STARTING) {
pDrillClientQueryResult=findQueryResult(qid);
//Queries that have been cancelled or whose resources are freed before completion
//do not have a DrillClientQueryResult object. We need not handle the terminal message
Expand Down Expand Up @@ -1397,7 +1397,6 @@ char ZookeeperImpl::s_defaultCluster[]="drillbits1";

ZookeeperImpl::ZookeeperImpl(){
m_pDrillbits=new String_vector;
srand (time(NULL));
m_bConnecting=true;
memset(&m_id, 0, sizeof(m_id));
}
Expand Down Expand Up @@ -1468,10 +1467,17 @@ int ZookeeperImpl::connectToZookeeper(const char* connectStr, const char* pathTo

//Let's pick a random drillbit.
if(m_pDrillbits && m_pDrillbits->count >0){
int r=rand()%(this->m_pDrillbits->count);
assert(r<this->m_pDrillbits->count);
char * bit=this->m_pDrillbits->data[r];

std::vector<std::string> randomDrillbits;
for(int i=0; i<m_pDrillbits->count; i++){
randomDrillbits.push_back(m_pDrillbits->data[i]);
}
//Use the same random shuffle as the Java client instead of picking a drillbit at random.
//Gives much better randomization when the size of the cluster is small.
std::random_shuffle(randomDrillbits.begin(), randomDrillbits.end());
const char * bit=randomDrillbits[0].c_str();
std::string s;

s=rootDir + std::string("/") + bit;
int buffer_len=MAX_CONNECT_STR;
char buffer[MAX_CONNECT_STR+1];
Expand Down
4 changes: 2 additions & 2 deletions contrib/native/client/src/clientlib/drillClientImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define BOOST_ASIO_ENABLE_CANCELIO
#endif //WIN32_SHUTDOWN_ON_TIMEOUT

#include <algorithm>
#include <stdlib.h>
#include <time.h>
#include <queue>
Expand Down Expand Up @@ -71,7 +72,7 @@ class DrillClientQueryResult{
m_bHasSchemaChanged(false),
m_bHasData(false),
m_bHasError(false),
m_queryState(exec::shared::QueryResult_QueryState_PENDING),
m_queryState(exec::shared::QueryResult_QueryState_STARTING),
m_pError(NULL),
m_pQueryId(NULL),
m_pSchemaListener(NULL),
Expand Down Expand Up @@ -205,7 +206,6 @@ class DrillClientImpl{
m_rbuf(NULL),
m_wbuf(MAX_SOCK_RD_BUFSIZE)
{
srand(time(NULL));
m_coordinationId=rand()%1729+1;
};

Expand Down
45 changes: 42 additions & 3 deletions contrib/native/client/src/include/drill/protobuf/Types.pb.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading