Repository: hadoop Updated Branches: refs/heads/HDFS-8707 80a159d52 -> 513a36181
HDFS-12103: libhdfs++: Provide workaround to support cancel on filesystem connect until HDFS-11437 is resolved. 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/513a3618 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/513a3618 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/513a3618 Branch: refs/heads/HDFS-8707 Commit: 513a361819db1aed90889e91525bef6ab2735c67 Parents: 80a159d Author: James Clampffer <james.clampf...@hp.com> Authored: Mon Jul 10 14:23:13 2017 -0400 Committer: James Clampffer <james.clampf...@hp.com> Committed: Mon Jul 10 14:23:13 2017 -0400 ---------------------------------------------------------------------- .../src/main/native/libhdfspp/lib/fs/filesystem.cc | 10 ++++++---- .../src/main/native/libhdfspp/lib/rpc/rpc_engine.cc | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/513a3618/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc index 9ef3aa0..761ff86 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc +++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/fs/filesystem.cc @@ -288,12 +288,14 @@ int FileSystemImpl::WorkerThreadCount() { } bool FileSystemImpl::CancelPendingConnect() { - if(!connect_callback_.IsCallbackSet()) { - LOG_DEBUG(kFileSystem, << "FileSystemImpl@" << this << "::CancelPendingConnect called before Connect started"); - return false; - } if(connect_callback_.IsCallbackAccessed()) { + // Temp fix for failover hangs, allow CancelPendingConnect to be called so it can push a flag through the RPC engine LOG_DEBUG(kFileSystem, << "FileSystemImpl@" << this << "::CancelPendingConnect called after Connect completed"); + return nn_.CancelPendingConnect(); + } + + if(!connect_callback_.IsCallbackSet()) { + LOG_DEBUG(kFileSystem, << "FileSystemImpl@" << this << "::CancelPendingConnect called before Connect started"); return false; } http://git-wip-us.apache.org/repos/asf/hadoop/blob/513a3618/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 98c41da..ba55565 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 @@ -220,7 +220,9 @@ void RpcEngine::RpcCommsError( RetryAction retry = RetryAction::fail(""); // Default to fail - if (status.notWorthRetry()) { + if(connect_canceled_) { + retry = RetryAction::fail("Operation canceled"); + } else if (status.notWorthRetry()) { retry = RetryAction::fail(status.ToString().c_str()); } else if (retry_policy()) { retry = retry_policy()->ShouldRetry(status, req->IncrementRetryCount(), req->get_failover_count(), true); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org