[ 
https://issues.apache.org/jira/browse/HDFS-5978?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13943348#comment-13943348
 ] 

Haohui Mai commented on HDFS-5978:
----------------------------------

The patch mostly looks good.

{code}
+      sb.append(JsonUtil.toJsonString(fileStatus, true));
{code}

You might use object mapper here as well. I agree with you that it will save 
some effort when using {{JsonUtil}}, but depending on the webhdfs in the server 
side seems worse.

{code}
+    if (nameList.length <= 1) {
+      throw new IOException("Illegal path: " + strPath);
+    }
..
+      if (children == null) {
+        throw new IOException("");
+      }
{code}

You can use {{Preconditions}} here instead of throwing {{IOExceptions}}.

{code}
+      } else if (processor.equals("Web")) {
+        String addr = cmd.getOptionValue("addr", "0.0.0.0:0");
{code}

Can you make the default value into {{localhost:0}}? You can pick a default 
port if you want.

{code}
+    } catch (IllegalArgumentException e) {
+      System.err.println("Encountered exception. Exiting: " + e.getMessage());
{code}

It does not seem necessary to catch this exception.

{code}
+  public void initServerAndWait(String fsimage) throws IOException {
...
{code}

This is unnecessary.

nit: there are some trailing whitespace.

I would also suggest not using {{System.err.println}} instead of 
{{org.apache.commons.logging.Log}} to minimize the dependency, but I think we 
can leave it into a separate jira.

> Create a tool to take fsimage and expose read-only WebHDFS API
> --------------------------------------------------------------
>
>                 Key: HDFS-5978
>                 URL: https://issues.apache.org/jira/browse/HDFS-5978
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: tools
>            Reporter: Akira AJISAKA
>            Assignee: Akira AJISAKA
>              Labels: newbie
>         Attachments: HDFS-5978.2.patch, HDFS-5978.3.patch, HDFS-5978.4.patch, 
> HDFS-5978.patch
>
>
> Suggested in HDFS-5975.
> Add an option to exposes the read-only version of WebHDFS API for 
> OfflineImageViewer. You can imagine it looks very similar to jhat.
> That way we can allow the operator to use the existing command-line tool, or 
> even the web UI to debug the fsimage. It also allows the operator to 
> interactively browsing the file system, figuring out what goes wrong.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to