Examples of DFSDataInputStream


Examples of org.apache.hadoop.hdfs.DFSClient.DFSDataInputStream

    LOG.info("Store the checksums of source blocks into checksumStore");
    for (int i = 0; i < streams.length; i++) {
      if (streams[i] != null &&
          streams[i] instanceof DFSDataInputStream &&
          !(streams[i] instanceof RaidUtils.ZeroInputStream)) {
        DFSDataInputStream stream = (DFSDataInputStream)this.streams[i];
        Long newVal = checksums[i].getValue();
        ckmStore.putIfAbsentChecksum(stream.getCurrentBlock(), newVal);
      }
    }
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.DFSClient.DFSDataInputStream

          .create(path, true, 4096, (short) 2, (long) 2048);
      stm.write(new byte[4096]);
      stm.close();
     
      FSDataInputStream is = fs.open(path);
      DFSDataInputStream dis = (DFSDataInputStream) is;
      TestCase.assertNotNull(dis);

      is.read(new byte[1024]);
      DatanodeInfo currentDn1 = dis.getCurrentDatanode();
      dis.setUnfavoredNodes(Arrays.asList(new DatanodeInfo[] { currentDn1 }));

      is.read(new byte[512]);
      DatanodeInfo currentDn2 = dis.getCurrentDatanode();
      TestCase.assertTrue(!currentDn2.equals(currentDn1));
      dis.setUnfavoredNodes(Arrays.asList(new DatanodeInfo[] { currentDn1, currentDn2 }));

      is.read(new byte[512]);
      TestCase.assertEquals(currentDn1, dis.getCurrentDatanode());
     
      is.read(new byte[1024]);
     
      TestCase.assertEquals(dis.getAllBlocks().get(1).getLocations()[0],
          dis.getCurrentDatanode());
    }
    finally {
      if (cluster != null) {cluster.shutdown();}
    }   
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.DFSClient.DFSDataInputStream

    fs.delete(root, true);
    files = null;
  }
 
  public static Block getFirstBlock(FileSystem fs, Path path) throws IOException {
    DFSDataInputStream in =
      (DFSDataInputStream) ((DistributedFileSystem)fs).open(path);
    in.readByte();
    return in.getCurrentBlock();
 
View Full Code Here

Examples of org.apache.hadoop.hdfs.DFSClient.DFSDataInputStream

      }
    });
   
    // Set visible length of all replicas to be smaller
    int SIZE_TO_SHRINK = 5;
    DFSDataInputStream is = (DFSDataInputStream) in;
    for (DataNode dn : cluster.getDataNodes()) {
      ReplicaBeingWritten rbw = dn.data.getReplicaBeingWritten(
          fs.dfs.getNamespaceId(), is.getCurrentBlock());
      if (rbw != null) {
        rbw.setBytesAcked(len1 - SIZE_TO_SHRINK);
      }
    }
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.