HDFS-11014: libhdfs++: Make connection to HA clusters faster. Contributed by James Clampffer.

This commit is contained in:
James 2016-10-17 11:57:45 -04:00 committed by James Clampffer
parent 6dd47cae86
commit 59a3926946
3 changed files with 8 additions and 3 deletions

View File

@ -96,7 +96,7 @@ struct Options {
* Client failover attempts before failover gives up
**/
int failover_max_retries;
static const unsigned int kDefaultFailoverMaxRetries = 15;
static const unsigned int kDefaultFailoverMaxRetries = 4;
/**
* Client failover attempts before failover gives up if server

View File

@ -60,8 +60,13 @@ RetryAction FixedDelayWithFailover::ShouldRetry(const Status &s, uint64_t retrie
{
// Try connecting to another NN in case this one keeps timing out
// Can add the backoff wait specified by dfs.client.failover.sleep.base.millis here
if(failovers == 0) {
// No delay on first failover if it looks like the NN was bad.
return RetryAction::failover(0);
} else {
return RetryAction::failover(delay_);
}
}
if(retries < max_retries_ && failovers < max_failover_retries_) {
LOG_TRACE(kRPC, << "FixedDelayWithFailover::ShouldRetry: retries < max_retries_ && failovers < max_failover_retries_");

View File

@ -365,7 +365,7 @@ void RpcEngine::RpcCommsError(
ResolvedNamenodeInfo new_active_nn_info =
ha_persisted_info_->GetFailoverAndUpdate(last_endpoints_[0]/*reverse lookup*/);
LOG_INFO(kRPC, << "Going to try connecting to alternate Datanode: " << new_active_nn_info.uri.str());
LOG_INFO(kRPC, << "Going to try connecting to alternate Namenode: " << new_active_nn_info.uri.str());
if(ha_persisted_info_->is_resolved()) {
last_endpoints_ = new_active_nn_info.endpoints;