HDFS-11014: libhdfs++: Make connection to HA clusters faster. Contributed by James Clampffer.
This commit is contained in:
parent
6dd47cae86
commit
59a3926946
@ -96,7 +96,7 @@ struct Options {
|
|||||||
* Client failover attempts before failover gives up
|
* Client failover attempts before failover gives up
|
||||||
**/
|
**/
|
||||||
int failover_max_retries;
|
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
|
* Client failover attempts before failover gives up if server
|
||||||
|
@ -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
|
// 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
|
// 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_);
|
return RetryAction::failover(delay_);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(retries < max_retries_ && failovers < max_failover_retries_) {
|
if(retries < max_retries_ && failovers < max_failover_retries_) {
|
||||||
LOG_TRACE(kRPC, << "FixedDelayWithFailover::ShouldRetry: retries < max_retries_ && failovers < max_failover_retries_");
|
LOG_TRACE(kRPC, << "FixedDelayWithFailover::ShouldRetry: retries < max_retries_ && failovers < max_failover_retries_");
|
||||||
|
@ -365,7 +365,7 @@ void RpcEngine::RpcCommsError(
|
|||||||
ResolvedNamenodeInfo new_active_nn_info =
|
ResolvedNamenodeInfo new_active_nn_info =
|
||||||
ha_persisted_info_->GetFailoverAndUpdate(last_endpoints_[0]/*reverse lookup*/);
|
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()) {
|
if(ha_persisted_info_->is_resolved()) {
|
||||||
last_endpoints_ = new_active_nn_info.endpoints;
|
last_endpoints_ = new_active_nn_info.endpoints;
|
||||||
|
Loading…
Reference in New Issue
Block a user