Examples of hardLink()


Examples of org.apache.hadoop.fs.FileSystem.hardLink()

     
      Path dir3= new Path("/user/dir3/dir33/dir333");
      Path file3 = new Path(dir3, "file3");
     
      // ln /user/dir2/file2 /user/dir3/dir33/dir333/file3 [create the intermediate dirs on the fly]
      result = fs.hardLink(file2, file3);
      Assert.assertTrue(result);
      // ln /user/dir2/file2 /user/dir3/file3
      fs.mkdirs(dir3);
      result = fs.hardLink(file2, file3);
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

      result = fs.hardLink(file2, file3);
      Assert.assertTrue(result);
      // ln /user/dir2/file2 /user/dir3/file3
      fs.mkdirs(dir3);
      result = fs.hardLink(file2, file3);

      // Verify links, now 3 links file1, file2, file3
      links = fs.getHardLinkedFiles(file1);
      Assert.assertEquals(2, links.length);
      for (String link : links) {
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

        final Path target = new Path(dir1, "file-" + i)
        final Path hardLink1 = new Path(dir1, "hardlink-file-" + i)
        final Path hardLink2 = new Path(dir2, "hardlink-file-" + i)
         
        DFSTestUtil.createFile(dfs, target, 1L, (short)3, 0L)
        fs.hardLink(target, hardLink1);
        fs.hardLink(target, hardLink2);
         
        c1 = dfs.getContentSummary(dir1);
        Assert.assertEquals(2 * i, c1.getFileCount())
         
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

        final Path hardLink1 = new Path(dir1, "hardlink-file-" + i)
        final Path hardLink2 = new Path(dir2, "hardlink-file-" + i)
         
        DFSTestUtil.createFile(dfs, target, 1L, (short)3, 0L)
        fs.hardLink(target, hardLink1);
        fs.hardLink(target, hardLink2);
         
        c1 = dfs.getContentSummary(dir1);
        Assert.assertEquals(2 * i, c1.getFileCount())
         
        c2 = dfs.getContentSummary(dir2);
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

      // 2: create file1 and its hardlink file: file1-hardlink-orig
      final Path file1 =  new Path(root, "file1");
      DFSTestUtil.createFile(dfs, file1, 1L, (short)3, 0L);
     
      final Path file1HardLinkOrig =  new Path(root, "file1-hardlink-orig");
      fs.hardLink(file1, file1HardLinkOrig);
      Assert.assertEquals(1, fs.getHardLinkedFiles(file1).length);
     
      c = dfs.getContentSummary(root);
      Assert.assertEquals(2, c.getFileCount());
      Assert.assertEquals(4, cluster.getNameNode().getNamesystem().getFilesAndDirectoriesTotal());
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

      Assert.assertEquals(2, c.getFileCount());
      Assert.assertEquals(4, cluster.getNameNode().getNamesystem().getFilesAndDirectoriesTotal());
     
      // 4: create a new hardlink file for the file1: file1-hardlink-new
      final Path file1HardLinkNew =  new Path(root, "file1-hardlink-new");
      fs.hardLink(file1, file1HardLinkNew);
      Assert.assertEquals(1, fs.getHardLinkedFiles(file1).length);
      Assert.assertEquals(1, fs.getHardLinkedFiles(file1HardLinkNew).length);
      Assert.assertEquals(0, fs.getHardLinkedFiles(file1HardLinkOrig).length);
     
      c = dfs.getContentSummary(root);
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

      byte[] content = TestFileCreation.writeFile(stm1);
      stm1.close();
     
      Path file11 =  new Path(root, "file-11");
      Path file12 =  new Path(root, "file-12");
      fs.hardLink(file10, file11);
      fs.hardLink(file11, file12);
     
      verifyLinkedFileIdenticial(fs, nameNode, fs.getFileStatus(file10), fs.getFileStatus(file11),
          content);
      verifyLinkedFileIdenticial(fs, nameNode, fs.getFileStatus(file10), fs.getFileStatus(file12),
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

      stm1.close();
     
      Path file11 =  new Path(root, "file-11");
      Path file12 =  new Path(root, "file-12");
      fs.hardLink(file10, file11);
      fs.hardLink(file11, file12);
     
      verifyLinkedFileIdenticial(fs, nameNode, fs.getFileStatus(file10), fs.getFileStatus(file11),
          content);
      verifyLinkedFileIdenticial(fs, nameNode, fs.getFileStatus(file10), fs.getFileStatus(file12),
          content);
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

      verifyNSQuotaSetting(dfs, dir1, 4 ,3);
      verifyNSQuotaSetting(dfs, dir2, 2, 2);
     
      // 5: ln /user/dir1/dir2/file-10 /user/dir1/dir2/file-11 and catch the NSQuotaExceededException
      try {
        fs.hardLink(file10, file11);
        Assert.fail("Expect an NSQuotaExceededException thrown out");
      } catch (NSQuotaExceededException e) {}
      verifyNSQuotaSetting(dfs, root, 6 ,4);
      verifyNSQuotaSetting(dfs, dir1, 4 ,3);
      verifyNSQuotaSetting(dfs, dir2, 2, 2);
View Full Code Here

Examples of org.apache.hadoop.fs.FileSystem.hardLink()

      verifyNSQuotaSetting(dfs, dir1, 4 ,3);
      verifyNSQuotaSetting(dfs, dir2, 2, 2);
     
      // 6: ln /user/dir1/dir2/file-10 /user/dir1/file-12 and verify the quota
      final Path file12 =  new Path(dir1, "file-12");
      assertTrue(fs.hardLink(file10, file12));
      verifyNSQuotaSetting(dfs, root, 6 ,5);
      verifyNSQuotaSetting(dfs, dir1, 4 ,4);
      verifyNSQuotaSetting(dfs, dir2, 2, 2);
     
      // 7: ln /user/dir1/dir2/file-10 /user/dir1/file-13 and catch the NSQuotaExceededException
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.