HDFS-11014: libhdfs++: Make connection to HA clusters faster. Contributed by James Clampffer.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/59a39269 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/59a39269 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/59a39269 Branch: refs/heads/HDFS-7240 Commit: 59a39269463bc6fd76b1e5e30cc8ccde5250e7fb Parents: 6dd47ca Author: James <j...@apache.org> Authored: Mon Oct 17 11:57:45 2016 -0400 Committer: James Clampffer <james.clampf...@hp.com> Committed: Thu Mar 22 17:19:47 2018 -0400 ---------------------------------------------------------------------- .../src/main/native/libhdfspp/include/hdfspp/options.h | 2 +- .../src/main/native/libhdfspp/lib/common/retry_policy.cc | 7 ++++++- .../src/main/native/libhdfspp/lib/rpc/rpc_engine.cc | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/59a39269/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/options.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/options.h b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/options.h index 55093d0..b73a729 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/options.h +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/include/hdfspp/options.h @@ -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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/59a39269/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/retry_policy.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/retry_policy.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/retry_policy.cc index ef78aca..148c674 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/retry_policy.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/common/retry_policy.cc @@ -60,7 +60,12 @@ 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 - return RetryAction::failover(delay_); + 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_) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/59a39269/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.cc index 4de6704..72a0c55 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/rpc/rpc_engine.cc @@ -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; --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org