[fix](hdfs-writer) Catch error information after hdfsCloseFile() (#33195)

This commit is contained in:
Tiewei Fang
2024-04-07 22:23:11 +08:00
committed by morningman
parent 586df24b9d
commit 69bf3b9da4

View File

@ -64,8 +64,15 @@ Status HdfsFileWriter::close() {
LOG(WARNING) << ss.str();
return Status::InternalError(ss.str());
}
hdfsCloseFile(_hdfs_fs->_fs_handle->hdfs_fs, _hdfs_file);
result = hdfsCloseFile(_hdfs_fs->_fs_handle->hdfs_fs, _hdfs_file);
_hdfs_file = nullptr;
if (result != 0) {
std::string err_msg = hdfs_error();
return Status::InternalError(
"Write hdfs file failed. (BE: {}) namenode:{}, path:{}, err: {}",
BackendOptions::get_localhost(), _hdfs_fs->_fs_name, _path.string(), err_msg);
}
return Status::OK();
}