Skip to content

Commit

Permalink
Merge "Add receive timeout to cassandra client socket" into R2.21.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed May 11, 2016
2 parents aed29cc + 053f97e commit 99b8677
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/gendb/cdb_if.cc
Original file line number Diff line number Diff line change
Expand Up @@ -634,12 +634,10 @@ CdbIf::CdbIf(DbErrorHandler errhandler,
task_instance_(-1),
prev_task_instance_(-1),
task_instance_initialized_(false) {

// reduce connection timeout
boost::shared_ptr<TSocket> tsocket =
boost::dynamic_pointer_cast<TSocket>(socket_);
tsocket->setConnTimeout(connectionTimeout);

// Reduce connection timeout
socket_->setConnTimeout(kConnectionTimeout);
// Set receive timeout
socket_->setRecvTimeout(kRecvTimeout);
db_init_done_ = false;
}

Expand Down
5 changes: 3 additions & 2 deletions src/gendb/cdb_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class CdbIf : public GenDb::GenDbIf {
void Db_SetQueueWaterMarkInternal(CdbIfQueue *queue,
const DbQueueWaterMarkInfo &wmi);

boost::shared_ptr<apache::thrift::transport::TTransport> socket_;
boost::shared_ptr<apache::thrift::transport::TSocketPool> socket_;
boost::shared_ptr<apache::thrift::transport::TTransport> transport_;
boost::shared_ptr<apache::thrift::protocol::TProtocol> protocol_;
boost::scoped_ptr<org::apache::cassandra::CassandraClient> client_;
Expand All @@ -267,7 +267,8 @@ class CdbIf : public GenDb::GenDbIf {
CdbIfStats stats_;
std::vector<DbQueueWaterMarkInfo> cdbq_wm_info_;
// Connection timeout to a server (before moving to next server)
static const int connectionTimeout = 3000;
static const int kConnectionTimeout = 3000;
static const int kRecvTimeout = 30000;
};

CdbIf::CdbIfStats::Errors operator+(const CdbIf::CdbIfStats::Errors &a,
Expand Down

0 comments on commit 99b8677

Please sign in to comment.