HDFS-12103: libhdfs++: Provide workaround to support cancel on filesystem connect until HDFS-11437 is resolved. Contributed by James Clampffer.

This commit is contained in:
James Clampffer 2017-07-10 14:23:13 -04:00
parent 23afd50865
commit 3db261d45b
2 changed files with 9 additions and 5 deletions

View File

@ -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) {

View File

@ -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);