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/0c33214b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0c33214b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0c33214b

Branch: refs/heads/HDFS-12996
Commit: 0c33214be1e10fbbda5c640cf42a5489a1b290b3
Parents: 4480449
Author: James Clampffer <james.clampf...@hp.com>
Authored: Mon Jul 10 14:23:13 2017 -0400
Committer: Hanisha Koneru <hanishakon...@apache.org>
Committed: Mon Mar 26 11:11:04 2018 -0700

----------------------------------------------------------------------
 .../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/0c33214b/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/0c33214b/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

Reply via email to