Fix when hdfsBuilderConnect returns NULL, HadoopFileSystem::FileExists returns errors::NotFound exception

This commit is contained in:
yuanbopeng 2020-10-21 12:37:35 +08:00
parent e203dad029
commit c49c73559a
2 changed files with 2 additions and 2 deletions

View File

@ -217,7 +217,7 @@ hdfsFS Connect(tf_hadoop_filesystem::HadoopFile* hadoop_file,
hadoop_file->connection_cache.end()) {
auto cacheFs = libhdfs->hdfsBuilderConnect(builder);
if (cacheFs == nullptr) {
TF_SetStatusFromIOError(status, TF_NOT_FOUND, strerror(errno));
TF_SetStatusFromIOError(status, TF_ABORTED, strerror(errno));
return cacheFs;
}
hadoop_file->connection_cache[cacheKey] = cacheFs;

View File

@ -196,7 +196,7 @@ Status HadoopFileSystem::Connect(StringPiece fname, hdfsFS* fs) {
if (connectionCache_.find(cacheKey) == connectionCache_.end()) {
hdfsFS cacheFs = libhdfs()->hdfsBuilderConnect(builder);
if (cacheFs == nullptr) {
return errors::NotFound(strerror(errno));
return errors::Aborted(strerror(errno));
}
connectionCache_[cacheKey] = cacheFs;
}