Examples of FileStatus


Examples of org.apache.hadoop.fs.FileStatus

                        HRegionInfo.encodeRegionName(key)),
                        HREGION_OLDLOGFILE_NAME);
                    Path oldlogfile = null;
                    SequenceFile.Reader old = null;
                    if (fs.exists(logfile)) {
                      FileStatus stat = fs.getFileStatus(logfile);
                      if (stat.getLen() <= 0) {
                        LOG.warn("Old hlog file " + logfile + " is zero " +
                          "length. Deleting existing file");
                        fs.delete(logfile, false);
                      } else {
                        LOG.warn("Old hlog file " + logfile + " already " +
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

                                   ") total_size(" + cbsize + ") listuri(" +
                                   srcfilelist + ")");
      }
      Path src = new Path(srcfilelist);
      FileSystem fs = src.getFileSystem(job);
      FileStatus srcst = fs.getFileStatus(src);

      ArrayList<FileSplit> splits = new ArrayList<FileSplit>(numSplits);
      LongWritable key = new LongWritable();
      FilePair value = new FilePair();
      final long targetsize = cbsize / numSplits;
      long pos = 0L;
      long last = 0L;
      long acc = 0L;
      long cbrem = srcst.getLen();
      for (SequenceFile.Reader sl = new SequenceFile.Reader(fs, src, job);
           sl.next(key, value); last = sl.getPosition()) {
        // if adding this split would put this split past the target size,
        // cut the last split and put this next file in the next split.
        if (acc + key.get() > targetsize && acc != 0) {
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

        if (!destFileSys.mkdirs(absdst.getParent())) {
          throw new IOException("Failed to craete parent dir: " + absdst.getParent());
        }
        rename(destFileSys, tmpfile, absdst);

        FileStatus dststat = destFileSys.getFileStatus(absdst);
        if (dststat.getLen() != srcstat.getLen()) {
          destFileSys.delete(absdst);
          throw new IOException("File size not matched: copied "
              + bytesString(dststat.getLen()) + " to dst (=" + absdst
              + ") but expected " + bytesString(srcstat.getLen())
              + " from " + srcstat.getPath());       
        }
      }
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

     */
    public void map(LongWritable key,
                    FilePair value,
                    OutputCollector<WritableComparable, Text> out,
                    Reporter reporter) throws IOException {
      FileStatus srcstat = value.input;
      Path dstpath = value.output;
      try {
        copy(srcstat, dstpath, out, reporter);
      } catch (IOException e) {
        ++failcount;
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

   * @throws IOException
   */
  private Map<Long, StoreFile> loadStoreFiles()
  throws IOException {
    Map<Long, StoreFile> results = new HashMap<Long, StoreFile>();
    FileStatus files[] = this.fs.listStatus(this.homedir);
    for (int i = 0; files != null && i < files.length; i++) {
      // Skip directories.
      if (files[i].isDir()) {
        continue;
      }
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

      }
      long modif;
      try {
        modif = df.parse(attrs.getValue("modified")).getTime();
      } catch (ParseException e) { throw new SAXException(e); }
      FileStatus fs = "file".equals(qname)
        ? new FileStatus(
              Long.valueOf(attrs.getValue("size")).longValue(), false,
              Short.valueOf(attrs.getValue("replication")).shortValue(),
              Long.valueOf(attrs.getValue("blocksize")).longValue(),
              modif, FsPermission.valueOf(attrs.getValue("permission")),
              attrs.getValue("owner"), attrs.getValue("group"),
              new Path("hftp", fshostname + ":" + fsport,
                       attrs.getValue("path")))
        : new FileStatus(0L, true, 0, 0L,
              modif, FsPermission.valueOf(attrs.getValue("permission")),
              attrs.getValue("owner"), attrs.getValue("group"),
              new Path("hftp", fshostname + ":" + fsport,
                       attrs.getValue("path")));
      fslist.add(fs);
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

  @Override
  public List<Split> getSplits(Path path) throws IOException {
    List<Split> splits = new ArrayList<Split>();

    FileSystem fs = path.getFileSystem(getConfiguration());
    FileStatus status = fs.getFileStatus(path);

    long length = status.getLen();
    BlockLocation[] blocks = fs.getFileBlockLocations(status, 0, length);

    long blockSize = status.getBlockSize();
    long splitSize = computeSplitSize(blockSize, getMinSplitSize(), getMaxSplitSize());

    long remaining = length;
    while (((double) remaining) / splitSize > slop) {
      int i = getBlockIndex(blocks, length - remaining);
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

    SmartResourceLocalizer localizer = (SmartResourceLocalizer) factory.getObject();
    localizer.copy();

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path(dir + "/test-site-1.xml"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), greaterThan(0l));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

    localizer.setStagingDirectory(new Path(dir));
    localizer.setStagingId("foo-id");
    localizer.copy();

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path(dir + "/foo-id/test-site-1.xml"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), greaterThan(0l));
  }
View Full Code Here

Examples of org.apache.hadoop.fs.FileStatus

    Map<String, LocalResource> resources = localizer.getResources();
    assertThat(resources, notNullValue());
    assertThat(resources.size(), is(1));

    FileSystem fs = FileSystem.get(configuration);
    FileStatus fileStatus = fs.getFileStatus(new Path("/tmp/foo/foo-id/test-site-1.xml"));
    assertThat(fileStatus.isFile(), is(true));
    assertThat(fileStatus.getLen(), greaterThan(0l));

  }
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.