Examples of hardLink()


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

        // create /user/dir2
        Path dir2 = new Path("/user/dir2");
        fs.mkdirs(dir2);
        Path file2 = new Path(dir2, "file2");
        // ln /user/dir1/ /user/dir2/ [error: cannot hard link a directory]
        result = fs.hardLink(dir1, dir2);
        Assert.assertFalse(result);
       
        // ln /user/dir1/file1 /user/dir2/file2
        result = fs.hardLink(file1, file2);
        Assert.assertTrue(result);
View Full Code Here

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

        // ln /user/dir1/ /user/dir2/ [error: cannot hard link a directory]
        result = fs.hardLink(dir1, dir2);
        Assert.assertFalse(result);
       
        // ln /user/dir1/file1 /user/dir2/file2
        result = fs.hardLink(file1, file2);
        Assert.assertTrue(result);
        verifyLinkedFileIdenticial(fs, fStatus1, fs.getFileStatus(file1), content);
       
        /*
         * du /user/dir2 -> dirLength2
View Full Code Here

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

        verifyLinkedFileIdenticial(fs, fStatus1, fStatus2, content);
        System.out.println("dir2 length: " + dirLength2 + " file2 length: " + fileLength2);
       
        // ln /user/dir1/file1 /user/dir2/file2
        // client can retry the hardlink operation without error
        result = fs.hardLink(file1, file2);
        Assert.assertTrue(result);
       
        Path dir3= new Path("/user/dir3");
        Path file3 = new Path(dir3, "file3");
       
View Full Code Here

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

       
        Path dir3= new Path("/user/dir3");
        Path file3 = new Path(dir3, "file3");
       
        // ln /user/dir2/file2 /user/dir3/file3 [error: dir3 does not exist]
        result = fs.hardLink(file2, file3);
        Assert.assertFalse(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.assertFalse(result);
  
        // ln /user/dir2/file2 /user/dir3/file3
        fs.mkdirs(dir3);
        result = fs.hardLink(file2, file3);

        Assert.assertTrue(result);
        FileStatus fStatus3 = fs.getFileStatus(file3);
       
        long dirLength3 = fs.getContentSummary(dir3).getLength();
View Full Code Here

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

    final MiniDFSCluster cluster = new MiniDFSCluster(conf, 1, true, null);
    try {
      final FileSystem fs = cluster.getFileSystem();
      DFSTestUtil.createFile(fs, new Path("/f1"), 1, (short) 1, 0);
      DFSTestUtil.createFile(fs, new Path("/f2"), 1, (short) 1, 0);
      fs.hardLink(new Path("/f1"), new Path("/dst/f1"));
      cluster.getNameNode().saveNamespace(true, false);
      cluster.restartNameNode();
      fs.hardLink(new Path("/f2"), new Path("/dst/f2"));
      long hid1 = cluster.getNameNode().namesystem.dir.getHardLinkId("/f1");
      long hid2 = cluster.getNameNode().namesystem.dir.getHardLinkId("/f2");
View Full Code Here

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

      DFSTestUtil.createFile(fs, new Path("/f1"), 1, (short) 1, 0);
      DFSTestUtil.createFile(fs, new Path("/f2"), 1, (short) 1, 0);
      fs.hardLink(new Path("/f1"), new Path("/dst/f1"));
      cluster.getNameNode().saveNamespace(true, false);
      cluster.restartNameNode();
      fs.hardLink(new Path("/f2"), new Path("/dst/f2"));
      long hid1 = cluster.getNameNode().namesystem.dir.getHardLinkId("/f1");
      long hid2 = cluster.getNameNode().namesystem.dir.getHardLinkId("/f2");
      assertEquals(0, hid1);
      assertEquals(1, hid2);
    } finally {
View Full Code Here

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

      // create /user/dir2
      Path dir2 = new Path("/user/dir2");
      fs.mkdirs(dir2);
      Path file2 = new Path(dir2, "file2");
      // ln /user/dir1/ /user/dir2/ [error: cannot hard link a directory]
      result = fs.hardLink(dir1, dir2);
      Assert.assertFalse(result);
     
      // ln /user/dir1/file1 /user/dir2/file2
      result = fs.hardLink(file1, file2);
View Full Code Here

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

      // ln /user/dir1/ /user/dir2/ [error: cannot hard link a directory]
      result = fs.hardLink(dir1, dir2);
      Assert.assertFalse(result);
     
      // ln /user/dir1/file1 /user/dir2/file2
      result = fs.hardLink(file1, file2);

      // Verify links.
      links = fs.getHardLinkedFiles(file1);
      Assert.assertEquals(1, links.length);
      Assert.assertEquals(file2, new Path(links[0]));
View Full Code Here

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

      verifyLinkedFileIdenticial(fs, nameNode, fStatus1, fStatus2, content);
      System.out.println("dir2 length: " + dirLength2 + " file2 length: " + fileLength2);
     
      // ln /user/dir1/file1 /user/dir2/file2
      // client can retry the hardlink operation without error
      result = fs.hardLink(file1, file2);
      Assert.assertTrue(result);
     
      Path dir3= new Path("/user/dir3/dir33/dir333");
      Path file3 = new Path(dir3, "file3");
     
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.