[
https://issues.apache.org/jira/browse/HDFS-8766?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14940089#comment-14940089
]
Haohui Mai commented on HDFS-8766:
----------------------------------
Thanks for updating the patch!.
{code}
+ if (!s.ok()) {
+ // for now assume this was a down DN, not going to reinvent HDFS-9103
+ if (s.code() == Status::kResourceUnavailable) {
+ errno = ECOMM;
+ bad_datanodes_.insert(datanode);
+ }
+ // otherwise it was a real error so indicate that something's gone wrong
+ return -1;
+ }
+
+ return (ssize_t)read_count;
+}
{code}
There are several issues:
(1) It makes sense to refactor the above code into a function.
(2) the errno should be {{EINTR}}.
(3) When a DN added into the dead DN list, it needs to be removed from the list
after a pre-configured time.
(4) This function needs a unit test in gmock.
Nit: Things like class name should be in caml cases instead of underscores. In
order to glue them with hdfs.h, an easy way is to add {{typedef ClassName
hdfs_internal}} in the implementation.
> Implement a libhdfs(3) compatible API
> -------------------------------------
>
> Key: HDFS-8766
> URL: https://issues.apache.org/jira/browse/HDFS-8766
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: hdfs-client
> Reporter: James Clampffer
> Assignee: James Clampffer
> Attachments: HDFS-8766.HDFS-8707.000.patch,
> HDFS-8766.HDFS-8707.001.patch, HDFS-8766.HDFS-8707.002.patch,
> HDFS-8766.HDFS-8707.003.patch
>
>
> Add a synchronous API that is compatible with the hdfs.h header used in
> libhdfs and libhdfs3. This will make it possible for projects using
> libhdfs/libhdfs3 to relink against libhdfspp with minimal changes.
> This also provides a pure C interface that can be linked against projects
> that aren't built in C++11 mode for various reasons but use the same
> compiler. It also allows many other programming languages to access
> libhdfspp through builtin FFI interfaces.
> The libhdfs API is very similar to the posix file API which makes it easier
> for programs built using posix filesystem calls to be modified to access HDFS.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)