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 9ef3aa0950..761ff86076 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,14 +288,16 @@ int FileSystemImpl::WorkerThreadCount() { } bool FileSystemImpl::CancelPendingConnect() { + 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; } - if(connect_callback_.IsCallbackAccessed()) { - LOG_DEBUG(kFileSystem, << "FileSystemImpl@" << this << "::CancelPendingConnect called after Connect completed"); - return false; - } // First invoke callback, then do proper teardown in RpcEngine and RpcConnection ConnectCallback noop_callback = [](const Status &stat, FileSystem *fs) { 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 98c41dad1f..ba5556531f 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);