[
https://issues.apache.org/jira/browse/HADOOP-10818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14069186#comment-14069186
]
Abraham Elmahrek commented on HADOOP-10818:
-------------------------------------------
# No need to check error code if not used
{code}
@@ -717,16 +709,14 @@ static char* ndfs_get_working_directory(hdfsFS bfs, char
*buffer,
size_t len;
struct native_fs *fs = (struct native_fs *)bfs;
struct hadoop_err *err = NULL;
- char *working_path = NULL;
uv_mutex_lock(&fs->working_uri_lock);
- err = uri_get_path(fs->working_uri, &working_path);
if (err) {
err = hadoop_err_prepend(err, 0, "ndfs_get_working_directory: failed "
"to get the path of the working_uri.");
goto done;
}
{code}
# No need to free user_name?
{code}
-static int ndfs_disconnect(hdfsFS bfs)
+static void ndfs_free(struct native_fs *fs)
{
- struct native_fs *fs = (struct native_fs*)bfs;
-
hrpc_messenger_shutdown(fs->msgr);
hrpc_messenger_free(fs->msgr);
- free(fs->user_name);
- uriFreeUriMembersA(fs->working_uri);
- free(fs->working_uri);
- uv_mutex_destroy(&fs->working_uri_lock);
+ free(fs->url_prefix);
+ hadoop_uri_free(fs->conn_uri);
+ if (fs->working_uri) {
+ hadoop_uri_free(fs->working_uri);
+ uv_mutex_destroy(&fs->working_uri_lock);
+ }
free(fs);
+}
+
+static int ndfs_disconnect(hdfsFS bfs)
+{
+ struct native_fs *fs = (struct native_fs*)bfs;
+
+ ndfs_free(fs);
return 0;
}
{code}
> native client: refactor URI code to be clearer
> ----------------------------------------------
>
> Key: HADOOP-10818
> URL: https://issues.apache.org/jira/browse/HADOOP-10818
> Project: Hadoop Common
> Issue Type: Sub-task
> Components: native
> Affects Versions: HADOOP-10388
> Reporter: Colin Patrick McCabe
> Assignee: Colin Patrick McCabe
> Attachments: HADOOP-10818-pnative.001.patch
>
>
> Refactor the {{common/uri.c}} code to be a bit clearer. We should just be
> able to refer to user_info, auth, port, path, etc. fields in the structure,
> rather than calling accessors. {{hdfsBuilder}} should just have a connection
> URI rather than separate fields for all these things.
--
This message was sent by Atlassian JIRA
(v6.2#6252)