Github user sohami commented on a diff in the pull request: https://github.com/apache/drill/pull/950#discussion_r140914589 --- Diff: contrib/native/client/src/clientlib/zkCluster.cpp --- @@ -0,0 +1,175 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "drill/common.hpp" +#include <boost/thread.hpp> +#ifdef _WIN32 +#include <zookeeper.h> +#else +#include <zookeeper/zookeeper.h> +#endif +#include "drill/drillConfig.hpp" +#include "drill/drillClient.hpp" +#include "errmsgs.hpp" +#include "logger.hpp" +#include "zkCluster.hpp" + +namespace Drill{ + +char ZkCluster::s_drillRoot[]="/drill/"; +char ZkCluster::s_defaultCluster[]="drillbits1"; + +ZkCluster::ZkCluster(){ + m_pDrillbits=new String_vector; + srand (time(NULL)); + m_bConnecting=true; + memset(&m_id, 0, sizeof(m_id)); +} + +ZkCluster::~ZkCluster(){ + delete m_pDrillbits; +} + +ZooLogLevel ZkCluster::getZkLogLevel(){ + //typedef enum {ZOO_LOG_LEVEL_ERROR=1, + // ZOO_LOG_LEVEL_WARN=2, + // ZOO_LOG_LEVEL_INFO=3, + // ZOO_LOG_LEVEL_DEBUG=4 + //} ZooLogLevel; + switch(DrillClientConfig::getLogLevel()){ + case LOG_TRACE: + case LOG_DEBUG: + return ZOO_LOG_LEVEL_DEBUG; + case LOG_INFO: + return ZOO_LOG_LEVEL_INFO; + case LOG_WARNING: + return ZOO_LOG_LEVEL_WARN; + case LOG_ERROR: + case LOG_FATAL: + default: + return ZOO_LOG_LEVEL_ERROR; + } + return ZOO_LOG_LEVEL_ERROR; +} + +int ZkCluster::connectToZookeeper(const char* connectStr, const char* pathToDrill){ + uint32_t waitTime=30000; // 10 seconds --- End diff -- 10 seconds ? As discussed in person please remove these files as per your plan: `zkCluster.cpp and zkCluster.hpp`
---