Package org.apache.hadoop.hdfs

Examples of org.apache.hadoop.hdfs.DistributedFileSystem.rename()


        hasException = true;
      }
      assertTrue(hasException);

      // 14: Move /nqdir0/qdir1/qdir21 /nqdir0/qdir1/qdir20
      assertTrue(dfs.rename(quotaDir3, quotaDir2));
      c = dfs.getContentSummary(quotaDir1);
      assertEquals(c.getDirectoryCount(), 4);
      assertEquals(c.getQuota(), 6);
      c = dfs.getContentSummary(quotaDir2);
      assertEquals(c.getDirectoryCount(), 3);
View Full Code Here


      c = dfs.getContentSummary(quotaDir1);
      assertEquals(c.getDirectoryCount(), 3);
      assertEquals(c.getQuota(), 6);

      // 16: Move /nqdir0/qdir30 /nqdir0/qdir1/qdir20
      assertTrue(dfs.rename(new Path("/nqdir0/nqdir30"), quotaDir2));
      c = dfs.getContentSummary(quotaDir2);
      assertEquals(c.getDirectoryCount(), 5);
      assertEquals(c.getQuota(), 7);
      c = dfs.getContentSummary(quotaDir1);
      assertEquals(c.getDirectoryCount(), 6);
View Full Code Here

      assertEquals(c.getSpaceConsumed(), 0);
     
      // Move /nqdir0/qdir1/qdir21/nqdir32 /nqdir0/qdir1/qdir20/nqdir30
      Path dstPath = new Path(quotaDir20, "nqdir30");
      Path srcPath = new Path(quotaDir21, "nqdir32");
      assertTrue(dfs.rename(srcPath, dstPath));
     
      // verify space after the move
      c = dfs.getContentSummary(quotaDir20);
      assertEquals(c.getSpaceConsumed(), fileSpace);
      // verify space for its parent
View Full Code Here

      assertEquals(c.getSpaceConsumed(), 0);
     
      // Reverse: Move /nqdir0/qdir1/qdir20/nqdir30 to /nqdir0/qdir1/qdir21/
      hasException = false;
      try {
        assertFalse(dfs.rename(dstPath, srcPath));
      } catch (DSQuotaExceededException e) {
        hasException = true;
      }
      assertTrue(hasException);
     
View Full Code Here

        TestRaidDfs.createTestFile(dfs, new Path(dirPath, "file3"), (short)1,
                          5, blockSize);
      } else {
        // rename file
        Path newPath = new Path(files[1].toUri().getPath() + "_rename");
        dfs.rename(files[1], newPath);
        LOG.info("Rename file: " + files[1]);
        files[1] = newPath;
      }
      FileStatus newDirStat = dfs.getFileStatus(dirPath);
      // assert the modification is changed.
View Full Code Here

        TestRaidDfs.createTestFile(dfs, new Path(dirPath, "file3"), (short)1,
                          5, blockSize);
      } else {
        // rename file
        Path newFile = new Path(files[0].toUri().getPath() + "_rename");
        dfs.rename(files[0], newFile);
        files[0] = newFile;
      }
     
      FileStatus newDirStat = dfs.getFileStatus(dirPath);
      // assert the modification is changed.
View Full Code Here

    FSDataOutputStream s = dfs.create(pathFileCreate);
    // OP_CLOSE 9
    s.close();
    // OP_RENAME 1
    Path pathFileMoved = new Path("/file_moved");
    dfs.rename(pathFileCreate, pathFileMoved);
    // OP_DELETE 2
    dfs.delete(pathFileMoved, false);
    // OP_MKDIR 3
    Path pathDirectoryMkdir = new Path("/directory_mkdir");
    dfs.mkdirs(pathDirectoryMkdir);
View Full Code Here

       * /
       *  /testone
       *    /file
       */
      Path renamedPath = new Path("/testtwo");
      assertTrue(fs.rename(path, renamedPath));
      assertEquals(expectedLastInodeId, fsDir.getLastInodeId());
      assertEquals(inodeCount, fsn.dir.getInodeMapSize());
     
      /**
       * Delete testtwo and ensure inode map size decreases
View Full Code Here

    // delete destination if exists
    if (dfs.exists(parityFile)){
      dfs.delete(parityFile, false);
    }
    dfs.mkdirs(parityFile.getParent());
    if (!dfs.rename(finalTmpParity, parityFile)) {
      String msg = "Unable to rename file " + finalTmpParity + " to " + parityFile;
      throw new IOException (msg);
    }
    LOG.info("Wrote parity file " + parityFile);
   
View Full Code Here

          return false;
        }
        InjectionHandler.processEventIO(
            InjectionEvent.RAID_ENCODING_FAILURE_RENAME_FILE);
        // Move the directory to final
        if (!dfs.rename(tmpPartialParityDir, finalPartialParityDir)) {
          LOG.info("Fail to rename " + tmpPartialParityDir + " to " +
              finalPartialParityDir);
          return false;
        }
        LOG.info("Renamed " + tmpPartialParityDir + " to " +
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.