Examples of DFSWriteProfilingData


Examples of org.apache.hadoop.hdfs.profiling.DFSWriteProfilingData

      DFSWriteProfilingData profile) {
    profileForNextOutputStream.set(profile);
  }

  public static DFSWriteProfilingData getAndResetProfileDataForNextOutputStream() {
    DFSWriteProfilingData profile = profileForNextOutputStream.get();
    profileForNextOutputStream.remove();
    return profile;
  }
View Full Code Here

Examples of org.apache.hadoop.hdfs.profiling.DFSWriteProfilingData

   
    FileSystem fs = cluster.getFileSystem(conf);
   
    try {

      DFSWriteProfilingData profile = new DFSWriteProfilingData();     
      DFSClient.setProfileDataForNextOutputStream(profile);
     
     
      // create a new file.
      Path file1 = new Path("/simpleFlush.dat");
      FSDataOutputStream stm = createFile(fs, file1, 3);
      System.out.println("Created file simpleFlush.dat");

      // write to file
      int mid = fileSize/2;
      try {
        stm.write(fileContents, 0, mid);
        stm.sync();
        if (!datnodeInlineChecksum && clientInlineChecksum) {
          TestCase
              .fail("Client should fail writing to datanode with inline checksum disabled with inline checksum enabled in client side");
        }
      } catch (IOException ioe) {
        if (datnodeInlineChecksum || !clientInlineChecksum) {
          throw ioe;
        } else {
          return;
        }
      }
      System.out.println("Wrote and Flushed first part of file.");

      // write the remainder of the file
      stm.write(fileContents, mid, fileSize - mid);
      System.out.println("Written second part of file");
      stm.sync();
      stm.sync();
      System.out.println("Wrote and Flushed second part of file.");

      // verify that full blocks are sane
      checkFile(fs, file1, 1);

      stm.close();
      System.out.println("Closed file.");

      // verify that entire file is good
      checkFullFile(fs, file1);
     
      System.out.println("Profile: " + profile.toString());

    } catch (IOException e) {
      System.out.println("Exception :" + e);
      throw e;
    } catch (Throwable e) {
View Full Code Here

Examples of org.apache.hadoop.hdfs.profiling.DFSWriteProfilingData

    DistributedFileSystem fs = (DistributedFileSystem)cluster.getFileSystem();

    initBuffer(fileLen);

    try {
      DFSWriteProfilingData profile = new DFSWriteProfilingData();     
      DFSClient.setProfileDataForNextOutputStream(profile);
     
      // create a new file.
      FSDataOutputStream stm = createFile(fs, p, DATANODE_NUM);
View Full Code Here

Examples of org.apache.hadoop.hdfs.profiling.DFSWriteProfilingData

   */
  public void testSlowWritePacketLogging() throws Exception {
    DistributedFileSystem fs = (DistributedFileSystem) cluster.getFileSystem();
    WriteOptions options = new WriteOptions();
    options.setLogSlowWriteProfileDataThreshold(1);
    DFSWriteProfilingData data = new DFSWriteProfilingData();
    DFSClient.setProfileDataForNextOutputStream(data);
    OutputStream out = fs.create(new Path("/test"), null, true, 4096,
        (short) 3, 1024, 512, null, null, options);
    byte[] buffer = new byte[1024 * 1024];
    out.write(buffer);
View Full Code Here

Examples of org.apache.hadoop.hdfs.profiling.DFSWriteProfilingData

      return value;
    }
  }
 
  static private DFSWriteProfilingData getProfile(DFSClient dfsClient) {
    DFSWriteProfilingData profile = DFSClient.getAndResetProfileDataForNextOutputStream();
    if (dfsClient != null) {
      boolean ifAutoPrint = dfsClient.conf.getBoolean(
          FSConstants.FS_OUTPUT_STREAM_AUTO_PRINT_PROFILE, false);
      if (ifAutoPrint) {
        if (profile == null) {
          profile = new DFSWriteProfilingData();
        }
        profile.setAutoPrintWhileClose(true);
      }
    }
    return profile;
  }
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.