aboutsummaryrefslogtreecommitdiff
path: root/contrib/native/client/src/include
diff options
context:
space:
mode:
authorXiao Meng <xiaom.cs@gmail.com>2015-02-10 17:59:23 -0800
committerParth Chandra <pchandra@maprtech.com>2015-02-13 21:50:48 -0800
commit0553798c18aae6b3dfc14227e0cef5f2baea11fe (patch)
tree18c03ec489d97c23522b022bd530f514b0371c22 /contrib/native/client/src/include
parent30769783ec22503d4ab0265da0b449df46a856fd (diff)
DRILL-1197: C++ Client. Differentiate socket/handshake/query timeout for deadline timer.
It also - returns more detailed connection status for validate handshake. - adds timeout options for query submitter.
Diffstat (limited to 'contrib/native/client/src/include')
-rw-r--r--contrib/native/client/src/include/drill/common.hpp6
-rw-r--r--contrib/native/client/src/include/drill/drillClient.hpp24
2 files changed, 27 insertions, 3 deletions
diff --git a/contrib/native/client/src/include/drill/common.hpp b/contrib/native/client/src/include/drill/common.hpp
index f83aae403..824d67062 100644
--- a/contrib/native/client/src/include/drill/common.hpp
+++ b/contrib/native/client/src/include/drill/common.hpp
@@ -78,7 +78,8 @@ typedef enum{
QRY_COMPLETED = 11,
QRY_CANCELED = 12,
QRY_FAILED = 13,
- QRY_UNKNOWN_QUERY = 14
+ QRY_UNKNOWN_QUERY = 14,
+ QRY_TIMEOUT = 15
} status_t;
typedef enum{
@@ -86,7 +87,8 @@ typedef enum{
CONN_FAILURE=1,
CONN_HANDSHAKE_FAILED=2,
CONN_INVALID_INPUT=3,
- CONN_ZOOKEEPER_ERROR=4
+ CONN_ZOOKEEPER_ERROR=4,
+ CONN_HANDSHAKE_TIMEOUT=5
} connectionStatus_t;
typedef enum{
diff --git a/contrib/native/client/src/include/drill/drillClient.hpp b/contrib/native/client/src/include/drill/drillClient.hpp
index 0204855b2..19fec6985 100644
--- a/contrib/native/client/src/include/drill/drillClient.hpp
+++ b/contrib/native/client/src/include/drill/drillClient.hpp
@@ -99,7 +99,11 @@ class DECLSPEC_DRILL_CLIENT DrillClientConfig{
static void setBufferLimit(uint64_t l);
static uint64_t getBufferLimit();
static void setSocketTimeout(int32_t l);
+ static void setHandshakeTimeout(int32_t l);
+ static void setQueryTimeout(int32_t l);
static int32_t getSocketTimeout();
+ static int32_t getHandshakeTimeout();
+ static int32_t getQueryTimeout();
static logLevel_t getLogLevel();
private:
// The logging level
@@ -107,8 +111,26 @@ class DECLSPEC_DRILL_CLIENT DrillClientConfig{
// The total amount of memory to be allocated by an instance of DrillClient.
// For future use. Currently, not enforced.
static uint64_t s_bufferLimit;
- // Timeout (in seconds) for asynchronous read operations. Default is 180 seconds
+
+ /**
+ * DrillClient configures timeout (in seconds) in a fine granularity.
+ * Disabled by setting the value to zero.
+ *
+ * s_socketTimout: (default 0)
+ * set SO_RCVTIMEO and SO_SNDTIMEO socket options and place a
+ * timeout on socket receives and sends. It is disabled by default.
+ *
+ * s_handshakeTimeout: (default 5)
+ * place a timeout on validating handshake. When an endpoint (host:port)
+ * is reachable but drillbit hangs or running another service. It will
+ * avoid the client hanging.
+ *
+ * s_queryTimeout: (default 180)
+ * place a timeout on waiting result of querying.
+ */
static int32_t s_socketTimeout;
+ static int32_t s_handshakeTimeout;
+ static int32_t s_queryTimeout;
static boost::mutex s_mutex;
};