Skip to content

Commit

Permalink
Add failed log info
Browse files Browse the repository at this point in the history
  • Loading branch information
JkSelf committed Apr 15, 2024
1 parent 508df6b commit 47cc31a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class HdfsFileSystem::Impl {
"Unable to connect to HDFS: {}, got error: {}.",
endpoint.identity(),
hdfsGetLastError())
#elif VELOX_ENABLE_HDFS
VELOX_CHECK_NOT_NULL(
hdfsClient_, "Unable to connect to HDFS: {}.", endpoint.identity())
#endif
}

Expand Down
5 changes: 5 additions & 0 deletions velox/connectors/hive/storage_adapters/hdfs/HdfsReadFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ HdfsReadFile::HdfsReadFile(hdfsFS hdfs, const std::string_view path)
VELOX_FILE_NOT_FOUND_ERROR(errMsg);
}
VELOX_FAIL(errMsg);
#elif VELOX_ENABLE_HDFS

auto errMsg =
fmt::format("Unable to get file path info for file: {}", filePath_);
VELOX_FAIL(errMsg);
#endif
}
}
Expand Down
4 changes: 4 additions & 0 deletions velox/connectors/hive/storage_adapters/hdfs/HdfsReadFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ struct HdfsFile {
"Unable to open file {}. got error: {}",
path,
hdfsGetLastError());
#elif VELOX_ENABLE_HDFS
VELOX_CHECK_NOT_NULL(handle_, "Unable to open file {}", path);
#endif
}

Expand All @@ -54,6 +56,8 @@ struct HdfsFile {
0,
"Cannot seek through HDFS file, error is : {}",
std::string(hdfsGetLastError()));
#elif VELOX_ENABLE_HDFS
VELOX_CHECK_EQ(result, 0, "Cannot seek through HDFS file");
#endif
}

Expand Down
11 changes: 11 additions & 0 deletions velox/connectors/hive/storage_adapters/hdfs/HdfsWriteFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ HdfsWriteFile::HdfsWriteFile(
"Failed to open hdfs file: {}, with error: {}",
filePath_,
std::string(hdfsGetLastError()));
#elif VELOX_ENABLE_HDFS
VELOX_CHECK_NOT_NULL(hdfsFile_, "Failed to open hdfs file: {}", filePath_);
#endif
}

Expand All @@ -65,6 +67,8 @@ void HdfsWriteFile::close() {
0,
"Failed to close hdfs file: {}",
std::string(hdfsGetLastError()));
#elif VELOX_ENABLE_HDFS
VELOX_CHECK_EQ(success, 0, "Failed to close hdfs file.");
#endif
hdfsFile_ = nullptr;
}
Expand All @@ -78,6 +82,8 @@ void HdfsWriteFile::flush() {
#ifdef VELOX_ENABLE_HDFS3
VELOX_CHECK_EQ(
success, 0, "Hdfs flush error: {}", std::string(hdfsGetLastError()));
#elif VELOX_ENABLE_HDFS
VELOX_CHECK_EQ(success, 0, "Hdfs flush error.");
#endif
}

Expand All @@ -97,6 +103,11 @@ void HdfsWriteFile::append(std::string_view data) {
data.size(),
"Write failure in HDFSWriteFile::append {}",
std::string(hdfsGetLastError()));
#elif VELOX_ENABLE_HDFS
VELOX_CHECK_EQ(
totalWrittenBytes,
data.size(),
"Write failure in HDFSWriteFile::append.");
#endif
}

Expand Down

0 comments on commit 47cc31a

Please sign in to comment.