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:
parent
23afd50865
commit
3db261d45b
@ -288,14 +288,16 @@ int FileSystemImpl::WorkerThreadCount() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool FileSystemImpl::CancelPendingConnect() {
|
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()) {
|
if(!connect_callback_.IsCallbackSet()) {
|
||||||
LOG_DEBUG(kFileSystem, << "FileSystemImpl@" << this << "::CancelPendingConnect called before Connect started");
|
LOG_DEBUG(kFileSystem, << "FileSystemImpl@" << this << "::CancelPendingConnect called before Connect started");
|
||||||
return false;
|
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
|
// First invoke callback, then do proper teardown in RpcEngine and RpcConnection
|
||||||
ConnectCallback noop_callback = [](const Status &stat, FileSystem *fs) {
|
ConnectCallback noop_callback = [](const Status &stat, FileSystem *fs) {
|
||||||
|
@ -220,7 +220,9 @@ void RpcEngine::RpcCommsError(
|
|||||||
|
|
||||||
RetryAction retry = RetryAction::fail(""); // Default to fail
|
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());
|
retry = RetryAction::fail(status.ToString().c_str());
|
||||||
} else if (retry_policy()) {
|
} else if (retry_policy()) {
|
||||||
retry = retry_policy()->ShouldRetry(status, req->IncrementRetryCount(), req->get_failover_count(), true);
|
retry = retry_policy()->ShouldRetry(status, req->IncrementRetryCount(), req->get_failover_count(), true);
|
||||||
|
Loading…
Reference in New Issue
Block a user