Examples of INodeDirectory


Examples of org.apache.hadoop.hdfs.server.namenode.INodeDirectory

        .isEmpty());
   
    assertTrue(hdfs.exists(newfoo));
    INode fooRefNode = fsdir.getINode4Write(newfoo.toString());
    assertTrue(fooRefNode instanceof INodeReference.DstReference);
    INodeDirectory fooNode = fooRefNode.asDirectory();
    // fooNode should be still INodeDirectoryWithSnapshot since we call
    // recordModification before the rename
    assertTrue(fooNode instanceof INodeDirectoryWithSnapshot);
    assertTrue(((INodeDirectoryWithSnapshot) fooNode).getDiffs().asList()
        .isEmpty());
    INodeDirectory barNode = fooNode.getChildrenList(null).get(0).asDirectory();
    // bar should also be an INodeDirectoryWithSnapshot, and both of its diff
    // list and children list are empty
    assertTrue(((INodeDirectoryWithSnapshot) barNode).getDiffs().asList()
        .isEmpty());
    assertTrue(barNode.getChildrenList(null).isEmpty());
   
    restartClusterAndCheckImage(true);
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.server.namenode.INodeDirectory

                         int blocksPerFile, long startingBlockId,
                         FileNameGenerator nameGenerator) {
   
    PermissionStatus p = new PermissionStatus("joeDoe", "people",
                                      new FsPermission((short)0777));
    INodeDirectory dirInode = new INodeDirectory(p, 0L);
    editLog.logMkDir(BASE_PATH, dirInode);
    long blockSize = 10;
    BlockInfo[] blocks = new BlockInfo[blocksPerFile];
    for (int iB = 0; iB < blocksPerFile; ++iB) {
      blocks[iB] =
       new BlockInfo(new Block(0, blockSize, GenerationStamp.FIRST_VALID_STAMP),
                               replication);
    }
   
    long currentBlockId = startingBlockId;
    long bidAtSync = startingBlockId;

    for (int iF = 0; iF < numFiles; iF++) {
      for (int iB = 0; iB < blocksPerFile; ++iB) {
         blocks[iB].setBlockId(currentBlockId++);
      }

      try {

        INodeFileUnderConstruction inode = new INodeFileUnderConstruction(
                      null, replication, 0, blockSize, blocks, p, "", "", null);
        // Append path to filename with information about blockIDs
        String path = "_" + iF + "_B" + blocks[0].getBlockId() +
                      "_to_B" + blocks[blocksPerFile-1].getBlockId() + "_";
        String filePath = nameGenerator.getNextFileName("");
        filePath = filePath + path;
        // Log the new sub directory in edits
        if ((iF % nameGenerator.getFilesPerDirectory())  == 0) {
          String currentDir = nameGenerator.getCurrentDir();
          dirInode = new INodeDirectory(p, 0L);
          editLog.logMkDir(currentDir, dirInode);
        }
        editLog.logOpenFile(filePath, inode);
        editLog.logCloseFile(filePath, inode);
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.