hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mingliang Liu (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (HDFS-11085) Add unit tests for NameNode failing to startup when name dir can not be written
Date Thu, 03 Nov 2016 20:27:58 GMT

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

Mingliang Liu edited comment on HDFS-11085 at 11/3/16 8:27 PM:
---------------------------------------------------------------

The patch looks good to me overall.

Some minor comments:
# Checkstyle warning is related.
# MiniDFSCluster can be used in try-with-resource. Shorter and neater.
# I think we can use {{Paths.get()}} for joining path strings. Assuming file path separate
is / is not platform independent probably. Also if there are methods in JDK or Apache component
that work just fine, I hesitate to use third party libraries.
{code}
661	    final String nnDirStr = Joiner.on("/").join(
662	        hdfsDir.toString(),
663	        GenericTestUtils.getMethodName(), "name");
{code}
# I don't think we need the implementation details about the Collection type (List). We just
need the only element in the collections, don't we?
{code}
673	      /* get and verify NN dir */
674	      List<URI> nameDirs = (List<URI>) FSNamesystem.getNamespaceDirs(config);
{code}
Alternatively:
{code}
Collection<URI> nameDirs = FSNamesystem.getNamespaceDirs(config);
assertNotNull(nameDirs);
assertTrue(nameDirs.iterator().hasNext());
final URI nameDir = nameDirs.iterator().next();
...
{code}


was (Author: liuml07):
The patch looks good to me overall.

Some minor comments:
# Checkstyle warning is related.
# MiniDFSCluster can be used in try-catch. Shorter and neater.
# I think we can use {{Paths.get()}} for joining path strings. Assuming file path separate
is / is not platform independent probably. Also if there are methods in JDK or Apache component
that work just fine, I hesitate to use third party libraries.
{code}
661	    final String nnDirStr = Joiner.on("/").join(
662	        hdfsDir.toString(),
663	        GenericTestUtils.getMethodName(), "name");
{code}
# I don't think we need the implementation details about the Collection type (List). We just
need the only element in the collections, don't we?
{code}
673	      /* get and verify NN dir */
674	      List<URI> nameDirs = (List<URI>) FSNamesystem.getNamespaceDirs(config);
{code}
Alternatively:
{code}
Collection<URI> nameDirs = FSNamesystem.getNamespaceDirs(config);
assertNotNull(nameDirs);
assertTrue(nameDirs.iterator().hasNext());
final URI nameDir = nameDirs.iterator().next();
...
{code}

> Add unit tests for NameNode failing to startup when name dir can not be written
> -------------------------------------------------------------------------------
>
>                 Key: HDFS-11085
>                 URL: https://issues.apache.org/jira/browse/HDFS-11085
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: namenode, test
>            Reporter: Mingliang Liu
>            Assignee: Xiaobing Zhou
>         Attachments: HDFS-11085.000.patch
>
>
> This can be placed in {{org.apache.hadoop.hdfs.server.namenode.TestStartup}} test class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org


Mime
View raw message