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

Ayush Saxena commented on HDFS-14519:
-------------------------------------

Thanx [~RANith] for v002.
The UT introduced seems to fail.

{code:java}
+      Path[] srcs = new Path[4];
+      for (int i = 1; i < 4; i++) {
+        srcs[i] = new Path(dir + "/file" + i);
+        DFSTestUtil.createFile(dfs, srcs[i], 512, (short) 1, 0);
+      }
+
{code}

i starts from 1 rather than 0, making the 0th elem NULL, thus the failure.

Anyway, I tried fixing and handling the comments missed up 
The final code looked like this:

{code:java}
@Test
  public void testConcat() throws IOException {
    Configuration conf = new Configuration();
    try (MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).build()) {
      cluster.waitActive();
      DistributedFileSystem dfs = cluster.getFileSystem();
      String dir = "/testConcat";
      dfs.mkdirs(new Path(dir), FsPermission.getDirDefault());
      dfs.setQuota(new Path(dir), 100L, HdfsConstants.QUOTA_DONT_SET);

      // Create 4 files
      Path trg = new Path(dir + "/file");
      DFSTestUtil.createFile(dfs, trg, 512, (short) 1, 0);
      Path[] srcs = new Path[4];
      for (int i = 0; i < 4; i++) {
        srcs[i] = new Path(dir + "/file" + i);
        DFSTestUtil.createFile(dfs, srcs[i], 512, (short) 1, 0);
      }

      // Concat file1, file2, file3 to file0
      dfs.concat(trg, srcs);

      // Check the file and directory count and consumed space
      ContentSummary cs = dfs.getContentSummary(new Path(dir));
      QuotaUsage qu = dfs.getQuotaUsage(new Path(dir));

      Assert.assertEquals(cs.getFileCount() + cs.getDirectoryCount(),
          qu.getFileAndDirectoryCount());
    }

{code}

You may update accordingly. :)

> NameQuota is not update after concat operation, so namequota is wrong
> ---------------------------------------------------------------------
>
>                 Key: HDFS-14519
>                 URL: https://issues.apache.org/jira/browse/HDFS-14519
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Ranith Sardar
>            Assignee: Ranith Sardar
>            Priority: Major
>         Attachments: HDFS-14519.001.patch, HDFS-14519.002.patch
>
>




--
This message was sent by Atlassian Jira
(v8.3.2#803003)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to